Loading packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +63 −18 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ import com.android.internal.policy.ScreenDecorationsUtils; import com.android.internal.policy.SystemBarUtils; import com.android.internal.policy.SystemBarUtils; import com.android.internal.util.LatencyTracker; import com.android.internal.util.LatencyTracker; import com.android.keyguard.ActiveUnlockConfig; import com.android.keyguard.ActiveUnlockConfig; import com.android.keyguard.KeyguardClockSwitch.ClockSize; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardStatusViewController; import com.android.keyguard.KeyguardStatusViewController; import com.android.keyguard.KeyguardUnfoldTransition; import com.android.keyguard.KeyguardUnfoldTransition; Loading Loading @@ -1427,19 +1428,10 @@ public final class NotificationPanelViewController extends PanelViewController { private void updateClockAppearance() { private void updateClockAppearance() { int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard; int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard; boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled(); boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled(); final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMediaOrRecommendation(); boolean splitShadeWithActiveMedia = mSplitShadeEnabled && mMediaDataManager.hasActiveMediaOrRecommendation(); boolean shouldAnimateClockChange = mScreenOffAnimationController.shouldAnimateClockChange(); boolean shouldAnimateClockChange = mScreenOffAnimationController.shouldAnimateClockChange(); if ((hasVisibleNotifications && !mSplitShadeEnabled) mKeyguardStatusViewController.displayClock(computeDesiredClockSize(), || (splitShadeWithActiveMedia && !mDozing)) { shouldAnimateClockChange); mKeyguardStatusViewController.displayClock(SMALL, shouldAnimateClockChange); updateKeyguardStatusViewAlignment(/* animate= */true); } else { mKeyguardStatusViewController.displayClock(LARGE, shouldAnimateClockChange); } updateKeyguardStatusViewAlignment(true /* animate */); int userSwitcherHeight = mKeyguardQsUserSwitchController != null int userSwitcherHeight = mKeyguardQsUserSwitchController != null ? mKeyguardQsUserSwitchController.getUserIconHeight() : 0; ? mKeyguardQsUserSwitchController.getUserIconHeight() : 0; if (mKeyguardUserSwitcherController != null) { if (mKeyguardUserSwitcherController != null) { Loading @@ -1448,7 +1440,7 @@ public final class NotificationPanelViewController extends PanelViewController { float expandedFraction = float expandedFraction = mScreenOffAnimationController.shouldExpandNotifications() mScreenOffAnimationController.shouldExpandNotifications() ? 1.0f : getExpandedFraction(); ? 1.0f : getExpandedFraction(); float darkamount = float darkAmount = mScreenOffAnimationController.shouldExpandNotifications() mScreenOffAnimationController.shouldExpandNotifications() ? 1.0f : mInterpolatedDarkAmount; ? 1.0f : mInterpolatedDarkAmount; Loading @@ -1466,7 +1458,7 @@ public final class NotificationPanelViewController extends PanelViewController { mKeyguardStatusViewController.getLockscreenHeight(), mKeyguardStatusViewController.getLockscreenHeight(), userSwitcherHeight, userSwitcherHeight, userSwitcherPreferredY, userSwitcherPreferredY, darkamount, mOverStretchAmount, darkAmount, mOverStretchAmount, bypassEnabled, getUnlockedStackScrollerPadding(), bypassEnabled, getUnlockedStackScrollerPadding(), computeQsExpansionFraction(), computeQsExpansionFraction(), mDisplayTopInset, mDisplayTopInset, Loading Loading @@ -1498,6 +1490,34 @@ public final class NotificationPanelViewController extends PanelViewController { updateClock(); updateClock(); } } @ClockSize private int computeDesiredClockSize() { if (mSplitShadeEnabled) { return computeDesiredClockSizeForSplitShade(); } return computeDesiredClockSizeForSingleShade(); } @ClockSize private int computeDesiredClockSizeForSingleShade() { if (hasVisibleNotifications()) { return SMALL; } return LARGE; } @ClockSize private int computeDesiredClockSizeForSplitShade() { // Media is not visible to the user on AOD. boolean isMediaVisibleToUser = mMediaDataManager.hasActiveMediaOrRecommendation() && !isOnAod(); if (isMediaVisibleToUser) { // When media is visible, it overlaps with the large clock. Use small clock instead. return SMALL; } return LARGE; } private void updateKeyguardStatusViewAlignment(boolean animate) { private void updateKeyguardStatusViewAlignment(boolean animate) { boolean shouldBeCentered = shouldKeyguardStatusViewBeCentered(); boolean shouldBeCentered = shouldKeyguardStatusViewBeCentered(); if (mStatusViewCentered != shouldBeCentered) { if (mStatusViewCentered != shouldBeCentered) { Loading @@ -1524,12 +1544,35 @@ public final class NotificationPanelViewController extends PanelViewController { } } private boolean shouldKeyguardStatusViewBeCentered() { private boolean shouldKeyguardStatusViewBeCentered() { boolean hasVisibleNotifications = mNotificationStackScrollLayoutController if (mSplitShadeEnabled) { return shouldKeyguardStatusViewBeCenteredInSplitShade(); } return true; } private boolean shouldKeyguardStatusViewBeCenteredInSplitShade() { if (!hasVisibleNotifications()) { // No notifications visible. It is safe to have the clock centered as there will be no // overlap. return true; } if (hasPulsingNotifications()) { // Pulsing notification appears on the right. Move clock left to avoid overlap. return false; } // "Visible" notifications are actually not visible on AOD (unless pulsing), so it is safe // to center the clock without overlap. return isOnAod(); } private boolean isOnAod() { return mDozing && mDozeParameters.getAlwaysOn(); } private boolean hasVisibleNotifications() { return mNotificationStackScrollLayoutController .getVisibleNotificationCount() != 0 .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMediaOrRecommendation(); || mMediaDataManager.hasActiveMediaOrRecommendation(); boolean isOnAod = mDozing && mDozeParameters.getAlwaysOn(); return !mSplitShadeEnabled || !hasVisibleNotifications || isOnAod || hasPulsingNotifications(); } } /** /** Loading Loading @@ -3783,6 +3826,8 @@ public final class NotificationPanelViewController extends PanelViewController { mAnimateNextPositionUpdate = false; mAnimateNextPositionUpdate = false; } } mNotificationStackScrollLayoutController.setPulsing(pulsing, animatePulse); mNotificationStackScrollLayoutController.setPulsing(pulsing, animatePulse); updateKeyguardStatusViewAlignment(/* animate= */ true); } } public void setAmbientIndicationTop(int ambientIndicationTop, boolean ambientTextVisible) { public void setAmbientIndicationTop(int ambientIndicationTop, boolean ambientTextVisible) { Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +36 −15 Original line number Original line Diff line number Diff line Loading @@ -904,7 +904,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ true); assertThat(isKeyguardStatusViewCentered()).isTrue(); assertKeyguardStatusViewCentered(); } } @Test @Test Loading @@ -915,7 +915,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ false); setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test Loading @@ -926,19 +926,19 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test public void keyguardStatusView_splitShade_pulsing_isCentered() { public void keyguardStatusView_splitShade_pulsing_isNotCentered() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); when(mNotificationListContainer.hasPulsingNotifications()).thenReturn(true); when(mNotificationListContainer.hasPulsingNotifications()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); enableSplitShade(/* enabled= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test Loading @@ -948,9 +948,9 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); enableSplitShade(/* enabled= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test Loading @@ -963,7 +963,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewCentered(); } } @Test @Test Loading Loading @@ -1208,16 +1208,31 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { } } @Test @Test public void testSwitchesToBigClockInSplitShadeOnAod() { public void clockSize_mediaShowing_inSplitShade_onAod_isLarge() { when(mDozeParameters.getAlwaysOn()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); clearInvocations(mKeyguardStatusViewController); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(true, false, null); mNotificationPanelViewController.setDozing(/* dozing= */ true, /* animate= */ false, null); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate= */ true); } @Test public void clockSize_mediaShowing_inSplitShade_screenOff_notAod_isSmall() { when(mDozeParameters.getAlwaysOn()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(/* dozing= */ true, /* animate= */ false, null); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate= */ true); } } @Test @Test Loading Loading @@ -1548,9 +1563,15 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { ); ); } } private boolean isKeyguardStatusViewCentered() { private void assertKeyguardStatusViewCentered() { mNotificationPanelViewController.updateResources(); assertThat(getConstraintSetLayout(R.id.keyguard_status_view).endToEnd).isAnyOf( ConstraintSet.PARENT_ID, ConstraintSet.UNSET); } private void assertKeyguardStatusViewNotCentered() { mNotificationPanelViewController.updateResources(); mNotificationPanelViewController.updateResources(); return getConstraintSetLayout(R.id.keyguard_status_view).endToEnd assertThat(getConstraintSetLayout(R.id.keyguard_status_view).endToEnd).isEqualTo( == ConstraintSet.PARENT_ID; R.id.qs_edge_guideline); } } } } Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +63 −18 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ import com.android.internal.policy.ScreenDecorationsUtils; import com.android.internal.policy.SystemBarUtils; import com.android.internal.policy.SystemBarUtils; import com.android.internal.util.LatencyTracker; import com.android.internal.util.LatencyTracker; import com.android.keyguard.ActiveUnlockConfig; import com.android.keyguard.ActiveUnlockConfig; import com.android.keyguard.KeyguardClockSwitch.ClockSize; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardStatusViewController; import com.android.keyguard.KeyguardStatusViewController; import com.android.keyguard.KeyguardUnfoldTransition; import com.android.keyguard.KeyguardUnfoldTransition; Loading Loading @@ -1427,19 +1428,10 @@ public final class NotificationPanelViewController extends PanelViewController { private void updateClockAppearance() { private void updateClockAppearance() { int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard; int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard; boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled(); boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled(); final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMediaOrRecommendation(); boolean splitShadeWithActiveMedia = mSplitShadeEnabled && mMediaDataManager.hasActiveMediaOrRecommendation(); boolean shouldAnimateClockChange = mScreenOffAnimationController.shouldAnimateClockChange(); boolean shouldAnimateClockChange = mScreenOffAnimationController.shouldAnimateClockChange(); if ((hasVisibleNotifications && !mSplitShadeEnabled) mKeyguardStatusViewController.displayClock(computeDesiredClockSize(), || (splitShadeWithActiveMedia && !mDozing)) { shouldAnimateClockChange); mKeyguardStatusViewController.displayClock(SMALL, shouldAnimateClockChange); updateKeyguardStatusViewAlignment(/* animate= */true); } else { mKeyguardStatusViewController.displayClock(LARGE, shouldAnimateClockChange); } updateKeyguardStatusViewAlignment(true /* animate */); int userSwitcherHeight = mKeyguardQsUserSwitchController != null int userSwitcherHeight = mKeyguardQsUserSwitchController != null ? mKeyguardQsUserSwitchController.getUserIconHeight() : 0; ? mKeyguardQsUserSwitchController.getUserIconHeight() : 0; if (mKeyguardUserSwitcherController != null) { if (mKeyguardUserSwitcherController != null) { Loading @@ -1448,7 +1440,7 @@ public final class NotificationPanelViewController extends PanelViewController { float expandedFraction = float expandedFraction = mScreenOffAnimationController.shouldExpandNotifications() mScreenOffAnimationController.shouldExpandNotifications() ? 1.0f : getExpandedFraction(); ? 1.0f : getExpandedFraction(); float darkamount = float darkAmount = mScreenOffAnimationController.shouldExpandNotifications() mScreenOffAnimationController.shouldExpandNotifications() ? 1.0f : mInterpolatedDarkAmount; ? 1.0f : mInterpolatedDarkAmount; Loading @@ -1466,7 +1458,7 @@ public final class NotificationPanelViewController extends PanelViewController { mKeyguardStatusViewController.getLockscreenHeight(), mKeyguardStatusViewController.getLockscreenHeight(), userSwitcherHeight, userSwitcherHeight, userSwitcherPreferredY, userSwitcherPreferredY, darkamount, mOverStretchAmount, darkAmount, mOverStretchAmount, bypassEnabled, getUnlockedStackScrollerPadding(), bypassEnabled, getUnlockedStackScrollerPadding(), computeQsExpansionFraction(), computeQsExpansionFraction(), mDisplayTopInset, mDisplayTopInset, Loading Loading @@ -1498,6 +1490,34 @@ public final class NotificationPanelViewController extends PanelViewController { updateClock(); updateClock(); } } @ClockSize private int computeDesiredClockSize() { if (mSplitShadeEnabled) { return computeDesiredClockSizeForSplitShade(); } return computeDesiredClockSizeForSingleShade(); } @ClockSize private int computeDesiredClockSizeForSingleShade() { if (hasVisibleNotifications()) { return SMALL; } return LARGE; } @ClockSize private int computeDesiredClockSizeForSplitShade() { // Media is not visible to the user on AOD. boolean isMediaVisibleToUser = mMediaDataManager.hasActiveMediaOrRecommendation() && !isOnAod(); if (isMediaVisibleToUser) { // When media is visible, it overlaps with the large clock. Use small clock instead. return SMALL; } return LARGE; } private void updateKeyguardStatusViewAlignment(boolean animate) { private void updateKeyguardStatusViewAlignment(boolean animate) { boolean shouldBeCentered = shouldKeyguardStatusViewBeCentered(); boolean shouldBeCentered = shouldKeyguardStatusViewBeCentered(); if (mStatusViewCentered != shouldBeCentered) { if (mStatusViewCentered != shouldBeCentered) { Loading @@ -1524,12 +1544,35 @@ public final class NotificationPanelViewController extends PanelViewController { } } private boolean shouldKeyguardStatusViewBeCentered() { private boolean shouldKeyguardStatusViewBeCentered() { boolean hasVisibleNotifications = mNotificationStackScrollLayoutController if (mSplitShadeEnabled) { return shouldKeyguardStatusViewBeCenteredInSplitShade(); } return true; } private boolean shouldKeyguardStatusViewBeCenteredInSplitShade() { if (!hasVisibleNotifications()) { // No notifications visible. It is safe to have the clock centered as there will be no // overlap. return true; } if (hasPulsingNotifications()) { // Pulsing notification appears on the right. Move clock left to avoid overlap. return false; } // "Visible" notifications are actually not visible on AOD (unless pulsing), so it is safe // to center the clock without overlap. return isOnAod(); } private boolean isOnAod() { return mDozing && mDozeParameters.getAlwaysOn(); } private boolean hasVisibleNotifications() { return mNotificationStackScrollLayoutController .getVisibleNotificationCount() != 0 .getVisibleNotificationCount() != 0 || mMediaDataManager.hasActiveMediaOrRecommendation(); || mMediaDataManager.hasActiveMediaOrRecommendation(); boolean isOnAod = mDozing && mDozeParameters.getAlwaysOn(); return !mSplitShadeEnabled || !hasVisibleNotifications || isOnAod || hasPulsingNotifications(); } } /** /** Loading Loading @@ -3783,6 +3826,8 @@ public final class NotificationPanelViewController extends PanelViewController { mAnimateNextPositionUpdate = false; mAnimateNextPositionUpdate = false; } } mNotificationStackScrollLayoutController.setPulsing(pulsing, animatePulse); mNotificationStackScrollLayoutController.setPulsing(pulsing, animatePulse); updateKeyguardStatusViewAlignment(/* animate= */ true); } } public void setAmbientIndicationTop(int ambientIndicationTop, boolean ambientTextVisible) { public void setAmbientIndicationTop(int ambientIndicationTop, boolean ambientTextVisible) { Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +36 −15 Original line number Original line Diff line number Diff line Loading @@ -904,7 +904,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ true); assertThat(isKeyguardStatusViewCentered()).isTrue(); assertKeyguardStatusViewCentered(); } } @Test @Test Loading @@ -915,7 +915,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ false); setDozing(/* dozing= */ true, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test Loading @@ -926,19 +926,19 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test public void keyguardStatusView_splitShade_pulsing_isCentered() { public void keyguardStatusView_splitShade_pulsing_isNotCentered() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); when(mNotificationListContainer.hasPulsingNotifications()).thenReturn(true); when(mNotificationListContainer.hasPulsingNotifications()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); enableSplitShade(/* enabled= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test Loading @@ -948,9 +948,9 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); enableSplitShade(/* enabled= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ true); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewNotCentered(); } } @Test @Test Loading @@ -963,7 +963,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); assertThat(isKeyguardStatusViewCentered()).isFalse(); assertKeyguardStatusViewCentered(); } } @Test @Test Loading Loading @@ -1208,16 +1208,31 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { } } @Test @Test public void testSwitchesToBigClockInSplitShadeOnAod() { public void clockSize_mediaShowing_inSplitShade_onAod_isLarge() { when(mDozeParameters.getAlwaysOn()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); clearInvocations(mKeyguardStatusViewController); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(true, false, null); mNotificationPanelViewController.setDozing(/* dozing= */ true, /* animate= */ false, null); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate= */ true); } @Test public void clockSize_mediaShowing_inSplitShade_screenOff_notAod_isSmall() { when(mDozeParameters.getAlwaysOn()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(/* dozing= */ true, /* animate= */ false, null); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate= */ true); } } @Test @Test Loading Loading @@ -1548,9 +1563,15 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { ); ); } } private boolean isKeyguardStatusViewCentered() { private void assertKeyguardStatusViewCentered() { mNotificationPanelViewController.updateResources(); assertThat(getConstraintSetLayout(R.id.keyguard_status_view).endToEnd).isAnyOf( ConstraintSet.PARENT_ID, ConstraintSet.UNSET); } private void assertKeyguardStatusViewNotCentered() { mNotificationPanelViewController.updateResources(); mNotificationPanelViewController.updateResources(); return getConstraintSetLayout(R.id.keyguard_status_view).endToEnd assertThat(getConstraintSetLayout(R.id.keyguard_status_view).endToEnd).isEqualTo( == ConstraintSet.PARENT_ID; R.id.qs_edge_guideline); } } } }