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

Commit d0932d65 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Remove Clock Migration Flag: 1/N" into main

parents 28e18c5e d3a747aa
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import com.android.compose.animation.scene.SceneScope
import com.android.compose.modifiers.thenIf
import com.android.systemui.common.ui.ConfigurationState
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.MigrateClocksToBlueprint
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn
import com.android.systemui.keyguard.ui.composable.modifier.burnInAware
@@ -90,14 +89,10 @@ constructor(
) {

    init {
        if (!MigrateClocksToBlueprint.isEnabled) {
            throw IllegalStateException("this requires MigrateClocksToBlueprint.isEnabled")
        }
        // This scene container section moves the NSSL to the SharedNotificationContainer.
        // This also requires that SharedNotificationContainer gets moved to the
        // SceneWindowRootView by the SceneWindowRootViewBinder. Prior to Scene Container,
        // but when the KeyguardShadeMigrationNssl flag is enabled, NSSL is moved into this
        // container by the NotificationStackScrollLayoutSection.
        // NSSL is moved into this container by the NotificationStackScrollLayoutSection.
        // Ensure stackScrollLayout is a child of sharedNotificationContainer.

        if (stackScrollLayout.parent != sharedNotificationContainer) {
+6 −13
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ constructor(
        }

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

    private val time = Calendar.getInstance()

@@ -228,11 +227,7 @@ constructor(
    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        logger.d("onMeasure")

        if (
            migratedClocks &&
                !isSingleLineInternal &&
                MeasureSpec.getMode(heightMeasureSpec) == EXACTLY
        ) {
        if (!isSingleLineInternal && MeasureSpec.getMode(heightMeasureSpec) == EXACTLY) {
            // Call straight into TextView.setTextSize to avoid setting lastUnconstrainedTextSize
            val size = min(lastUnconstrainedTextSize, MeasureSpec.getSize(heightMeasureSpec) / 2F)
            super.setTextSize(COMPLEX_UNIT_PX, size)
@@ -248,7 +243,7 @@ constructor(
                    }
            }

        if (migratedClocks && hasCustomPositionUpdatedAnimation) {
        if (hasCustomPositionUpdatedAnimation) {
            // Expand width to avoid clock being clipped during stepping animation
            val targetWidth = measuredWidth + MeasureSpec.getSize(widthMeasureSpec) / 2

@@ -582,13 +577,11 @@ constructor(
    }

    override fun onRtlPropertiesChanged(layoutDirection: Int) {
        if (migratedClocks) {
        if (layoutDirection == LAYOUT_DIRECTION_RTL) {
            textAlignment = TEXT_ALIGNMENT_TEXT_END
        } else {
            textAlignment = TEXT_ALIGNMENT_TEXT_START
        }
        }
        super.onRtlPropertiesChanged(layoutDirection)
    }

+2 −29
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.graphics.Rect
import android.icu.text.NumberFormat
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.VisibleForTesting
import com.android.systemui.customization.R
@@ -55,7 +54,6 @@ class DefaultClockController(
    private val layoutInflater: LayoutInflater,
    private val resources: Resources,
    private val settings: ClockSettings?,
    private val migratedClocks: Boolean = false,
    messageBuffers: ClockMessageBuffers? = null,
) : ClockController {
    override val smallClock: DefaultClockFaceController
@@ -67,7 +65,6 @@ class DefaultClockController(
    private val burmeseLineSpacing =
        resources.getFloat(R.dimen.keyguard_clock_line_spacing_scale_burmese)
    private val defaultLineSpacing = resources.getFloat(R.dimen.keyguard_clock_line_spacing_scale)
    protected var onSecondaryDisplay: Boolean = false

    override val events: DefaultClockEvents
    override val config: ClockConfig by lazy {
@@ -175,10 +172,7 @@ class DefaultClockController(
                    recomputePadding(targetRegion)
                }

                override fun onSecondaryDisplayChanged(onSecondaryDisplay: Boolean) {
                    this@DefaultClockController.onSecondaryDisplay = onSecondaryDisplay
                    recomputePadding(null)
                }
                override fun onSecondaryDisplayChanged(onSecondaryDisplay: Boolean) {}
            }

        open fun recomputePadding(targetRegion: Rect?) {}
@@ -197,32 +191,11 @@ class DefaultClockController(
        override val config = ClockFaceConfig(hasCustomPositionUpdatedAnimation = true)

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

        override fun recomputePadding(targetRegion: Rect?) {
            if (migratedClocks) {
                return
            }
            // We center the view within the targetRegion instead of within the parent
            // view by computing the difference and adding that to the padding.
            val lp = view.getLayoutParams() as FrameLayout.LayoutParams
            lp.topMargin =
                if (onSecondaryDisplay) {
                    // On the secondary display we don't want any additional top/bottom margin.
                    0
                } else {
                    val parent = view.parent
                    val yDiff =
                        if (targetRegion != null && parent is View && parent.isLaidOut())
                            targetRegion.centerY() - parent.height / 2f
                        else 0f
                    (-0.5f * view.bottom + yDiff).toInt()
                }
            view.setLayoutParams(lp)
        }
        override fun recomputePadding(targetRegion: Rect?) {}

        /** See documentation at [AnimatableClockView.offsetGlyphsForStepClockAnimation]. */
        fun offsetGlyphsForStepClockAnimation(fromLeft: Int, direction: Int, fraction: Float) {
+1 −9
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ class DefaultClockProvider(
    val ctx: Context,
    val layoutInflater: LayoutInflater,
    val resources: Resources,
    private val migratedClocks: Boolean = false,
    private val isClockReactiveVariantsEnabled: Boolean = false,
) : ClockProvider {
    private var messageBuffers: ClockMessageBuffers? = null
@@ -83,14 +82,7 @@ class DefaultClockProvider(
                FLEX_DESIGN,
            )
        } else {
            DefaultClockController(
                ctx,
                layoutInflater,
                resources,
                settings,
                migratedClocks,
                messageBuffers,
            )
            DefaultClockController(ctx, layoutInflater, resources, settings, messageBuffers)
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -140,8 +140,8 @@ class FlexClockFaceController(
        }

        /**
         * targetRegion passed to all customized clock applies counter translationY of
         * KeyguardStatusView and keyguard_large_clock_top_margin from default clock
         * targetRegion passed to all customized clock applies counter translationY of Keyguard and
         * keyguard_large_clock_top_margin from default clock
         */
        override fun onTargetRegionChanged(targetRegion: Rect?) {
            // When a clock needs to be aligned with screen, like weather clock
Loading