From 94a8f252c5c53f89271227eee45731de87986a03 Mon Sep 17 00:00:00 2001 From: Michal Brzezinski Date: Tue, 28 Sep 2021 18:45:08 +0100 Subject: [PATCH] Centering clock on AOD in split shade mode Fixes: 201419264 Test: NotificationPanelViewControllerTest Change-Id: If0742883b429b4537eb4033fce06c64a32de20a8 Merged-In: If0742883b429b4537eb4033fce06c64a32de20a8 --- .../phone/NotificationPanelViewController.java | 7 +++++-- .../phone/NotificationPanelViewControllerTest.java | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) 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 9018cef72f7d5..653c146b14a67 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -1256,8 +1256,10 @@ public class NotificationPanelViewController extends PanelViewController { boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled(); final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia(); + boolean splitShadeWithActiveMedia = + mShouldUseSplitNotificationShade && mMediaDataManager.hasActiveMedia(); if ((hasVisibleNotifications && !mShouldUseSplitNotificationShade) - || (mShouldUseSplitNotificationShade && mMediaDataManager.hasActiveMedia())) { + || (splitShadeWithActiveMedia && !mDozing)) { mKeyguardStatusViewController.displayClock(SMALL); } else { mKeyguardStatusViewController.displayClock(LARGE); @@ -1319,7 +1321,8 @@ public class NotificationPanelViewController extends PanelViewController { private void updateKeyguardStatusViewAlignment(boolean animate) { boolean hasVisibleNotifications = mNotificationStackScrollLayoutController .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia(); - boolean shouldBeCentered = !mShouldUseSplitNotificationShade || !hasVisibleNotifications; + boolean shouldBeCentered = + !mShouldUseSplitNotificationShade || !hasVisibleNotifications || mDozing; if (mStatusViewCentered != shouldBeCentered) { mStatusViewCentered = shouldBeCentered; ConstraintSet constraintSet = new ConstraintSet(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java index 33928ea783682..f5fb98b4c2c79 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java @@ -777,6 +777,18 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { verify(mKeyguardStatusViewController, never()).displayClock(SMALL); } + @Test + public void testSwitchesToBigClockInSplitShadeOnAod() { + mStatusBarStateController.setState(KEYGUARD); + enableSplitShade(/* enabled= */ true); + when(mMediaDataManager.hasActiveMedia()).thenReturn(true); + when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + + mNotificationPanelViewController.setDozing(true, false, null); + + verify(mKeyguardStatusViewController).displayClock(LARGE); + } + @Test public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() { mStatusBarStateController.setState(KEYGUARD);