diff options
| author | 2022-11-22 16:52:23 +0000 | |
|---|---|---|
| committer | 2022-12-03 02:00:35 +0000 | |
| commit | bd8b091df26eae11ae8f7085b5b9e4634cb1f5af (patch) | |
| tree | 2c55fefc4e5091fb161911349f5deab97699a07a | |
| parent | b877a2de53cf50c8324bfbf659a0949c51b011c2 (diff) | |
Initialize Clock Size from NotificationPanelViewController
In change I0885d19e297ff5f881271ed0347e9699b3494928 I defaulted
the small clock to invisible, which likely introduced this bug.
From logs, it looks like an edge where neither clock is never
selected. We correct this by always calling `switchToClock` with
the correct size argument as soon as `KeyguardStatusViewController`
is acquired by `NotificationPanelViewController`
Fixes: 256809954
Test: Manully tested on a couple devices
Change-Id: I9143d6162411065ed2ed80cfa84d73e222c1f231
3 files changed, 14 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index f52ace7138f2..93243cf7f363 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -916,6 +916,7 @@ public final class NotificationPanelViewController implements Dumpable { mQsFrameTranslateController = qsFrameTranslateController; updateUserSwitcherFlags(); mKeyguardBottomAreaViewModel = keyguardBottomAreaViewModel; + mKeyguardBottomAreaInteractor = keyguardBottomAreaInteractor; onFinishInflate(); keyguardUnlockAnimationController.addKeyguardUnlockAnimationListener( new KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener() { @@ -933,7 +934,6 @@ public final class NotificationPanelViewController implements Dumpable { unlockAnimationStarted(playingCannedAnimation, isWakeAndUnlock, startDelay); } }); - mKeyguardBottomAreaInteractor = keyguardBottomAreaInteractor; dumpManager.registerDumpable(this); } @@ -1109,6 +1109,7 @@ public final class NotificationPanelViewController implements Dumpable { mKeyguardStatusViewComponentFactory.build(keyguardStatusView); mKeyguardStatusViewController = statusViewComponent.getKeyguardStatusViewController(); mKeyguardStatusViewController.init(); + updateClockAppearance(); if (mKeyguardUserSwitcherController != null) { // Try to close the switcher so that callbacks are triggered if necessary. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index ad4501a75ebb..850413618dea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -975,7 +975,7 @@ public class NotificationStackScrollLayoutController { } public boolean isAddOrRemoveAnimationPending() { - return mView.isAddOrRemoveAnimationPending(); + return mView != null && mView.isAddOrRemoveAnimationPending(); } public int getVisibleNotificationCount() { @@ -1132,7 +1132,9 @@ public class NotificationStackScrollLayoutController { } public void setAlpha(float alpha) { - mView.setAlpha(alpha); + if (mView != null) { + mView.setAlpha(alpha); + } } public float calculateAppearFraction(float height) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java index b6f74f0a13ba..2e5d0dc69909 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java @@ -43,6 +43,7 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -530,6 +531,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { .setHeadsUpAppearanceController(mock(HeadsUpAppearanceController.class)); verify(mNotificationStackScrollLayoutController) .setOnEmptySpaceClickListener(mEmptySpaceClickListenerCaptor.capture()); + verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); + reset(mKeyguardStatusViewController); } @After @@ -609,7 +612,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { @Test public void getVerticalSpaceForLockscreenNotifications_useLockIconBottomPadding_returnsSpaceAvailable() { - setBottomPadding(/* stackScrollLayoutBottom= */ 100, + setBottomPadding(/* stackScrollLayoutBottom= */ 180, /* lockIconPadding= */ 20, /* indicationPadding= */ 0, /* ambientPadding= */ 0); @@ -620,7 +623,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { @Test public void getVerticalSpaceForLockscreenNotifications_useIndicationBottomPadding_returnsSpaceAvailable() { - setBottomPadding(/* stackScrollLayoutBottom= */ 100, + setBottomPadding(/* stackScrollLayoutBottom= */ 180, /* lockIconPadding= */ 0, /* indicationPadding= */ 30, /* ambientPadding= */ 0); @@ -631,7 +634,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { @Test public void getVerticalSpaceForLockscreenNotifications_useAmbientBottomPadding_returnsSpaceAvailable() { - setBottomPadding(/* stackScrollLayoutBottom= */ 100, + setBottomPadding(/* stackScrollLayoutBottom= */ 180, /* lockIconPadding= */ 0, /* indicationPadding= */ 0, /* ambientPadding= */ 40); @@ -1014,7 +1017,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { } @Test - public void testFinishInflate_userSwitcherDisabled_doNotInflateUserSwitchView() { + public void testFinishInflate_userSwitcherDisabled_doNotInflateUserSwitchView_initClock() { givenViewAttached(); when(mResources.getBoolean( com.android.internal.R.bool.config_keyguardUserSwitcher)).thenReturn(true); @@ -1025,6 +1028,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mNotificationPanelViewController.onFinishInflate(); verify(mUserSwitcherStubView, never()).inflate(); + verify(mKeyguardStatusViewController, times(3)).displayClock(LARGE, /* animate */ true); } @Test |