Merge "Showing small lockscreen clock when media player visible in split shade" into sc-v2-dev

This commit is contained in:
Michał Brzeziński
2021-07-20 10:11:12 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 1 deletions

View File

@@ -1315,7 +1315,8 @@ public class NotificationPanelViewController extends PanelViewController {
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
.getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia();
if (hasVisibleNotifications && !mShouldUseSplitNotificationShade) {
if ((hasVisibleNotifications && !mShouldUseSplitNotificationShade)
|| (mShouldUseSplitNotificationShade && mMediaDataManager.hasActiveMedia())) {
mKeyguardStatusViewController.displayClock(SMALL);
} else {
mKeyguardStatusViewController.displayClock(LARGE);

View File

@@ -785,6 +785,24 @@ public class NotificationPanelViewTest extends SysuiTestCase {
verify(mKeyguardStatusViewController, never()).displayClock(SMALL);
}
@Test
public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() {
mStatusBarStateController.setState(KEYGUARD);
enableSplitShade();
when(mMediaDataManager.hasActiveMedia()).thenReturn(true);
// one notification + media player visible
when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1);
triggerPositionClockAndNotifications();
verify(mKeyguardStatusViewController).displayClock(SMALL);
// only media player visible
when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0);
triggerPositionClockAndNotifications();
verify(mKeyguardStatusViewController, times(2)).displayClock(SMALL);
verify(mKeyguardStatusViewController, never()).displayClock(LARGE);
}
private void triggerPositionClockAndNotifications() {
mNotificationPanelViewController.closeQs();
}