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

Change-Id: I81f0f8ad645bec95579bd0487f3f1098ab5823df
diff --git a/Android.bp b/Android.bp
index a98db38..b747baa 100644
--- a/Android.bp
+++ b/Android.bp
@@ -103,6 +103,7 @@
         "settings-logtags",
         "settings-telephony-protos-lite",
         "statslog-settings",
+        "SystemUISharedLib",
         "vendor.lineage.fastcharge-V1.0-java",
         "vendor.lineage.touch-V1.0-java",
     ],
diff --git a/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java b/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
index 58ae540..ad461a5 100644
--- a/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
+++ b/src/com/android/settings/gestures/GestureNavigationSettingsFragment.java
@@ -31,6 +31,8 @@
 import com.android.settings.widget.SeekBarPreference;
 import com.android.settingslib.search.SearchIndexable;
 
+import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
+
 /**
  * A fragment to include all the settings related to Gesture Navigation mode.
  */
@@ -46,6 +48,8 @@
     private static final String RIGHT_EDGE_SEEKBAR_KEY = "gesture_right_back_sensitivity";
     private static final String KEY_BACK_HEIGHT = "gesture_back_height";
 
+    private static final String NAVIGATION_BAR_HINT_KEY = "navigation_bar_hint";
+
     private WindowManager mWindowManager;
     private BackGestureIndicatorView mIndicatorView;
 
@@ -80,6 +84,13 @@
         initSeekBarPreference(LEFT_EDGE_SEEKBAR_KEY);
         initSeekBarPreference(RIGHT_EDGE_SEEKBAR_KEY);
         initSeekBarPreference(KEY_BACK_HEIGHT);
+
+        boolean isTaskbarEnabled = Settings.System.getInt(getContext().getContentResolver(),
+                Settings.System.ENABLE_TASKBAR, isLargeScreen(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 c40212b..dc58e38 100644
--- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
+++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
@@ -56,6 +56,8 @@
 import com.android.settingslib.widget.IllustrationPreference;
 import com.android.settingslib.widget.SelectorWithWidgetPreference;
 
+import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -196,6 +198,9 @@
         final Context c = getContext();
         List<CandidateInfoExtra> candidates = new ArrayList<>();
 
+        boolean isTaskbarEnabled = Settings.System.getInt(getContext().getContentResolver(),
+                Settings.System.ENABLE_TASKBAR, isLargeScreen(getContext()) ? 1 : 0) == 1;
+
         if (SystemNavigationPreferenceController.isOverlayPackageAvailable(c,
                 NAV_BAR_MODE_GESTURAL_OVERLAY)) {
             candidates.add(new CandidateInfoExtra(
@@ -203,7 +208,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),