Merge "Hide taskbar on lockscreen" into sc-v2-dev am: 61eb1fe0ac

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15264051

Change-Id: I85a83bad3c2fbc4b5faad25c5fa0d932d5643823
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index 357dc7b..be3f5d9 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -130,6 +130,15 @@
         mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
                 flags -> (flags & FLAG_IME_VISIBLE) != 0));
 
+        mPropertyHolders.add(new StatePropertyHolder(
+                mControllers.taskbarViewController.getTaskbarIconAlpha()
+                        .getProperty(ALPHA_INDEX_KEYGUARD),
+                flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, MultiValueAlpha.VALUE, 1, 0));
+
+        mPropertyHolders.add(new StatePropertyHolder(mControllers.taskbarDragLayerController
+                .getKeyguardBgTaskbar(),
+                flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, AnimatedFloat.VALUE, 1, 0));
+
         if (mContext.isThreeButtonNav()) {
             initButtons(mNavButtonContainer, mEndContextualContainer,
                     mControllers.navButtonController);
@@ -137,12 +146,9 @@
             // Animate taskbar background when IME shows
             mPropertyHolders.add(new StatePropertyHolder(
                     mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(),
-                    flags -> (flags & FLAG_IME_VISIBLE) == 0,
-                    AnimatedFloat.VALUE, 0, 1));
-            mPropertyHolders.add(new StatePropertyHolder(
-                    mControllers.taskbarViewController.getTaskbarIconAlpha()
-                            .getProperty(ALPHA_INDEX_KEYGUARD),
-                    flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, MultiValueAlpha.VALUE, 1, 0));
+                    flags -> (flags & FLAG_IME_VISIBLE) != 0 ||
+                            (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0,
+                    AnimatedFloat.VALUE, 1, 0));
 
             // Rotation button
             RotationButton rotationButton = new RotationButtonImpl(
@@ -222,7 +228,7 @@
     }
 
     /**
-     * Slightly misnamed, but should be called when only keyguard OR AOD is showing
+     * Slightly misnamed, but should be called when keyguard OR AOD is showing
      */
     public void setKeyguardVisible(boolean isKeyguardVisible) {
         updateStateForFlag(FLAG_KEYGUARD_VISIBLE, isKeyguardVisible);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
index e15e9ff..df89285 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java
@@ -39,6 +39,7 @@
     // Alpha properties for taskbar background.
     private final AnimatedFloat mBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
     private final AnimatedFloat mBgNavbar = new AnimatedFloat(this::updateBackgroundAlpha);
+    private final AnimatedFloat mKeyguardBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
     // Translation property for taskbar background.
     private final AnimatedFloat mBgOffset = new AnimatedFloat(this::updateBackgroundOffset);
 
@@ -56,6 +57,7 @@
     public void init(TaskbarControllers controllers) {
         mControllers = controllers;
         mTaskbarDragLayer.init(new TaskbarDragLayerCallbacks());
+        mKeyguardBgTaskbar.value = 1;
     }
 
     public void onDestroy() {
@@ -80,12 +82,18 @@
         return mBgNavbar;
     }
 
+    public AnimatedFloat getKeyguardBgTaskbar() {
+        return mKeyguardBgTaskbar;
+    }
+
     public AnimatedFloat getTaskbarBackgroundOffset() {
         return mBgOffset;
     }
 
     private void updateBackgroundAlpha() {
-        mTaskbarDragLayer.setTaskbarBackgroundAlpha(Math.max(mBgNavbar.value, mBgTaskbar.value));
+        mTaskbarDragLayer.setTaskbarBackgroundAlpha(
+                Math.max(mBgNavbar.value, mBgTaskbar.value * mKeyguardBgTaskbar.value)
+        );
     }
 
     private void updateBackgroundOffset() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
index 2936bd2..a2039b6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
@@ -57,10 +57,6 @@
         mKeyguardSysuiFlags = interestingKeyguardFlags;
 
         mBouncerShowing = bouncerShowing;
-        if (!mContext.isThreeButtonNav()) {
-            // For gesture nav we don't need to deal with bouncer or showing taskbar when locked
-            return;
-        }
 
         mNavbarButtonsViewController.setKeyguardVisible(keyguardShowing || dozing);
         updateIconsForBouncer();