Merge "Don't show taskbar when keyguard occluded" into sc-v2-dev
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index 79bea03..3f621fd 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -75,9 +75,10 @@
     private static final int FLAG_A11Y_VISIBLE = 1 << 3;
     private static final int FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE = 1 << 4;
     private static final int FLAG_KEYGUARD_VISIBLE = 1 << 5;
-    private static final int FLAG_DISABLE_HOME = 1 << 6;
-    private static final int FLAG_DISABLE_RECENTS = 1 << 7;
-    private static final int FLAG_DISABLE_BACK = 1 << 8;
+    private static final int FLAG_KEYGUARD_OCCLUDED = 1 << 6;
+    private static final int FLAG_DISABLE_HOME = 1 << 7;
+    private static final int FLAG_DISABLE_RECENTS = 1 << 8;
+    private static final int FLAG_DISABLE_BACK = 1 << 9;
 
     private static final int MASK_IME_SWITCHER_VISIBLE = FLAG_SWITCHER_SUPPORTED | FLAG_IME_VISIBLE;
 
@@ -188,10 +189,11 @@
         mPropertyHolders.add(new StatePropertyHolder(
                 mBackButton, flags -> (flags & FLAG_IME_VISIBLE) != 0, View.ROTATION,
                 isRtl ? 90 : -90, 0));
-        // Hide when keyguard is showing, show when bouncer is showing
+        // Hide when keyguard is showing, show when bouncer or lock screen app is showing
         mPropertyHolders.add(new StatePropertyHolder(mBackButton,
                 flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 ||
-                        (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0));
+                        (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0 ||
+                        (flags & FLAG_KEYGUARD_OCCLUDED) != 0));
 
         // home and recents buttons
         View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer,
@@ -256,10 +258,12 @@
     }
 
     /**
-     * Slightly misnamed, but should be called when keyguard OR AOD is showing
+     * Slightly misnamed, but should be called when keyguard OR AOD is showing.
+     * We consider keyguardVisible when it's showing bouncer OR is occlucded by another app
      */
-    public void setKeyguardVisible(boolean isKeyguardVisible) {
-        updateStateForFlag(FLAG_KEYGUARD_VISIBLE, isKeyguardVisible);
+    public void setKeyguardVisible(boolean isKeyguardVisible, boolean isKeyguardOccluded) {
+        updateStateForFlag(FLAG_KEYGUARD_VISIBLE, isKeyguardVisible || isKeyguardOccluded);
+        updateStateForFlag(FLAG_KEYGUARD_OCCLUDED, isKeyguardOccluded);
         applyState();
     }
 
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
index 834cd9c..5fc0695 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
@@ -6,6 +6,7 @@
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
 
 import android.app.KeyguardManager;
 import android.content.BroadcastReceiver;
@@ -21,7 +22,7 @@
     private static final int KEYGUARD_SYSUI_FLAGS = SYSUI_STATE_BOUNCER_SHOWING |
             SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING | SYSUI_STATE_DEVICE_DOZING |
             SYSUI_STATE_OVERVIEW_DISABLED | SYSUI_STATE_HOME_DISABLED |
-            SYSUI_STATE_BACK_DISABLED;
+            SYSUI_STATE_BACK_DISABLED | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
 
     private final TaskbarActivityContext mContext;
     private int mKeyguardSysuiFlags;
@@ -51,6 +52,8 @@
         boolean bouncerShowing = (systemUiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0;
         boolean keyguardShowing = (systemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING)
                 != 0;
+        boolean keyguardOccluded =
+                (systemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0;
         boolean dozing = (systemUiStateFlags & SYSUI_STATE_DEVICE_DOZING) != 0;
 
         int interestingKeyguardFlags = systemUiStateFlags & KEYGUARD_SYSUI_FLAGS;
@@ -61,7 +64,8 @@
 
         mBouncerShowing = bouncerShowing;
 
-        mNavbarButtonsViewController.setKeyguardVisible(keyguardShowing || dozing);
+        mNavbarButtonsViewController.setKeyguardVisible(keyguardShowing || dozing,
+                keyguardOccluded);
         updateIconsForBouncer();
     }