From 73b8866cb7c2b1040ff566e87c540b6c1d1b0b77 Mon Sep 17 00:00:00 2001 From: Michal Brzezinski Date: Mon, 16 Jan 2023 15:23:09 +0000 Subject: Ensuring QS can't collapse (hide) in split shade QS would be asked to collapse - so effectively made invisible - in split shade when: - shade is expanded by some 3rd party launchers - `adb shell cmd statusbar expand-notifications` is called when shade is already visible - `adb shell cmd statusbar expand-notifications` is called quickly twice when shade is not visible Now `expandShadeToNotifications` - formerly known as `expandWithoutQs` - will make sure that split shade doesn't react at all to that command when shade is already expanded. Fixes: 263903057 Test: writing unit test is very hard so I'm adding functional test OpenSplitShadeWithAccessibilityCommandTwice Change-Id: I983157bbd0bf7cbe262036cd565d157aec6842ce --- .../systemui/shade/NotificationPanelViewController.java | 14 ++++++++++++-- .../phone/CentralSurfacesCommandQueueCallbacks.java | 2 +- .../statusbar/phone/StatusBarKeyguardViewManager.java | 2 +- .../phone/CentralSurfacesCommandQueueCallbacksTest.java | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index c68e1ad72de6..56412e6c43f4 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -2072,7 +2072,17 @@ public final class NotificationPanelViewController implements Dumpable { } } - public void expandWithoutQs() { + /** + * Expand shade so that notifications are visible. + * Non-split shade: just expanding shade or collapsing QS when they're expanded. + * Split shade: only expanding shade, notifications are always visible + * + * Called when `adb shell cmd statusbar expand-notifications` is executed. + */ + public void expandShadeToNotifications() { + if (mSplitShadeEnabled && (isShadeFullyOpen() || isExpanding())) { + return; + } if (isQsExpanded()) { flingSettings(0 /* velocity */, FLING_COLLAPSE); } else { @@ -5500,7 +5510,7 @@ public final class NotificationPanelViewController implements Dumpable { @Override public void flingTopOverscroll(float velocity, boolean open) { - // in split shade mode we want to expand/collapse QS only when touch happens within QS + // in split shade touches affect QS only when touch happens within QS if (isSplitShadeAndTouchXOutsideQs(mInitialTouchX)) { return; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java index 2dad8e053ee1..34aa47bbdf35 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java @@ -215,7 +215,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba return; } - mNotificationPanelViewController.expandWithoutQs(); + mNotificationPanelViewController.expandShadeToNotifications(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 7d917bd9cd1c..04ce403c1691 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -1111,7 +1111,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (hideImmediately) { mStatusBarStateController.setLeaveOpenOnKeyguardHide(false); } else { - mNotificationPanelViewController.expandWithoutQs(); + mNotificationPanelViewController.expandShadeToNotifications(); } } return; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java index 3fccd37d9d7e..a65b11663e7a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacksTest.java @@ -140,7 +140,7 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { // Trying to open it does nothing. mSbcqCallbacks.animateExpandNotificationsPanel(); - verify(mNotificationPanelViewController, never()).expandWithoutQs(); + verify(mNotificationPanelViewController, never()).expandShadeToNotifications(); mSbcqCallbacks.animateExpandSettingsPanel(null); verify(mNotificationPanelViewController, never()).expand(anyBoolean()); } @@ -158,7 +158,7 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase { // Can now be opened. mSbcqCallbacks.animateExpandNotificationsPanel(); - verify(mNotificationPanelViewController).expandWithoutQs(); + verify(mNotificationPanelViewController).expandShadeToNotifications(); mSbcqCallbacks.animateExpandSettingsPanel(null); verify(mNotificationPanelViewController).expandWithQs(); } -- cgit v1.2.3-59-g8ed1b