Loading packages/SystemUI/res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1427,7 +1427,7 @@ <!-- Distance that the full shade transition takes in order for media to fully transition to the shade --> <dimen name="lockscreen_shade_media_transition_distance">140dp</dimen> <dimen name="lockscreen_shade_media_transition_distance">120dp</dimen> <!-- Maximum overshoot for the topPadding of notifications when transitioning to the full shade --> Loading packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class LockscreenShadeTransitionController @Inject constructor( private val displayMetrics: DisplayMetrics, private val mediaHierarchyManager: MediaHierarchyManager, private val scrimController: ScrimController, private val depthController: NotificationShadeDepthController, private val featureFlags: FeatureFlags, private val context: Context, configurationController: ConfigurationController, Loading Loading @@ -289,6 +290,7 @@ class LockscreenShadeTransitionController @Inject constructor( mediaHierarchyManager.setTransitionToFullShadeAmount(mediaAmount) // Fade out all content only visible on the lockscreen notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - scrimProgress) depthController.transitionToFullShadeProgress = scrimProgress } } } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +19 −4 Original line number Diff line number Diff line Loading @@ -105,6 +105,16 @@ class NotificationShadeDepthController @Inject constructor( scheduleUpdate() } /** * How much we're transitioning to the full shade */ var transitionToFullShadeProgress = 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. Loading Loading @@ -159,6 +169,7 @@ class NotificationShadeDepthController @Inject constructor( var combinedBlur = (shadeSpring.radius * INTERACTION_BLUR_FRACTION + normalizedBlurRadius * ANIMATION_BLUR_FRACTION).toInt() combinedBlur = max(combinedBlur, blurUtils.blurRadiusOfRatio(qsPanelExpansion)) combinedBlur = max(combinedBlur, blurUtils.blurRadiusOfRatio(transitionToFullShadeProgress)) var shadeRadius = max(combinedBlur, wakeAndUnlockBlurRadius).toFloat() val launchProgress = notificationLaunchAnimationParams?.linearProgress ?: 0f shadeRadius *= (1f - launchProgress) * (1f - launchProgress) Loading Loading @@ -323,7 +334,7 @@ class NotificationShadeDepthController @Inject constructor( velocity: Float, direction: Int ) { if (isOnKeyguardNotDismissing()) { if (shouldApplyShadeBlur()) { if (expansion > 0f) { // Blur view if user starts animating in the shade. if (isClosed) { Loading Loading @@ -370,7 +381,7 @@ class NotificationShadeDepthController @Inject constructor( private fun animateBlur(blur: Boolean, velocity: Float) { isBlurred = blur val targetBlurNormalized = if (blur && isOnKeyguardNotDismissing()) { val targetBlurNormalized = if (blur && shouldApplyShadeBlur()) { 1f } else { 0f Loading @@ -382,7 +393,7 @@ class NotificationShadeDepthController @Inject constructor( private fun updateShadeBlur() { var newBlur = 0 if (isOnKeyguardNotDismissing()) { if (shouldApplyShadeBlur()) { newBlur = blurUtils.blurRadiusOfRatio(shadeExpansion) } shadeSpring.animateTo(newBlur) Loading @@ -397,7 +408,11 @@ class NotificationShadeDepthController @Inject constructor( choreographer.postFrameCallback(updateBlurCallback) } private fun isOnKeyguardNotDismissing(): Boolean { /** * Should blur be applied to the shade currently. This is mainly used to make sure that * on the lockscreen, the wallpaper isn't blurred. */ private fun shouldApplyShadeBlur(): Boolean { val state = statusBarStateController.state return (state == StatusBarState.SHADE || state == StatusBarState.SHADE_LOCKED) && !keyguardStateController.isKeyguardFadingAway Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt +4 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { @Mock lateinit var notificationPanelController: NotificationPanelViewController @Mock lateinit var nsslController: NotificationStackScrollLayoutController @Mock lateinit var featureFlags: FeatureFlags @Mock lateinit var depthController: NotificationShadeDepthController @Mock lateinit var stackscroller: NotificationStackScrollLayout @Mock lateinit var expandHelperCallback: ExpandHelper.Callback @Mock lateinit var statusbar: StatusBar Loading @@ -94,7 +95,8 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { featureFlags = featureFlags, context = context, configurationController = configurationController, falsingManager = falsingManager falsingManager = falsingManager, depthController = depthController ) whenever(nsslController.view).thenReturn(stackscroller) whenever(nsslController.expandHelperCallback).thenReturn(expandHelperCallback) Loading Loading @@ -221,5 +223,6 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { verify(notificationPanelController).setTransitionToFullShadeAmount(anyFloat(), anyBoolean(), anyLong()) verify(qS).setTransitionToFullShadeAmount(anyFloat(), anyBoolean()) verify(depthController).transitionToFullShadeProgress = anyFloat() } } packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +7 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,13 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false)) } @Test fun setFullShadeTransition_appliesBlur() { notificationShadeDepthController.transitionToFullShadeProgress = 1f notificationShadeDepthController.updateBlurCallback.doFrame(0) verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false)) } @Test fun updateGlobalDialogVisibility_animatesBlur() { notificationShadeDepthController.updateGlobalDialogVisibility(0.5f, root) Loading Loading
packages/SystemUI/res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1427,7 +1427,7 @@ <!-- Distance that the full shade transition takes in order for media to fully transition to the shade --> <dimen name="lockscreen_shade_media_transition_distance">140dp</dimen> <dimen name="lockscreen_shade_media_transition_distance">120dp</dimen> <!-- Maximum overshoot for the topPadding of notifications when transitioning to the full shade --> Loading
packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class LockscreenShadeTransitionController @Inject constructor( private val displayMetrics: DisplayMetrics, private val mediaHierarchyManager: MediaHierarchyManager, private val scrimController: ScrimController, private val depthController: NotificationShadeDepthController, private val featureFlags: FeatureFlags, private val context: Context, configurationController: ConfigurationController, Loading Loading @@ -289,6 +290,7 @@ class LockscreenShadeTransitionController @Inject constructor( mediaHierarchyManager.setTransitionToFullShadeAmount(mediaAmount) // Fade out all content only visible on the lockscreen notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - scrimProgress) depthController.transitionToFullShadeProgress = scrimProgress } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +19 −4 Original line number Diff line number Diff line Loading @@ -105,6 +105,16 @@ class NotificationShadeDepthController @Inject constructor( scheduleUpdate() } /** * How much we're transitioning to the full shade */ var transitionToFullShadeProgress = 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. Loading Loading @@ -159,6 +169,7 @@ class NotificationShadeDepthController @Inject constructor( var combinedBlur = (shadeSpring.radius * INTERACTION_BLUR_FRACTION + normalizedBlurRadius * ANIMATION_BLUR_FRACTION).toInt() combinedBlur = max(combinedBlur, blurUtils.blurRadiusOfRatio(qsPanelExpansion)) combinedBlur = max(combinedBlur, blurUtils.blurRadiusOfRatio(transitionToFullShadeProgress)) var shadeRadius = max(combinedBlur, wakeAndUnlockBlurRadius).toFloat() val launchProgress = notificationLaunchAnimationParams?.linearProgress ?: 0f shadeRadius *= (1f - launchProgress) * (1f - launchProgress) Loading Loading @@ -323,7 +334,7 @@ class NotificationShadeDepthController @Inject constructor( velocity: Float, direction: Int ) { if (isOnKeyguardNotDismissing()) { if (shouldApplyShadeBlur()) { if (expansion > 0f) { // Blur view if user starts animating in the shade. if (isClosed) { Loading Loading @@ -370,7 +381,7 @@ class NotificationShadeDepthController @Inject constructor( private fun animateBlur(blur: Boolean, velocity: Float) { isBlurred = blur val targetBlurNormalized = if (blur && isOnKeyguardNotDismissing()) { val targetBlurNormalized = if (blur && shouldApplyShadeBlur()) { 1f } else { 0f Loading @@ -382,7 +393,7 @@ class NotificationShadeDepthController @Inject constructor( private fun updateShadeBlur() { var newBlur = 0 if (isOnKeyguardNotDismissing()) { if (shouldApplyShadeBlur()) { newBlur = blurUtils.blurRadiusOfRatio(shadeExpansion) } shadeSpring.animateTo(newBlur) Loading @@ -397,7 +408,11 @@ class NotificationShadeDepthController @Inject constructor( choreographer.postFrameCallback(updateBlurCallback) } private fun isOnKeyguardNotDismissing(): Boolean { /** * Should blur be applied to the shade currently. This is mainly used to make sure that * on the lockscreen, the wallpaper isn't blurred. */ private fun shouldApplyShadeBlur(): Boolean { val state = statusBarStateController.state return (state == StatusBarState.SHADE || state == StatusBarState.SHADE_LOCKED) && !keyguardStateController.isKeyguardFadingAway Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt +4 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { @Mock lateinit var notificationPanelController: NotificationPanelViewController @Mock lateinit var nsslController: NotificationStackScrollLayoutController @Mock lateinit var featureFlags: FeatureFlags @Mock lateinit var depthController: NotificationShadeDepthController @Mock lateinit var stackscroller: NotificationStackScrollLayout @Mock lateinit var expandHelperCallback: ExpandHelper.Callback @Mock lateinit var statusbar: StatusBar Loading @@ -94,7 +95,8 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { featureFlags = featureFlags, context = context, configurationController = configurationController, falsingManager = falsingManager falsingManager = falsingManager, depthController = depthController ) whenever(nsslController.view).thenReturn(stackscroller) whenever(nsslController.expandHelperCallback).thenReturn(expandHelperCallback) Loading Loading @@ -221,5 +223,6 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { verify(notificationPanelController).setTransitionToFullShadeAmount(anyFloat(), anyBoolean(), anyLong()) verify(qS).setTransitionToFullShadeAmount(anyFloat(), anyBoolean()) verify(depthController).transitionToFullShadeProgress = anyFloat() } }
packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +7 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,13 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false)) } @Test fun setFullShadeTransition_appliesBlur() { notificationShadeDepthController.transitionToFullShadeProgress = 1f notificationShadeDepthController.updateBlurCallback.doFrame(0) verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false)) } @Test fun updateGlobalDialogVisibility_animatesBlur() { notificationShadeDepthController.updateGlobalDialogVisibility(0.5f, root) Loading