Merge "Hide empty shade view on transition to KG" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-27 21:04:01 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 18 deletions

View File

@@ -1207,7 +1207,7 @@ public class NotificationStackScrollLayoutController {
*/ */
public void updateShowEmptyShadeView() { public void updateShowEmptyShadeView() {
Trace.beginSection("NSSLC.updateShowEmptyShadeView"); Trace.beginSection("NSSLC.updateShowEmptyShadeView");
mShowEmptyShadeView = mBarState != KEYGUARD mShowEmptyShadeView = mStatusBarStateController.getCurrentOrUpcomingState() != KEYGUARD
&& !mView.isQsFullScreen() && !mView.isQsFullScreen()
&& getVisibleNotificationCount() == 0; && getVisibleNotificationCount() == 0;

View File

@@ -228,19 +228,15 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
public void testUpdateEmptyShadeView_notificationsVisible_zenHiding() { public void testUpdateEmptyShadeView_notificationsVisible_zenHiding() {
when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true);
mController.attach(mNotificationStackScrollLayout); mController.attach(mNotificationStackScrollLayout);
verify(mSysuiStatusBarStateController).addCallback(
mStateListenerArgumentCaptor.capture(), anyInt());
StatusBarStateController.StateListener stateListener =
mStateListenerArgumentCaptor.getValue();
setupShowEmptyShadeViewState(stateListener, true); setupShowEmptyShadeViewState(true);
reset(mNotificationStackScrollLayout); reset(mNotificationStackScrollLayout);
mController.updateShowEmptyShadeView(); mController.updateShowEmptyShadeView();
verify(mNotificationStackScrollLayout).updateEmptyShadeView( verify(mNotificationStackScrollLayout).updateEmptyShadeView(
/* visible= */ true, /* visible= */ true,
/* notifVisibleInShade= */ true); /* notifVisibleInShade= */ true);
setupShowEmptyShadeViewState(stateListener, false); setupShowEmptyShadeViewState(false);
reset(mNotificationStackScrollLayout); reset(mNotificationStackScrollLayout);
mController.updateShowEmptyShadeView(); mController.updateShowEmptyShadeView();
verify(mNotificationStackScrollLayout).updateEmptyShadeView( verify(mNotificationStackScrollLayout).updateEmptyShadeView(
@@ -252,19 +248,15 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
public void testUpdateEmptyShadeView_notificationsHidden_zenNotHiding() { public void testUpdateEmptyShadeView_notificationsHidden_zenNotHiding() {
when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
mController.attach(mNotificationStackScrollLayout); mController.attach(mNotificationStackScrollLayout);
verify(mSysuiStatusBarStateController).addCallback(
mStateListenerArgumentCaptor.capture(), anyInt());
StatusBarStateController.StateListener stateListener =
mStateListenerArgumentCaptor.getValue();
setupShowEmptyShadeViewState(stateListener, true); setupShowEmptyShadeViewState(true);
reset(mNotificationStackScrollLayout); reset(mNotificationStackScrollLayout);
mController.updateShowEmptyShadeView(); mController.updateShowEmptyShadeView();
verify(mNotificationStackScrollLayout).updateEmptyShadeView( verify(mNotificationStackScrollLayout).updateEmptyShadeView(
/* visible= */ true, /* visible= */ true,
/* notifVisibleInShade= */ false); /* notifVisibleInShade= */ false);
setupShowEmptyShadeViewState(stateListener, false); setupShowEmptyShadeViewState(false);
reset(mNotificationStackScrollLayout); reset(mNotificationStackScrollLayout);
mController.updateShowEmptyShadeView(); mController.updateShowEmptyShadeView();
verify(mNotificationStackScrollLayout).updateEmptyShadeView( verify(mNotificationStackScrollLayout).updateEmptyShadeView(
@@ -407,15 +399,13 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
return argThat(new LogMatcher(category, type)); return argThat(new LogMatcher(category, type));
} }
private void setupShowEmptyShadeViewState( private void setupShowEmptyShadeViewState(boolean toShow) {
StatusBarStateController.StateListener statusBarStateListener,
boolean toShow) {
if (toShow) { if (toShow) {
statusBarStateListener.onStateChanged(SHADE); when(mSysuiStatusBarStateController.getCurrentOrUpcomingState()).thenReturn(SHADE);
mController.setQsFullScreen(false); mController.setQsFullScreen(false);
mController.getView().removeAllViews(); mController.getView().removeAllViews();
} else { } else {
statusBarStateListener.onStateChanged(KEYGUARD); when(mSysuiStatusBarStateController.getCurrentOrUpcomingState()).thenReturn(KEYGUARD);
mController.setQsFullScreen(true); mController.setQsFullScreen(true);
mController.getView().addContainerView(mock(ExpandableNotificationRow.class)); mController.getView().addContainerView(mock(ExpandableNotificationRow.class));
} }