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

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

Merge "Fix clock disappearing from locksscreen" into main

parents 13181a26 3d5eb6d3
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardBlueprintViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.res.R
import javax.inject.Inject
import kotlin.math.max
import kotlinx.coroutines.launch
@@ -127,6 +128,7 @@ constructor(
                        runTransition(constraintLayout, transition, Config.DEFAULT) {
                            // Add and remove views of sections that are not contained by the other.
                            blueprint.replaceViews(prevBluePrint, constraintLayout)
                            logAlphaVisibilityOfAppliedConstraintSet(cs, clockViewModel)
                            cs.applyTo(constraintLayout)
                        }

@@ -153,6 +155,7 @@ constructor(
                            ),
                            transition,
                        ) {
                            logAlphaVisibilityOfAppliedConstraintSet(cs, clockViewModel)
                            cs.applyTo(constraintLayout)
                        }
                        Trace.endSection()
@@ -205,4 +208,23 @@ constructor(
            apply()
        }
    }

    private fun logAlphaVisibilityOfAppliedConstraintSet(
        cs: ConstraintSet,
        viewModel: KeyguardClockViewModel
    ) {
        if (!DEBUG || viewModel.clock == null) return
        val smallClockViewId = R.id.lockscreen_clock_view
        val largeClockViewId = viewModel.clock!!.largeClock.layout.views[0].id
        Log.i(
            TAG,
            "applyCsToSmallClock: vis=${cs.getVisibility(smallClockViewId)} " +
                "alpha=${cs.getConstraint(smallClockViewId).propertySet}"
        )
        Log.i(
            TAG,
            "applyCsToLargeClock: vis=${cs.getVisibility(largeClockViewId)} " +
                "alpha=${cs.getConstraint(largeClockViewId).propertySet}"
        )
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -52,6 +52,11 @@ internal fun ConstraintSet.setVisibility(
    visibility: Int,
) = views.forEach { view -> this.setVisibility(view.id, visibility) }

internal fun ConstraintSet.setAlpha(
    views: Iterable<View>,
    alpha: Float,
) = views.forEach { view -> this.setAlpha(view.id, alpha) }

open class ClockSection
@Inject
constructor(
@@ -101,6 +106,8 @@ constructor(
        return constraintSet.apply {
            setVisibility(getTargetClockFace(clock).views, VISIBLE)
            setVisibility(getNonTargetClockFace(clock).views, GONE)
            setAlpha(getTargetClockFace(clock).views, 1F)
            setAlpha(getNonTargetClockFace(clock).views, 0F)
            if (!keyguardClockViewModel.useLargeClock) {
                connect(sharedR.id.bc_smartspace_view, TOP, sharedR.id.date_smartspace_view, BOTTOM)
            }
@@ -179,7 +186,7 @@ constructor(
                context.resources.getDimensionPixelSize(customizationR.dimen.clock_padding_start) +
                    context.resources.getDimensionPixelSize(R.dimen.status_view_margin_horizontal)
            )
            var smallClockTopMargin =
            val smallClockTopMargin =
                if (splitShadeStateController.shouldUseSplitNotificationShade(context.resources)) {
                    context.resources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin)
                } else {
+1 −1
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ class ClockSizeTransition(
                arrayOf(PROP_VISIBILITY, PROP_ALPHA, PROP_BOUNDS, SMARTSPACE_BOUNDS)

            private val DEBUG = true
            private val TAG = ClockFaceInTransition::class.simpleName!!
            private val TAG = VisibilityBoundsTransition::class.simpleName!!
        }
    }