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

Commit 94bbc6a9 authored by Sherry Zhou's avatar Sherry Zhou Committed by Android Build Coastguard Worker
Browse files

Fix clock position is too high in lockscreen preview in tablet portrait mode

Bug: 369937183
Flag: com.android.systemui.migrate_clocks_to_blueprint
Test: manual test, attach screenshots in comment#6
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:efa861ac8951da4c6c82d849c64b29c06df68299)
Merged-In: I4455798e3de7bb4b597a232926041311ce382b47
Change-Id: I4455798e3de7bb4b597a232926041311ce382b47
parent 03028555
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -121,7 +121,10 @@ object KeyguardPreviewClockViewBinder {
    private fun applyClockDefaultConstraints(context: Context, constraints: ConstraintSet) {
        constraints.apply {
            constrainWidth(R.id.lockscreen_clock_view_large, ConstraintSet.WRAP_CONTENT)
            constrainHeight(R.id.lockscreen_clock_view_large, ConstraintSet.MATCH_CONSTRAINT)
            // The following two lines make lockscreen_clock_view_large is constrained to available
            // height when it goes beyond constraints; otherwise, it use WRAP_CONTENT
            constrainHeight(R.id.lockscreen_clock_view_large, WRAP_CONTENT)
            constrainMaxHeight(R.id.lockscreen_clock_view_large, 0)
            val largeClockTopMargin =
                SystemBarUtils.getStatusBarHeight(context) +
                    context.resources.getDimensionPixelSize(
@@ -138,7 +141,7 @@ object KeyguardPreviewClockViewBinder {
                R.id.lockscreen_clock_view_large,
                ConstraintSet.END,
                PARENT_ID,
                ConstraintSet.END
                ConstraintSet.END,
            )

            // In preview, we'll show UDFPS icon for UDFPS devices
@@ -160,14 +163,14 @@ object KeyguardPreviewClockViewBinder {
                    BOTTOM,
                    PARENT_ID,
                    BOTTOM,
                    clockBottomMargin
                    clockBottomMargin,
                )
            }

            constrainWidth(R.id.lockscreen_clock_view, WRAP_CONTENT)
            constrainHeight(
                R.id.lockscreen_clock_view,
                context.resources.getDimensionPixelSize(customizationR.dimen.small_clock_height)
                context.resources.getDimensionPixelSize(customizationR.dimen.small_clock_height),
            )
            connect(
                R.id.lockscreen_clock_view,
@@ -175,7 +178,7 @@ object KeyguardPreviewClockViewBinder {
                PARENT_ID,
                START,
                context.resources.getDimensionPixelSize(customizationR.dimen.clock_padding_start) +
                    context.resources.getDimensionPixelSize(R.dimen.status_view_margin_horizontal)
                    context.resources.getDimensionPixelSize(R.dimen.status_view_margin_horizontal),
            )
            val smallClockTopMargin =
                context.resources.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin) +
@@ -188,7 +191,7 @@ object KeyguardPreviewClockViewBinder {
        context: Context,
        rootView: ConstraintLayout,
        previewClock: ClockController,
        viewModel: KeyguardPreviewClockViewModel
        viewModel: KeyguardPreviewClockViewModel,
    ) {
        val cs = ConstraintSet().apply { clone(rootView) }
        applyClockDefaultConstraints(context, cs)