From df03b06e262bd47756451a94371b136fad0dd73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6llner?= Date: Wed, 2 Mar 2022 12:55:31 +0100 Subject: [PATCH 1/3] Lockscreen shade transition: rename and split resources There were two existing resource names that didn't reflect the their real usage, and have been renamed. The resources have also been split into multiple resources for easier fine tuning. Bug: 214946307 Test: Manually Change-Id: I7328e54c4b76d844327b5fd24b5de1afb2bb5904 --- .../res/values-sw600dp-land/dimens.xml | 41 ++++++-- packages/SystemUI/res/values/dimens.xml | 35 ++++++- .../LockscreenShadeTransitionController.kt | 96 ++++++++++++++++--- 3 files changed, 148 insertions(+), 24 deletions(-) diff --git a/packages/SystemUI/res/values-sw600dp-land/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml index 4f95811b21b37..3459aba63c367 100644 --- a/packages/SystemUI/res/values-sw600dp-land/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp-land/dimens.xml @@ -34,17 +34,44 @@ 0.45 8dp - - 200dp + + 200dp + + + 200dp + + + 200dp - 200dp + @dimen/lockscreen_shade_full_transition_distance - - 200dp + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance 12dp diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 5a7efca3dece2..5ca7285d3f737 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1122,13 +1122,40 @@ 12.5dp 20dp - - 200dp + + 200dp + + + 80dp - 80dp + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance + + + @dimen/lockscreen_shade_full_transition_distance diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt index 17f42b1a3a433..263463050d41c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt @@ -99,15 +99,57 @@ class LockscreenShadeTransitionController @Inject constructor( internal var pulseHeightAnimator: ValueAnimator? = null /** - * Distance that the full shade transition takes in order for scrim to fully transition to - * the shade (in alpha) + * Distance that the full shade transition takes in order to complete. + */ + private var fullTransitionDistance = 0 + + /** + * Distance that the full transition takes in order for us to fully transition to the shade by + * tapping on a button, such as "expand". + */ + private var fullTransitionDistanceByTap = 0 + + /** + * Distance that the full shade transition takes in order for scrim to fully transition to the + * shade (in alpha) */ private var scrimTransitionDistance = 0 /** - * Distance that the full transition takes in order for us to fully transition to the shade + * Distance that the full shade transition takes in order for the notification shelf to fully + * expand. */ - private var fullTransitionDistance = 0 + private var notificationShelfTransitionDistance = 0 + + /** + * Distance that the full shade transition takes in order for the Quick Settings to fully fade + * and expand. + */ + private var qsTransitionDistance = 0 + + /** + * Distance that the full shade transition takes in order for the keyguard content on + * NotificationPanelViewController to fully fade (e.g. Clock & Smartspace). + */ + private var npvcKeyguardContentAlphaTransitionDistance = 0 + + /** + * Distance that the full shade transition takes in order for depth of the wallpaper to fully + * change. + */ + private var depthControllerTransitionDistance = 0 + + /** + * Distance that the full shade transition takes in order for the UDFPS Keyguard View to fully + * fade. + */ + private var udfpsTransitionDistance = 0 + + /** + * Used for StatusBar to know that a transition is in progress. At the moment it only checks + * whether the progress is > 0, therefore this value is not very important. + */ + private var statusBarTransitionDistance = 0 /** * Flag to make sure that the dragDownAmount is applied to the listeners even when in the @@ -130,7 +172,7 @@ class LockscreenShadeTransitionController @Inject constructor( * The distance until we're showing the notifications when pulsing */ val distanceUntilShowingPulsingNotifications - get() = scrimTransitionDistance + get() = fullTransitionDistance /** * The udfpsKeyguardViewController if it exists. @@ -177,10 +219,24 @@ class LockscreenShadeTransitionController @Inject constructor( } private fun updateResources() { + fullTransitionDistance = context.resources.getDimensionPixelSize( + R.dimen.lockscreen_shade_full_transition_distance) + fullTransitionDistanceByTap = context.resources.getDimensionPixelSize( + R.dimen.lockscreen_shade_transition_by_tap_distance) scrimTransitionDistance = context.resources.getDimensionPixelSize( R.dimen.lockscreen_shade_scrim_transition_distance) - fullTransitionDistance = context.resources.getDimensionPixelSize( + notificationShelfTransitionDistance = context.resources.getDimensionPixelSize( + R.dimen.lockscreen_shade_notif_shelf_transition_distance) + qsTransitionDistance = context.resources.getDimensionPixelSize( R.dimen.lockscreen_shade_qs_transition_distance) + npvcKeyguardContentAlphaTransitionDistance = context.resources.getDimensionPixelSize( + R.dimen.lockscreen_shade_npvc_keyguard_content_alpha_transition_distance) + depthControllerTransitionDistance = context.resources.getDimensionPixelSize( + R.dimen.lockscreen_shade_depth_controller_transition_distance) + udfpsTransitionDistance = context.resources.getDimensionPixelSize( + R.dimen.lockscreen_shade_udfps_keyguard_transition_distance) + statusBarTransitionDistance = context.resources.getDimensionPixelSize( + R.dimen.lockscreen_shade_status_bar_transition_distance) useSplitShade = Utils.shouldUseSplitNotificationShade(context.resources) } @@ -337,11 +393,16 @@ class LockscreenShadeTransitionController @Inject constructor( if (field != value || forceApplyAmount) { field = value if (!nsslController.isInLockedDownShade() || field == 0f || forceApplyAmount) { - qSDragProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance) - nsslController.setTransitionToFullShadeAmount(field, qSDragProgress) + val notificationShelfProgress = + MathUtils.saturate(dragDownAmount / notificationShelfTransitionDistance) + nsslController.setTransitionToFullShadeAmount(field, notificationShelfProgress) + + qSDragProgress = MathUtils.saturate(dragDownAmount / qsTransitionDistance) qS.setTransitionToFullShadeAmount(field, qSDragProgress) + notificationPanelController.setTransitionToFullShadeAmount(field, false /* animate */, 0 /* delay */) + mediaHierarchyManager.setTransitionToFullShadeAmount(field) transitionToShadeAmountCommon(field) } @@ -357,11 +418,20 @@ class LockscreenShadeTransitionController @Inject constructor( private fun transitionToShadeAmountCommon(dragDownAmount: Float) { val scrimProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance) scrimController.setTransitionToFullShadeProgress(scrimProgress) + // Fade out all content only visible on the lockscreen - notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - scrimProgress) - depthController.transitionToFullShadeProgress = scrimProgress - udfpsKeyguardViewController?.setTransitionToFullShadeProgress(scrimProgress) - centralSurfaces.setTransitionToFullShadeProgress(scrimProgress) + val npvcProgress = + MathUtils.saturate(dragDownAmount / npvcKeyguardContentAlphaTransitionDistance) + notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - npvcProgress) + + val depthProgress = MathUtils.saturate(dragDownAmount / depthControllerTransitionDistance) + depthController.transitionToFullShadeProgress = depthProgress + + val udfpsProgress = MathUtils.saturate(dragDownAmount / udfpsTransitionDistance) + udfpsKeyguardViewController?.setTransitionToFullShadeProgress(udfpsProgress) + + val statusBarProgress = MathUtils.saturate(dragDownAmount / statusBarTransitionDistance) + centralSurfaces.setTransitionToFullShadeProgress(statusBarProgress) } private fun setDragDownAmountAnimated( @@ -404,7 +474,7 @@ class LockscreenShadeTransitionController @Inject constructor( // be a couple of frames later. if we're setting it to 0, it will use the // default inset and therefore flicker dragDownAmount = 1f - setDragDownAmountAnimated(fullTransitionDistance.toFloat(), delay = delay) { + setDragDownAmountAnimated(fullTransitionDistanceByTap.toFloat(), delay = delay) { // End listener: // Reset dragDownAmount = 0f From 183b053b9f719e2681e922967df3b4dede5fe027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6llner?= Date: Wed, 2 Mar 2022 14:02:34 +0100 Subject: [PATCH 2/3] [Motion] Split-shade expansion on LS: decrease duration of scrim fade Decreases the drag amount required for the scrim fade to complete. With this change, QS only start fading in after the scrim has already completed fading in. Before, QS were starting to show when the scrim wasn't fully opaque yet. Fixes: 222032168 Test: Manually Change-Id: I23e0d0b3644472d6ea26882bdee6a6aee5850a84 --- packages/SystemUI/res/values-sw600dp-land/dimens.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/res/values-sw600dp-land/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml index 3459aba63c367..1894b0c0266fb 100644 --- a/packages/SystemUI/res/values-sw600dp-land/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp-land/dimens.xml @@ -47,11 +47,11 @@ - @dimen/lockscreen_shade_full_transition_distance + 80dp - @dimen/lockscreen_shade_full_transition_distance + 80dp From ea50684c124b2922c8b96c748d4ccdbda316616a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6llner?= Date: Wed, 2 Mar 2022 16:48:01 +0100 Subject: [PATCH 3/3] [Motion] Split-shade expansion on LS: disable depth effect Disables the depth change effect of the wallpaper when expanding the shade, to match the motion spec for T. Fixes: 222282930 Test: Manually Change-Id: Ifbcbec9a6cd37154c728b07db61bd507c4ec1351 --- packages/SystemUI/res/values-sw600dp-land/dimens.xml | 5 +++-- .../statusbar/LockscreenShadeTransitionController.kt | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/res/values-sw600dp-land/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml index 1894b0c0266fb..117404bad46e6 100644 --- a/packages/SystemUI/res/values-sw600dp-land/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp-land/dimens.xml @@ -62,8 +62,9 @@ @dimen/lockscreen_shade_full_transition_distance - @dimen/lockscreen_shade_full_transition_distance + change. + On split-shade, there should be no depth effect, so setting the value to 0. --> + 0dp diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt index 263463050d41c..5adb9e55a9df6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt @@ -424,8 +424,11 @@ class LockscreenShadeTransitionController @Inject constructor( MathUtils.saturate(dragDownAmount / npvcKeyguardContentAlphaTransitionDistance) notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - npvcProgress) - val depthProgress = MathUtils.saturate(dragDownAmount / depthControllerTransitionDistance) - depthController.transitionToFullShadeProgress = depthProgress + if (depthControllerTransitionDistance > 0) { + val depthProgress = + MathUtils.saturate(dragDownAmount / depthControllerTransitionDistance) + depthController.transitionToFullShadeProgress = depthProgress + } val udfpsProgress = MathUtils.saturate(dragDownAmount / udfpsTransitionDistance) udfpsKeyguardViewController?.setTransitionToFullShadeProgress(udfpsProgress)