Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5876d9b6 authored by Christian Göllner's avatar Christian Göllner Committed by Android (Google) Code Review
Browse files

Merge changes from topics "presubmit-am-383593e5942445eb8d161d1e83da2250",...

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
parents edcc80f4 ea50684c
Loading
Loading
Loading
Loading
+35 −7
Original line number Original line Diff line number Diff line
@@ -34,17 +34,45 @@
    <item name="controls_task_view_width_percentage" translatable="false" format="float" type="dimen">0.45</item>
    <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>
    <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
    <!-- Distance that the full shade transition takes in order to complete by tapping on a button
         shade -->
         like "expand". -->
    <dimen name="lockscreen_shade_qs_transition_distance">200dp</dimen>
    <dimen name="lockscreen_shade_transition_by_tap_distance">200dp</dimen>


    <!-- Distance that the full shade transition takes in order for scrim to fully transition to
    <!-- Distance that the full shade transition takes in order to complete.  -->
         the shade (in alpha) -->
    <dimen name="lockscreen_shade_full_transition_distance">200dp</dimen>
    <dimen name="lockscreen_shade_scrim_transition_distance">200dp</dimen>


    <!-- Distance that the full shade transition takes in order for media to fully transition to
    <!-- Distance that the full shade transition takes in order for media to fully transition to
         the shade -->
         the shade -->
    <dimen name="lockscreen_shade_media_transition_distance">200dp</dimen>
    <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">80dp</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>
    <dimen name="notification_panel_margin_horizontal">12dp</dimen>
</resources>
</resources>
+31 −4
Original line number Original line Diff line number Diff line
@@ -1122,13 +1122,40 @@
    <dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen>
    <dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen>
    <dimen name="media_output_dialog_app_tier_icon_size">20dp</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
    <!-- Distance that the full shade transition takes in order to complete by tapping on a button
         shade -->
         like "expand". -->
    <dimen name="lockscreen_shade_qs_transition_distance">200dp</dimen>
    <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
    <!-- Distance that the full shade transition takes in order for scrim to fully transition to
         the shade (in alpha) -->
         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
    <!-- Distance that the full shade transition takes in order for media to fully transition to
         the shade -->
         the shade -->
+86 −13
Original line number Original line Diff line number Diff line
@@ -99,15 +99,57 @@ class LockscreenShadeTransitionController @Inject constructor(
    internal var pulseHeightAnimator: ValueAnimator? = null
    internal var pulseHeightAnimator: ValueAnimator? = null


    /**
    /**
     * Distance that the full shade transition takes in order for scrim to fully transition to
     * Distance that the full shade transition takes in order to complete.
     * the shade (in alpha)
     */
    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
    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
     * 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
     * The distance until we're showing the notifications when pulsing
     */
     */
    val distanceUntilShowingPulsingNotifications
    val distanceUntilShowingPulsingNotifications
        get() = scrimTransitionDistance
        get() = fullTransitionDistance


    /**
    /**
     * The udfpsKeyguardViewController if it exists.
     * The udfpsKeyguardViewController if it exists.
@@ -177,10 +219,24 @@ class LockscreenShadeTransitionController @Inject constructor(
    }
    }


    private fun updateResources() {
    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(
        scrimTransitionDistance = context.resources.getDimensionPixelSize(
                R.dimen.lockscreen_shade_scrim_transition_distance)
                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)
                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)
        useSplitShade = Utils.shouldUseSplitNotificationShade(context.resources)
    }
    }


@@ -337,11 +393,16 @@ class LockscreenShadeTransitionController @Inject constructor(
            if (field != value || forceApplyAmount) {
            if (field != value || forceApplyAmount) {
                field = value
                field = value
                if (!nsslController.isInLockedDownShade() || field == 0f || forceApplyAmount) {
                if (!nsslController.isInLockedDownShade() || field == 0f || forceApplyAmount) {
                    qSDragProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance)
                    val notificationShelfProgress =
                    nsslController.setTransitionToFullShadeAmount(field, qSDragProgress)
                        MathUtils.saturate(dragDownAmount / notificationShelfTransitionDistance)
                    nsslController.setTransitionToFullShadeAmount(field, notificationShelfProgress)

                    qSDragProgress = MathUtils.saturate(dragDownAmount / qsTransitionDistance)
                    qS.setTransitionToFullShadeAmount(field, qSDragProgress)
                    qS.setTransitionToFullShadeAmount(field, qSDragProgress)

                    notificationPanelController.setTransitionToFullShadeAmount(field,
                    notificationPanelController.setTransitionToFullShadeAmount(field,
                            false /* animate */, 0 /* delay */)
                            false /* animate */, 0 /* delay */)

                    mediaHierarchyManager.setTransitionToFullShadeAmount(field)
                    mediaHierarchyManager.setTransitionToFullShadeAmount(field)
                    transitionToShadeAmountCommon(field)
                    transitionToShadeAmountCommon(field)
                }
                }
@@ -357,11 +418,23 @@ class LockscreenShadeTransitionController @Inject constructor(
    private fun transitionToShadeAmountCommon(dragDownAmount: Float) {
    private fun transitionToShadeAmountCommon(dragDownAmount: Float) {
        val scrimProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance)
        val scrimProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance)
        scrimController.setTransitionToFullShadeProgress(scrimProgress)
        scrimController.setTransitionToFullShadeProgress(scrimProgress)

        // Fade out all content only visible on the lockscreen
        // Fade out all content only visible on the lockscreen
        notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - scrimProgress)
        val npvcProgress =
        depthController.transitionToFullShadeProgress = scrimProgress
            MathUtils.saturate(dragDownAmount / npvcKeyguardContentAlphaTransitionDistance)
        udfpsKeyguardViewController?.setTransitionToFullShadeProgress(scrimProgress)
        notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - npvcProgress)
        centralSurfaces.setTransitionToFullShadeProgress(scrimProgress)

        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(
    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
        // be a couple of frames later. if we're setting it to 0, it will use the
        // default inset and therefore flicker
        // default inset and therefore flicker
        dragDownAmount = 1f
        dragDownAmount = 1f
        setDragDownAmountAnimated(fullTransitionDistance.toFloat(), delay = delay) {
        setDragDownAmountAnimated(fullTransitionDistanceByTap.toFloat(), delay = delay) {
            // End listener:
            // End listener:
            // Reset
            // Reset
            dragDownAmount = 0f
            dragDownAmount = 0f