Fix back gesture showing up on hub on lock screen
The notification shade is always considered expanded and visible while
on the lock screen, causing the back gesture to show up on the hub.
This CL adjusts the criteria to look for quick settings being expanded,
which is always true on tablet when the shade is opened in landscape.
This does mean that back gesture will not work when opening the shade
over the hub in portrait mode, filed 370108274 to track.
Bug: 370108262
Fixed: 370108262
Test: atest QuickStepContractTest
also manually verified on device
Flag: com.android.systemui.communal_hub
Change-Id: I5762166e51b49e8233f6e9cc7f085bdf732d1d9e
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
index 78cd02f..ab61190 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java
@@ -347,7 +347,12 @@
}
// Disable back gesture on the hub, but not when the shade is showing.
if ((sysuiStateFlags & SYSUI_STATE_COMMUNAL_HUB_SHOWING) != 0) {
- return (sysuiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE) == 0;
+ // Use QS expanded signal as the notification panel is always considered visible
+ // expanded when on the lock screen and when opening hub over lock screen. This does
+ // mean that back gesture is disabled when opening shade over hub while in portrait
+ // mode, since QS is not expanded.
+ // TODO(b/370108274): allow back gesture on shade over hub in portrait
+ return (sysuiStateFlags & SYSUI_STATE_QUICK_SETTINGS_EXPANDED) == 0;
}
if ((sysuiStateFlags & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) != 0) {
sysuiStateFlags &= ~SYSUI_STATE_NAV_BAR_HIDDEN;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/system/QuickStepContractTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/system/QuickStepContractTest.kt
index 6254fb1..ef03fab 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shared/system/QuickStepContractTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shared/system/QuickStepContractTest.kt
@@ -21,7 +21,7 @@
import com.android.systemui.SysuiTestCase
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_COMMUNAL_HUB_SHOWING
-import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE
+import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED
import com.google.common.truth.Truth.assertThat
import kotlin.test.Test
import org.junit.runner.RunWith
@@ -41,9 +41,9 @@
}
@Test
- fun isBackGestureDisabled_hubAndShadeShowing() {
+ fun isBackGestureDisabled_hubAndQSExpanded() {
val sysuiStateFlags =
- SYSUI_STATE_COMMUNAL_HUB_SHOWING and SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE
+ SYSUI_STATE_COMMUNAL_HUB_SHOWING and SYSUI_STATE_QUICK_SETTINGS_EXPANDED
// Gestures are enabled because the shade shows over the hub.
assertThat(