Settings: Hide settings that don't work when taskbar is enabled

Change-Id: I81f0f8ad645bec95579bd0487f3f1098ab5823df
diff --git a/Android.bp b/Android.bp
index bed663f..140d448 100644
--- a/Android.bp
+++ b/Android.bp
@@ -80,6 +80,7 @@
         "org.lineageos.platform.internal",
         "LineagePreferenceLib",
         "vendor.lineage.fastcharge-V1.0-java",
+        "SystemUISharedLib",
     ],
 
     libs: [
diff --git a/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java b/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
index 546581b..15a6ade 100644
--- a/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
+++ b/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
@@ -31,6 +31,10 @@
 import com.android.settings.widget.SeekBarPreference;
 import com.android.settingslib.search.SearchIndexable;
 
+import static com.android.systemui.shared.recents.utilities.Utilities.isTablet;
+
+import lineageos.providers.LineageSettings;
+
 /**
  * A fragment to include all the settings related to Gesture Navigation mode.
  */
@@ -45,6 +49,8 @@
     private static final String LEFT_EDGE_SEEKBAR_KEY = "gesture_left_back_sensitivity";
     private static final String RIGHT_EDGE_SEEKBAR_KEY = "gesture_right_back_sensitivity";
 
+    private static final String NAVIGATION_BAR_HINT_KEY = "navigation_bar_hint";
+
     private WindowManager mWindowManager;
     private BackGestureIndicatorView mIndicatorView;
 
@@ -75,6 +81,13 @@
 
         initSeekBarPreference(LEFT_EDGE_SEEKBAR_KEY);
         initSeekBarPreference(RIGHT_EDGE_SEEKBAR_KEY);
+
+        boolean isTaskbarEnabled = LineageSettings.System.getInt(getContext().getContentResolver(),
+                LineageSettings.System.ENABLE_TASKBAR, isTablet(getContext()) ? 1 : 0) == 1;
+        if (isTaskbarEnabled) {
+            getPreferenceScreen().removePreference(
+                    getPreferenceScreen().findPreference(NAVIGATION_BAR_HINT_KEY));
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
index 08b043e..8c8d04e 100644
--- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
+++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
@@ -55,6 +55,10 @@
 import com.android.settingslib.widget.IllustrationPreference;
 import com.android.settingslib.widget.SelectorWithWidgetPreference;
 
+import static com.android.systemui.shared.recents.utilities.Utilities.isTablet;
+
+import lineageos.providers.LineageSettings;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -178,6 +182,9 @@
         final Context c = getContext();
         List<CandidateInfoExtra> candidates = new ArrayList<>();
 
+        boolean isTaskbarEnabled = LineageSettings.System.getInt(getContext().getContentResolver(),
+                LineageSettings.System.ENABLE_TASKBAR, isTablet(getContext()) ? 1 : 0) == 1;
+
         if (SystemNavigationPreferenceController.isOverlayPackageAvailable(c,
                 NAV_BAR_MODE_GESTURAL_OVERLAY)) {
             candidates.add(new CandidateInfoExtra(
@@ -185,7 +192,7 @@
                     c.getText(R.string.edge_to_edge_navigation_summary),
                     KEY_SYSTEM_NAV_GESTURAL, true /* enabled */));
         }
-        if (SystemNavigationPreferenceController.isOverlayPackageAvailable(c,
+        if (!isTaskbarEnabled && SystemNavigationPreferenceController.isOverlayPackageAvailable(c,
                 NAV_BAR_MODE_2BUTTON_OVERLAY)) {
             candidates.add(new CandidateInfoExtra(
                     c.getText(R.string.swipe_up_to_switch_apps_title),