Merge changes from topics "presubmit-am-383593e5942445eb8d161d1e83da2250", "presubmit-am-d7f8eeae4f3640ce9f6884b186ad4fc4", "presubmit-am-de00cd8bc3af4ee0ba3508d2af5b09e2" into tm-dev

* changes:
  [Motion] Split-shade expansion on LS: disable depth effect
  [Motion] Split-shade expansion on LS: decrease duration of scrim fade
  Lockscreen shade transition: rename and split resources
This commit is contained in:
Christian Göllner
2022-03-07 13:01:25 +00:00
committed by Android (Google) Code Review
3 changed files with 152 additions and 24 deletions

View File

@@ -34,17 +34,45 @@
<item name="controls_task_view_width_percentage" translatable="false" format="float" type="dimen">0.45</item>
<dimen name="controls_task_view_right_margin">8dp</dimen>
<!-- Distance that the full shade transition takes in order for qs to fully transition to the
shade -->
<dimen name="lockscreen_shade_qs_transition_distance">200dp</dimen>
<!-- Distance that the full shade transition takes in order to complete by tapping on a button
like "expand". -->
<dimen name="lockscreen_shade_transition_by_tap_distance">200dp</dimen>
<!-- Distance that the full shade transition takes in order to complete. -->
<dimen name="lockscreen_shade_full_transition_distance">200dp</dimen>
<!-- Distance that the full shade transition takes in order for media to fully transition to
the shade -->
<dimen name="lockscreen_shade_media_transition_distance">200dp</dimen>
<!-- Distance that the full shade transition takes in order for scrim to fully transition to
the shade (in alpha) -->
<dimen name="lockscreen_shade_scrim_transition_distance">200dp</dimen>
<dimen name="lockscreen_shade_scrim_transition_distance">80dp</dimen>
<!-- Distance that the full shade transition takes in order for media to fully transition to
the shade -->
<dimen name="lockscreen_shade_media_transition_distance">200dp</dimen>
<!-- Distance that the full shade transition takes in order for the keyguard content on
NotificationPanelViewController to fully fade (e.g. Clock & Smartspace) -->
<dimen name="lockscreen_shade_npvc_keyguard_content_alpha_transition_distance">80dp</dimen>
<!-- Distance that the full shade transition takes in order for the notification shell to fully
expand. -->
<dimen name="lockscreen_shade_notif_shelf_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for the Quick Settings to fully
fade and expand. -->
<dimen name="lockscreen_shade_qs_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for depth of the wallpaper to fully
change.
On split-shade, there should be no depth effect, so setting the value to 0. -->
<dimen name="lockscreen_shade_depth_controller_transition_distance">0dp</dimen>
<!-- Distance that the full shade transition takes in order for the UDFPS Keyguard View to fully
fade. -->
<dimen name="lockscreen_shade_udfps_keyguard_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- 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. -->
<dimen name="lockscreen_shade_status_bar_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<dimen name="notification_panel_margin_horizontal">12dp</dimen>
</resources>

View File

@@ -1122,13 +1122,40 @@
<dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen>
<dimen name="media_output_dialog_app_tier_icon_size">20dp</dimen>
<!-- Distance that the full shade transition takes in order for qs to fully transition to the
shade -->
<dimen name="lockscreen_shade_qs_transition_distance">200dp</dimen>
<!-- Distance that the full shade transition takes in order to complete by tapping on a button
like "expand". -->
<dimen name="lockscreen_shade_transition_by_tap_distance">200dp</dimen>
<!-- Distance that the full shade transition takes in order to complete. -->
<dimen name="lockscreen_shade_full_transition_distance">80dp</dimen>
<!-- Distance that the full shade transition takes in order for scrim to fully transition to
the shade (in alpha) -->
<dimen name="lockscreen_shade_scrim_transition_distance">80dp</dimen>
<dimen name="lockscreen_shade_scrim_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for the keyguard content on
NotificationPanelViewController to fully fade (e.g. Clock & Smartspace) -->
<dimen name="lockscreen_shade_npvc_keyguard_content_alpha_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for the notification shelf to fully
expand. -->
<dimen name="lockscreen_shade_notif_shelf_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for the Quick Settings to fully
fade and expand. -->
<dimen name="lockscreen_shade_qs_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for depth of the wallpaper to fully
change. -->
<dimen name="lockscreen_shade_depth_controller_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for the UDFPS Keyguard View to fully
fade. -->
<dimen name="lockscreen_shade_udfps_keyguard_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- 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. -->
<dimen name="lockscreen_shade_status_bar_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
<!-- Distance that the full shade transition takes in order for media to fully transition to
the shade -->

View File

@@ -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,23 @@ 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)
if (depthControllerTransitionDistance > 0) {
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 +477,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