Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +10 −1 Original line number Diff line number Diff line Loading @@ -1141,8 +1141,13 @@ public class NotificationPanelViewController extends PanelViewController R.dimen.split_shade_notifications_scrim_margin_bottom); int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width); int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width); mShouldUseSplitNotificationShade = final boolean newShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mResources); final boolean splitNotificationShadeChanged = mShouldUseSplitNotificationShade != newShouldUseSplitNotificationShade; mShouldUseSplitNotificationShade = newShouldUseSplitNotificationShade; if (mQs != null) { mQs.setInSplitShade(mShouldUseSplitNotificationShade); } Loading Loading @@ -1188,6 +1193,10 @@ public class NotificationPanelViewController extends PanelViewController updateKeyguardStatusViewAlignment(/* animate= */false); mKeyguardMediaController.refreshMediaPosition(); if (splitNotificationShadeChanged) { updateClockAppearance(); } } private static void ensureAllViewsHaveIds(ViewGroup parentView) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java +48 −0 Original line number Diff line number Diff line Loading @@ -904,6 +904,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { public void testSwitchesToCorrectClockInSplitShade() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); triggerPositionClockAndNotifications(); Loading @@ -917,12 +918,57 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { .displayClock(SMALL, /* animate */ true); } @Test public void testHasNotifications_switchesToLargeClockWhenEnteringSplitShade() { mStatusBarStateController.setState(KEYGUARD); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); enableSplitShade(/* enabled= */ true); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); } @Test public void testNoNotifications_switchesToLargeClockWhenEnteringSplitShade() { mStatusBarStateController.setState(KEYGUARD); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); enableSplitShade(/* enabled= */ true); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); } @Test public void testHasNotifications_switchesToSmallClockWhenExitingSplitShade() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); enableSplitShade(/* enabled= */ false); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate */ true); } @Test public void testNoNotifications_switchesToLargeClockWhenExitingSplitShade() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); enableSplitShade(/* enabled= */ false); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); } @Test public void testSwitchesToBigClockInSplitShadeOnAod() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMedia()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(true, false, null); Loading @@ -934,6 +980,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { when(mScreenOffAnimationController.shouldAnimateClockChange()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mMediaDataManager.hasActiveMedia()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); Loading @@ -946,6 +993,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mMediaDataManager.hasActiveMedia()).thenReturn(true); // one notification + media player visible Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +10 −1 Original line number Diff line number Diff line Loading @@ -1141,8 +1141,13 @@ public class NotificationPanelViewController extends PanelViewController R.dimen.split_shade_notifications_scrim_margin_bottom); int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width); int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width); mShouldUseSplitNotificationShade = final boolean newShouldUseSplitNotificationShade = Utils.shouldUseSplitNotificationShade(mResources); final boolean splitNotificationShadeChanged = mShouldUseSplitNotificationShade != newShouldUseSplitNotificationShade; mShouldUseSplitNotificationShade = newShouldUseSplitNotificationShade; if (mQs != null) { mQs.setInSplitShade(mShouldUseSplitNotificationShade); } Loading Loading @@ -1188,6 +1193,10 @@ public class NotificationPanelViewController extends PanelViewController updateKeyguardStatusViewAlignment(/* animate= */false); mKeyguardMediaController.refreshMediaPosition(); if (splitNotificationShadeChanged) { updateClockAppearance(); } } private static void ensureAllViewsHaveIds(ViewGroup parentView) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java +48 −0 Original line number Diff line number Diff line Loading @@ -904,6 +904,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { public void testSwitchesToCorrectClockInSplitShade() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); triggerPositionClockAndNotifications(); Loading @@ -917,12 +918,57 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { .displayClock(SMALL, /* animate */ true); } @Test public void testHasNotifications_switchesToLargeClockWhenEnteringSplitShade() { mStatusBarStateController.setState(KEYGUARD); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); enableSplitShade(/* enabled= */ true); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); } @Test public void testNoNotifications_switchesToLargeClockWhenEnteringSplitShade() { mStatusBarStateController.setState(KEYGUARD); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); enableSplitShade(/* enabled= */ true); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); } @Test public void testHasNotifications_switchesToSmallClockWhenExitingSplitShade() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); enableSplitShade(/* enabled= */ false); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate */ true); } @Test public void testNoNotifications_switchesToLargeClockWhenExitingSplitShade() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); enableSplitShade(/* enabled= */ false); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); } @Test public void testSwitchesToBigClockInSplitShadeOnAod() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMedia()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(true, false, null); Loading @@ -934,6 +980,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { when(mScreenOffAnimationController.shouldAnimateClockChange()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mMediaDataManager.hasActiveMedia()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); Loading @@ -946,6 +993,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() { mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mMediaDataManager.hasActiveMedia()).thenReturn(true); // one notification + media player visible Loading