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

Commit d57c80f6 authored by Sherry Zhou's avatar Sherry Zhou Committed by Android (Google) Code Review
Browse files

Merge "Fix Post Boot Regression after migrating stepping animation" into main

parents b6ac85e8 484fdc11
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.text.TextUtils
import android.text.format.DateFormat
import android.util.AttributeSet
import android.util.MathUtils.constrainedMap
import android.view.View
import android.widget.TextView
import com.android.app.animation.Interpolators
import com.android.internal.annotations.VisibleForTesting
@@ -51,7 +52,7 @@ class AnimatableClockView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0,
    defStyleRes: Int = 0
    defStyleRes: Int = 0,
) : TextView(context, attrs, defStyleAttr, defStyleRes) {
    // To protect us from issues from this being null while the TextView constructor is running, we
    // implement the get method and ensure a value is returned before initialization is complete.
@@ -61,6 +62,9 @@ class AnimatableClockView @JvmOverloads constructor(
        get() = logger.buffer
        set(value) { logger = Logger(value, TAG) }

    var hasCustomPositionUpdatedAnimation: Boolean = false
    var migratedClocks: Boolean = false

    private val time = Calendar.getInstance()

    private val dozingWeightInternal: Int
@@ -193,9 +197,18 @@ class AnimatableClockView @JvmOverloads constructor(
        } else {
            animator.updateLayout(layout)
        }
        if (migratedClocks && hasCustomPositionUpdatedAnimation) {
            // Expand width to avoid clock being clipped during stepping animation
            setMeasuredDimension(measuredWidth +
                    MeasureSpec.getSize(widthMeasureSpec) / 2, measuredHeight)
        }
    }

    override fun onDraw(canvas: Canvas) {
        if (migratedClocks && hasCustomPositionUpdatedAnimation) {
            canvas.save()
            canvas.translate((parent as View).measuredWidth / 4F, 0F)
        }
        logger.d({ "onDraw($str1)"}) { str1 = text.toString() }
        // Use textAnimator to render text if animation is enabled.
        // Otherwise default to using standard draw functions.
@@ -205,6 +218,9 @@ class AnimatableClockView @JvmOverloads constructor(
        } else {
            super.onDraw(canvas)
        }
        if (migratedClocks && hasCustomPositionUpdatedAnimation) {
            canvas.restore()
        }
    }

    override fun invalidate() {
+2 −0
Original line number Diff line number Diff line
@@ -193,6 +193,8 @@ class DefaultClockController(
            ClockFaceConfig(hasCustomPositionUpdatedAnimation = hasStepClockAnimation)

        init {
            view.migratedClocks = migratedClocks
            view.hasCustomPositionUpdatedAnimation = hasStepClockAnimation
            animations = LargeClockAnimations(view, 0f, 0f)
        }

+1 −5
Original line number Diff line number Diff line
@@ -29,8 +29,4 @@ class KeyguardRootView(
    ConstraintLayout(
        context,
        attrs,
    ) {
    init {
        clipChildren = false
    }
}
    )