Merge "sysui: show empty view in split mode" into sc-v2-dev
This commit is contained in:
@@ -5256,6 +5256,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
mSwipeHelper.resetExposedMenuView(animate, force);
|
mSwipeHelper.resetExposedMenuView(animate, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isUsingSplitNotificationShade() {
|
||||||
|
return mShouldUseSplitNotificationShade;
|
||||||
|
}
|
||||||
|
|
||||||
static boolean matchesSelection(
|
static boolean matchesSelection(
|
||||||
ExpandableNotificationRow row,
|
ExpandableNotificationRow row,
|
||||||
@SelectedRows int selection) {
|
@SelectedRows int selection) {
|
||||||
|
|||||||
@@ -1099,11 +1099,16 @@ public class NotificationStackScrollLayoutController {
|
|||||||
/**
|
/**
|
||||||
* Update whether we should show the empty shade view (no notifications in the shade).
|
* Update whether we should show the empty shade view (no notifications in the shade).
|
||||||
* If so, send the update to our view.
|
* 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() {
|
public void updateShowEmptyShadeView() {
|
||||||
mShowEmptyShadeView = mBarState != KEYGUARD
|
mShowEmptyShadeView = mBarState != KEYGUARD
|
||||||
&& !mView.isQsExpanded()
|
&& (!mView.isQsExpanded() || mView.isUsingSplitNotificationShade())
|
||||||
&& mView.getVisibleNotificationCount() == 0;
|
&& mView.getVisibleNotificationCount() == 0;
|
||||||
|
|
||||||
mView.updateEmptyShadeView(
|
mView.updateEmptyShadeView(
|
||||||
mShowEmptyShadeView,
|
mShowEmptyShadeView,
|
||||||
mZenModeController.areNotificationsHiddenInShade());
|
mZenModeController.areNotificationsHiddenInShade());
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ import org.mockito.MockitoAnnotations;
|
|||||||
*/
|
*/
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
public class NotificationStackScrollerControllerTest extends SysuiTestCase {
|
public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
|
||||||
|
|
||||||
@Mock private NotificationGutsManager mNotificationGutsManager;
|
@Mock private NotificationGutsManager mNotificationGutsManager;
|
||||||
@Mock private HeadsUpManagerPhone mHeadsUpManager;
|
@Mock private HeadsUpManagerPhone mHeadsUpManager;
|
||||||
@@ -232,16 +232,15 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
|
|||||||
reset(mNotificationStackScrollLayout);
|
reset(mNotificationStackScrollLayout);
|
||||||
mController.updateShowEmptyShadeView();
|
mController.updateShowEmptyShadeView();
|
||||||
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
||||||
true /* visible */,
|
/* visible= */ true,
|
||||||
|
/* notifVisibleInShade= */ true);
|
||||||
true /* notifVisibleInShade */);
|
|
||||||
|
|
||||||
setupShowEmptyShadeViewState(stateListener, false);
|
setupShowEmptyShadeViewState(stateListener, false);
|
||||||
reset(mNotificationStackScrollLayout);
|
reset(mNotificationStackScrollLayout);
|
||||||
mController.updateShowEmptyShadeView();
|
mController.updateShowEmptyShadeView();
|
||||||
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
||||||
false /* visible */,
|
/* visible= */ false,
|
||||||
true /* notifVisibleInShade */);
|
/* notifVisibleInShade= */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -257,15 +256,42 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
|
|||||||
reset(mNotificationStackScrollLayout);
|
reset(mNotificationStackScrollLayout);
|
||||||
mController.updateShowEmptyShadeView();
|
mController.updateShowEmptyShadeView();
|
||||||
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
||||||
true /* visible */,
|
/* visible= */ true,
|
||||||
false /* notifVisibleInShade */);
|
/* notifVisibleInShade= */ false);
|
||||||
|
|
||||||
setupShowEmptyShadeViewState(stateListener, false);
|
setupShowEmptyShadeViewState(stateListener, false);
|
||||||
reset(mNotificationStackScrollLayout);
|
reset(mNotificationStackScrollLayout);
|
||||||
mController.updateShowEmptyShadeView();
|
mController.updateShowEmptyShadeView();
|
||||||
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
|
||||||
false /* visible */,
|
/* visible= */ false,
|
||||||
false /* notifVisibleInShade */);
|
/* 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
|
@Test
|
||||||
Reference in New Issue
Block a user