From 4714ab131716246a4e94c62c75e63df4e7f3eb90 Mon Sep 17 00:00:00 2001 From: Hawkwood Glazier Date: Wed, 30 Nov 2022 17:05:02 +0000 Subject: [PATCH] Fix clock being too low in AOD To fix the clock being too low, this undoes the relevant portions of I3feea196bf348630697385e010a13955cdb0a897. We'll want to revert this when we figure out why the clock is moving so low in AOD. The clock still moves vertically a significant distance when entering and leaving AOD, but not so much as to overlap with the UDFPS/lock icon. I'm continuing to investigate what's causing that. Test: Manual Bug: 259758161 Change-Id: Iaeddce2d99a2b8db5afb6ac8ca508eeab3ae223e --- .../systemui/shared/clocks/DefaultClockController.kt | 11 ++--------- .../res-keyguard/layout/keyguard_clock_switch.xml | 1 + 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt index 869884474ffe3..e1f21742bf93d 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/clocks/DefaultClockController.kt @@ -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 @@ -152,15 +151,9 @@ class DefaultClockController( view: AnimatableClockView, ) : DefaultClockFaceController(view) { override fun recomputePadding(targetRegion: Rect?) { - // We center the view within the targetRegion instead of within the parent - // view by computing the difference and adding that to the padding. - val parent = view.parent - val yDiff = - if (targetRegion != null && parent is View && parent.isLaidOut()) - targetRegion.centerY() - parent.height / 2f - else 0f + // Ignore Target Region until top padding fixed in aod val lp = view.getLayoutParams() as FrameLayout.LayoutParams - lp.topMargin = (-0.5f * view.bottom + yDiff).toInt() + lp.topMargin = (-0.5f * view.bottom).toInt() view.setLayoutParams(lp) } diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml index b49afeef09f3b..218c5cc9b7fec 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml @@ -35,6 +35,7 @@ android:visibility="invisible" />