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

Commit efa861ac authored by Sherry Zhou's avatar Sherry Zhou
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

Change-Id: I4455798e3de7bb4b597a232926041311ce382b47
parent 611e4316
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)