From e79a41ac50cd7c9e7699025f7092269319859f08 Mon Sep 17 00:00:00 2001 From: Michal Brzezinski Date: Mon, 19 Jul 2021 16:06:47 +0100 Subject: [PATCH] Showing small lockscreen clock when media player visible in split shade When media player is visible in split shade, lock screen should always show small clock regardless of the number of notifications Fixes: 193653855 Test: NotificationPanelViewTest Change-Id: I77db4fbac0005beac1576b1c2e305082f724c811 --- .../phone/NotificationPanelViewController.java | 3 ++- .../phone/NotificationPanelViewTest.java | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 4752d5cb53aaf..d857da1c27b49 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -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); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index a1e2cfcdfd97c..16d21793fa9ab 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -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(); }