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

Commit 514f0a0b authored by Thales Lima's avatar Thales Lima Committed by Automerger Merge Worker
Browse files

Merge "sysui: show empty view in split mode" into sc-v2-dev am: 97c2b5d2

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

Change-Id: If4fe14c6bbc6262e3e3f1e7cca203b1eef642553
parents ed36d1b2 97c2b5d2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5256,6 +5256,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        mSwipeHelper.resetExposedMenuView(animate, force);
    }

    boolean isUsingSplitNotificationShade() {
        return mShouldUseSplitNotificationShade;
    }

    static boolean matchesSelection(
            ExpandableNotificationRow row,
            @SelectedRows int selection) {
+6 −1
Original line number Diff line number Diff line
@@ -1099,11 +1099,16 @@ public class NotificationStackScrollLayoutController {
    /**
     * Update whether we should show the empty shade view (no notifications in the shade).
     * If so, send the update to our view.
     *
     * When in split mode, notifications are always visible regardless of the state of the
     * QuickSettings panel. That being the case, empty view is always shown if the other conditions
     * are true.
     */
    public void updateShowEmptyShadeView() {
        mShowEmptyShadeView = mBarState != KEYGUARD
                && !mView.isQsExpanded()
                && (!mView.isQsExpanded() || mView.isUsingSplitNotificationShade())
                && mView.getVisibleNotificationCount() == 0;

        mView.updateEmptyShadeView(
                mShowEmptyShadeView,
                mZenModeController.areNotificationsHiddenInShade());
+36 −10
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ import org.mockito.MockitoAnnotations;
 */
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class NotificationStackScrollerControllerTest extends SysuiTestCase {
public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {

    @Mock private NotificationGutsManager mNotificationGutsManager;
    @Mock private HeadsUpManagerPhone mHeadsUpManager;
@@ -232,16 +232,15 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                true /* visible */,

                true /* notifVisibleInShade */);
                /* visible= */ true,
                /* notifVisibleInShade= */ true);

        setupShowEmptyShadeViewState(stateListener, false);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                false /* visible */,
                true /* notifVisibleInShade */);
                /* visible= */ false,
                /* notifVisibleInShade= */ true);
    }

    @Test
@@ -257,15 +256,42 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                true /* visible */,
                false /* notifVisibleInShade */);
                /* visible= */ true,
                /* notifVisibleInShade= */ false);

        setupShowEmptyShadeViewState(stateListener, false);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                false /* visible */,
                false /* notifVisibleInShade */);
                /* visible= */ false,
                /* notifVisibleInShade= */ false);
    }

    @Test
    public void testUpdateEmptyShadeView_splitShadeMode_alwaysShowEmptyView() {
        when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
        mController.attach(mNotificationStackScrollLayout);
        verify(mSysuiStatusBarStateController).addCallback(
                mStateListenerArgumentCaptor.capture(), anyInt());
        StatusBarStateController.StateListener stateListener =
                mStateListenerArgumentCaptor.getValue();
        when(mNotificationStackScrollLayout.isUsingSplitNotificationShade()).thenReturn(true);
        stateListener.onStateChanged(SHADE);
        mController.getView().removeAllViews();

        mController.setQsExpanded(false);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                /* visible= */ true,
                /* notifVisibleInShade= */ false);

        mController.setQsExpanded(true);
        reset(mNotificationStackScrollLayout);
        mController.updateShowEmptyShadeView();
        verify(mNotificationStackScrollLayout).updateEmptyShadeView(
                /* visible= */ true,
                /* notifVisibleInShade= */ false);
    }

    @Test