From 6a62f99b50598bc0c4d3383cd1ec0982489b73ba Mon Sep 17 00:00:00 2001 From: Hawkwood Glazier Date: Tue, 2 Aug 2022 16:49:33 +0000 Subject: [PATCH] [DO NOT MERGE] Correct large clock position This corrects the large clock positioning error that was introduced with Ia053aaec6987e00de980388a6c024d8bcf5203a2. It does this by rearranging the layout slightly to get back to the same position. Of note: - Previously the margin for the large clock was computed dynamically and applied to the large clock frame from a static resource and dynamic value based on the font. Now the static portion is applied directly from the resource to the clock frame in the layout resource. The dynamic portion is applied to the AnimatableClockView directly instead of it's parent as before. - ChildClipping has been disabled on the parent view as the dynamic portion of this margin moves the AnimatableClockView outside of it's parent's bounds. - The margin that is now applied to the AnimatableClockView is scaled by 0.5 to account produce the ccorrect placement after center-aligning the view in it's parent. Before the full value was applied to the parent, creating an equivalent effect. This also fixes the clock translation issue when the splitshade appears and disappears. They were both fundamentally layout issues with the refactored clock code. This change was manually tested by flashing each device and comparing the clock position in every configuration against a refenece image from a dogfood build. Additionally the motion of the clock was validated when the splitshade appears and disappears on a tablet in landscape. Test: Manual validated screenshots from several devices against reference images from a known good build. Additionally validated with a screenshot test, although golden images had to be updated. Bug: 229771520 Fixes: 241083568 Fixes: 241084042 Change-Id: I273c2996ff67c7b5f77c6bafb292d53275c7bc47 --- .../layout/keyguard_clock_switch.xml | 10 +- packages/SystemUI/res/values/dimens.xml | 2 +- .../shared/res/layout/clock_default_small.xml | 2 +- .../shared/clocks/DefaultClockProvider.kt | 91 +++++++++++-------- .../android/keyguard/KeyguardClockSwitch.java | 7 +- .../KeyguardClockSwitchController.java | 5 +- .../shared/clocks/DefaultClockProviderTest.kt | 14 ++- 7 files changed, 72 insertions(+), 59 deletions(-) diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml index 8b8ebf00e190d..3ad7c8c4369ca 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml @@ -23,6 +23,7 @@ android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clipChildren="false" android:layout_gravity="center_horizontal|top"> - + android:paddingStart="@dimen/clock_padding_start" /> - + android:layout_marginTop="@dimen/keyguard_large_clock_top_margin" + android:visibility="gone" /> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index a77575418e5f2..e3be36503c873 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -669,7 +669,7 @@ 12dp - 100dp + -60dp 32dp diff --git a/packages/SystemUI/shared/res/layout/clock_default_small.xml b/packages/SystemUI/shared/res/layout/clock_default_small.xml index 390ff5e3ff787..ff6d7f9e22403 100644 --- a/packages/SystemUI/shared/res/layout/clock_default_small.xml +++ b/packages/SystemUI/shared/res/layout/clock_default_small.xml @@ -18,7 +18,7 @@ -->