Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49d4c0aa authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Hide empty shade view on transition to KG" into tm-dev am: 18c2cb18...

Merge "Hide empty shade view on transition to KG" into tm-dev am: 18c2cb18 am: 610c33f3 am: 8a360513

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17937881



Change-Id: I90172e8f91df4b4dcbcfd1b54eb41a50209e2662
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 049c64f5 8a360513
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;

+7 −17
Original line number Diff line number Diff line
@@ -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));
        }