Merge "Centering clock on AOD in split shade mode" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-09-29 15:31:23 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 2 deletions

View File

@@ -1256,8 +1256,10 @@ public class NotificationPanelViewController extends PanelViewController {
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled(); boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
.getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia(); .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia();
boolean splitShadeWithActiveMedia =
mShouldUseSplitNotificationShade && mMediaDataManager.hasActiveMedia();
if ((hasVisibleNotifications && !mShouldUseSplitNotificationShade) if ((hasVisibleNotifications && !mShouldUseSplitNotificationShade)
|| (mShouldUseSplitNotificationShade && mMediaDataManager.hasActiveMedia())) { || (splitShadeWithActiveMedia && !mDozing)) {
mKeyguardStatusViewController.displayClock(SMALL); mKeyguardStatusViewController.displayClock(SMALL);
} else { } else {
mKeyguardStatusViewController.displayClock(LARGE); mKeyguardStatusViewController.displayClock(LARGE);
@@ -1319,7 +1321,8 @@ public class NotificationPanelViewController extends PanelViewController {
private void updateKeyguardStatusViewAlignment(boolean animate) { private void updateKeyguardStatusViewAlignment(boolean animate) {
boolean hasVisibleNotifications = mNotificationStackScrollLayoutController boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
.getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia(); .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMedia();
boolean shouldBeCentered = !mShouldUseSplitNotificationShade || !hasVisibleNotifications; boolean shouldBeCentered =
!mShouldUseSplitNotificationShade || !hasVisibleNotifications || mDozing;
if (mStatusViewCentered != shouldBeCentered) { if (mStatusViewCentered != shouldBeCentered) {
mStatusViewCentered = shouldBeCentered; mStatusViewCentered = shouldBeCentered;
ConstraintSet constraintSet = new ConstraintSet(); ConstraintSet constraintSet = new ConstraintSet();

View File

@@ -777,6 +777,18 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
verify(mKeyguardStatusViewController, never()).displayClock(SMALL); 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 @Test
public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() { public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() {
mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD);