Hide nav handle/background when taskbar is showing

Test: nav handle isn't showing unless taskbar is hidden or removed
Fixes: 181206743
Bug: 171917176
Change-Id: I84b7d0bba1a5d208b1f8b1b467faf79f04078348
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarVisibilityController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarVisibilityController.java
index 6d20d97..715e4ca 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarVisibilityController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarVisibilityController.java
@@ -65,6 +65,7 @@
     }
 
     protected void cleanup() {
+        setNavBarButtonAlpha(1f);
     }
 
     protected AnimatedFloat getTaskbarVisibilityForLauncherState() {
@@ -93,6 +94,14 @@
         float alphaDueToLauncher = Math.max(mTaskbarBackgroundAlpha.value,
                 mTaskbarVisibilityAlphaForLauncherState.value);
         float alphaDueToOther = mTaskbarVisibilityAlphaForIme.value;
-        mTaskbarCallbacks.updateTaskbarVisibilityAlpha(alphaDueToLauncher * alphaDueToOther);
+        float taskbarAlpha = alphaDueToLauncher * alphaDueToOther;
+        mTaskbarCallbacks.updateTaskbarVisibilityAlpha(taskbarAlpha);
+
+        // Make the nav bar invisible if taskbar is visible.
+        setNavBarButtonAlpha(1f - taskbarAlpha);
+    }
+
+    private void setNavBarButtonAlpha(float navBarAlpha) {
+        SystemUiProxy.INSTANCE.get(mLauncher).setNavBarButtonAlpha(navBarAlpha, false);
     }
 }
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 619103c..a70cc4c 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -62,6 +62,7 @@
     private boolean mLastShelfVisible;
     private float mLastNavButtonAlpha;
     private boolean mLastNavButtonAnimate;
+    private boolean mHasNavButtonAlphaBeenSet = false;
 
     // TODO(141886704): Find a way to remove this
     private int mLastSystemUiStateFlags;
@@ -163,10 +164,12 @@
     @Override
     public void setNavBarButtonAlpha(float alpha, boolean animate) {
         boolean changed = Float.compare(alpha, mLastNavButtonAlpha) != 0
-                || animate != mLastNavButtonAnimate;
+                || animate != mLastNavButtonAnimate
+                || !mHasNavButtonAlphaBeenSet;
         if (mSystemUiProxy != null && changed) {
             mLastNavButtonAlpha = alpha;
             mLastNavButtonAnimate = animate;
+            mHasNavButtonAlphaBeenSet = true;
             try {
                 mSystemUiProxy.setNavBarButtonAlpha(alpha, animate);
             } catch (RemoteException e) {