From 009bdec30a9b0e1a5d0b5be11675bb6f15e8a340 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Thu, 14 Apr 2022 16:34:54 -0400 Subject: [PATCH] Do not run hint animation during aod=>ls transition Also add additional tests for when hint animation should run. Fixes: 228420035 Test: NotificationPanelViewControllerTest Test: tap empty space on lockscreen during aod=ls transition => notification unfurl completes with no hint animation tap again after unfurl has completed => hint animation runs fine Change-Id: I1e34d17f692a88b708b0233f02229acbb5270fae --- .../NotificationPanelViewController.java | 2 +- .../NotificationPanelViewControllerTest.java | 25 +++++++++++++++++++ 2 files changed, 26 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 cb2d5b265f8c4..1768477ec8dbc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -3207,7 +3207,7 @@ public class NotificationPanelViewController extends PanelViewController { @Override protected void startUnlockHintAnimation() { - if (mPowerManager.isPowerSaveMode()) { + if (mPowerManager.isPowerSaveMode() || mAmbientState.getDozeAmount() > 0f) { onUnlockHintStarted(); onUnlockHintFinished(); return; 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 09773d31de411..05fb1f5959eab 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 @@ -80,6 +80,7 @@ import com.android.keyguard.dagger.KeyguardQsUserSwitchComponent; import com.android.keyguard.dagger.KeyguardStatusBarViewComponent; import com.android.keyguard.dagger.KeyguardStatusViewComponent; import com.android.keyguard.dagger.KeyguardUserSwitcherComponent; +import com.android.systemui.DejankUtils; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.biometrics.AuthController; @@ -352,6 +353,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { mKeyguardStatusView = new KeyguardStatusView(mContext); mKeyguardStatusView.setId(R.id.keyguard_status_view); + DejankUtils.setImmediate(true); when(mAuthController.isUdfpsEnrolled(anyInt())).thenReturn(false); when(mHeadsUpCallback.getContext()).thenReturn(mContext); @@ -941,6 +943,29 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { verify(mScrimController).setExpansionAffectsAlpha(true); } + @Test + public void testUnlockHintAnimation_runs_whenNotInPowerSaveMode_andDozeAmountIsZero() { + when(mPowerManager.isPowerSaveMode()).thenReturn(false); + when(mAmbientState.getDozeAmount()).thenReturn(0f); + mNotificationPanelViewController.startUnlockHintAnimation(); + assertThat(mNotificationPanelViewController.mHintAnimationRunning).isTrue(); + } + + @Test + public void testUnlockHintAnimation_doesNotRun_inPowerSaveMode() { + when(mPowerManager.isPowerSaveMode()).thenReturn(true); + mNotificationPanelViewController.startUnlockHintAnimation(); + assertThat(mNotificationPanelViewController.mHintAnimationRunning).isFalse(); + } + + @Test + public void testUnlockHintAnimation_doesNotRun_whenDozeAmountNotZero() { + when(mPowerManager.isPowerSaveMode()).thenReturn(false); + when(mAmbientState.getDozeAmount()).thenReturn(0.5f); + mNotificationPanelViewController.startUnlockHintAnimation(); + assertThat(mNotificationPanelViewController.mHintAnimationRunning).isFalse(); + } + @Test public void setKeyguardStatusBarAlpha_setsAlphaOnKeyguardStatusBarController() { float statusBarAlpha = 0.5f;