From b85e1abfe186e6299301d8e28ad7a1ef75e762f6 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 25 Apr 2022 16:42:04 +0000 Subject: [PATCH] Hide empty shade view on transition to KG We don't want to show the empty shade view that contains the "No notifications" text in the notification shade when the device is transitioning to the keyguard. Test: manual Fixes: 228790482 Change-Id: Ibb49f2f7e58d8ea6e8d7ab102481bd683eba4077 --- ...tificationStackScrollLayoutController.java | 2 +- ...cationStackScrollLayoutControllerTest.java | 24 ++++++------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index ae1fd2b180e5c..c2750c2d2a6f5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -1207,7 +1207,7 @@ public class NotificationStackScrollLayoutController { */ public void updateShowEmptyShadeView() { Trace.beginSection("NSSLC.updateShowEmptyShadeView"); - mShowEmptyShadeView = mBarState != KEYGUARD + mShowEmptyShadeView = mStatusBarStateController.getCurrentOrUpcomingState() != KEYGUARD && !mView.isQsFullScreen() && getVisibleNotificationCount() == 0; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java index c9de60806b664..6409967aca9b3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java @@ -228,19 +228,15 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { public void testUpdateEmptyShadeView_notificationsVisible_zenHiding() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mController.attach(mNotificationStackScrollLayout); - verify(mSysuiStatusBarStateController).addCallback( - mStateListenerArgumentCaptor.capture(), anyInt()); - StatusBarStateController.StateListener stateListener = - mStateListenerArgumentCaptor.getValue(); - setupShowEmptyShadeViewState(stateListener, true); + setupShowEmptyShadeViewState(true); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( /* visible= */ true, /* notifVisibleInShade= */ true); - setupShowEmptyShadeViewState(stateListener, false); + setupShowEmptyShadeViewState(false); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( @@ -252,19 +248,15 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { public void testUpdateEmptyShadeView_notificationsHidden_zenNotHiding() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mController.attach(mNotificationStackScrollLayout); - verify(mSysuiStatusBarStateController).addCallback( - mStateListenerArgumentCaptor.capture(), anyInt()); - StatusBarStateController.StateListener stateListener = - mStateListenerArgumentCaptor.getValue(); - setupShowEmptyShadeViewState(stateListener, true); + setupShowEmptyShadeViewState(true); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( /* visible= */ true, /* notifVisibleInShade= */ false); - setupShowEmptyShadeViewState(stateListener, false); + setupShowEmptyShadeViewState(false); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( @@ -407,15 +399,13 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase { return argThat(new LogMatcher(category, type)); } - private void setupShowEmptyShadeViewState( - StatusBarStateController.StateListener statusBarStateListener, - boolean toShow) { + private void setupShowEmptyShadeViewState(boolean toShow) { if (toShow) { - statusBarStateListener.onStateChanged(SHADE); + when(mSysuiStatusBarStateController.getCurrentOrUpcomingState()).thenReturn(SHADE); mController.setQsFullScreen(false); mController.getView().removeAllViews(); } else { - statusBarStateListener.onStateChanged(KEYGUARD); + when(mSysuiStatusBarStateController.getCurrentOrUpcomingState()).thenReturn(KEYGUARD); mController.setQsFullScreen(true); mController.getView().addContainerView(mock(ExpandableNotificationRow.class)); }