From 7966a3ca480b3ca911e00cc5137b6887a99b729d Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 6 Apr 2021 17:44:55 -0700 Subject: [PATCH] Zoom out the wallpaper as we pull QS Test: visual Test: NotificationShadeDepthControllerTest Fixes: 180971620 Change-Id: I60cd3d075ebfb8c54c0e9847f05ebde7e53068c5 --- .../statusbar/NotificationShadeDepthController.kt | 10 +++++++++- .../phone/NotificationPanelViewController.java | 5 +++++ .../statusbar/NotificationShadeDepthControllerTest.kt | 7 +++++++ .../statusbar/phone/NotificationPanelViewTest.java | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt index e27c1a21b8cbe..ac9f70a4dfe93 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt @@ -107,6 +107,13 @@ class NotificationShadeDepthController @Inject constructor( else 0) } + var qsPanelExpansion = 0f + set(value) { + if (field == value) return + field = value + scheduleUpdate() + } + /** * When launching an app from the shade, the animations progress should affect how blurry the * shade is, overriding the expansion amount. @@ -158,8 +165,9 @@ class NotificationShadeDepthController @Inject constructor( updateScheduled = false val normalizedBlurRadius = MathUtils.constrain(shadeAnimation.radius, blurUtils.minBlurRadius, blurUtils.maxBlurRadius) - val combinedBlur = (shadeSpring.radius * INTERACTION_BLUR_FRACTION + + var combinedBlur = (shadeSpring.radius * INTERACTION_BLUR_FRACTION + normalizedBlurRadius * ANIMATION_BLUR_FRACTION).toInt() + combinedBlur = max(combinedBlur, blurUtils.blurRadiusOfRatio(qsPanelExpansion)) var shadeRadius = max(combinedBlur, wakeAndUnlockBlurRadius).toFloat() shadeRadius *= 1f - brightnessMirrorSpring.ratio val launchProgress = notificationLaunchAnimationParams?.linearProgress ?: 0f 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 555df5c37ee31..6386a1b6b8ae3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -111,6 +111,7 @@ import com.android.systemui.statusbar.GestureRecorder; import com.android.systemui.statusbar.KeyguardAffordanceView; import com.android.systemui.statusbar.KeyguardIndicationController; import com.android.systemui.statusbar.NotificationLockscreenUserManager; +import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShelfController; import com.android.systemui.statusbar.PulseExpansionHandler; import com.android.systemui.statusbar.RemoteInputController; @@ -477,6 +478,7 @@ public class NotificationPanelViewController extends PanelViewController { private final UserManager mUserManager; private final ShadeController mShadeController; private final MediaDataManager mMediaDataManager; + private NotificationShadeDepthController mDepthController; private int mDisplayId; /** @@ -576,6 +578,7 @@ public class NotificationPanelViewController extends PanelViewController { ScrimController scrimController, UserManager userManager, MediaDataManager mediaDataManager, + NotificationShadeDepthController notificationShadeDepthController, AmbientState ambientState, FeatureFlags featureFlags) { super(view, falsingManager, dozeLog, keyguardStateController, @@ -594,6 +597,7 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationIconAreaController = notificationIconAreaController; mKeyguardStatusViewComponentFactory = keyguardStatusViewComponentFactory; mKeyguardStatusBarViewComponentFactory = keyguardStatusBarViewComponentFactory; + mDepthController = notificationShadeDepthController; mFeatureFlags = featureFlags; mKeyguardQsUserSwitchComponentFactory = keyguardQsUserSwitchComponentFactory; mKeyguardUserSwitcherComponentFactory = keyguardUserSwitcherComponentFactory; @@ -1993,6 +1997,7 @@ public class NotificationPanelViewController extends PanelViewController { mMediaHierarchyManager.setQsExpansion(qsExpansionFraction); mScrimController.setQsExpansion(qsExpansionFraction); mNotificationStackScrollLayoutController.setQsExpansionFraction(qsExpansionFraction); + mDepthController.setQsPanelExpansion(qsExpansionFraction); } private String determineAccessibilityPaneTitle() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt index e65db5ea41923..2df3f7086b7e6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt @@ -173,6 +173,13 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { verify(shadeAnimation).animateTo(eq(0), any()) } + @Test + fun setQsPanelExpansion_appliesBlur() { + notificationShadeDepthController.qsPanelExpansion = 1f + notificationShadeDepthController.updateBlurCallback.doFrame(0) + verify(blurUtils).applyBlur(any(), eq(maxBlur)) + } + @Test fun updateGlobalDialogVisibility_animatesBlur() { notificationShadeDepthController.updateGlobalDialogVisibility(0.5f, root) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index 6a5e6e8f98725..04ac1549e3748 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -82,6 +82,7 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.KeyguardAffordanceView; import com.android.systemui.statusbar.NotificationLockscreenUserManager; +import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShelfController; import com.android.systemui.statusbar.PulseExpansionHandler; import com.android.systemui.statusbar.StatusBarStateControllerImpl; @@ -219,6 +220,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Mock private NotificationStackScrollLayoutController mNotificationStackScrollLayoutController; @Mock + private NotificationShadeDepthController mNotificationShadeDepthController; + @Mock private AuthController mAuthController; @Mock private ScrimController mScrimController; @@ -333,6 +336,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { mScrimController, mUserManager, mMediaDataManager, + mNotificationShadeDepthController, mAmbientState, mFeatureFlags); mNotificationPanelViewController.initDependencies(