From f07b624784353c2385dcaa81bd34fc36b331ebb1 Mon Sep 17 00:00:00 2001 From: Hawkwood Glazier Date: Thu, 8 Dec 2022 20:58:17 +0000 Subject: [PATCH] Set Visibility on ClockSwitch Animation This sets the visibility of the clock frames to invisible when they are removed from view by KeyguardClockSwitch. This does not cause a visual change with the clock animation directly, but allows code to use visibility checks of the frames to determine which size clock is shown. There is an impact on the AOD positioning for the small clock which was already checking parameters this way, and always using the large clock positioning parameters as a result. This is now corrected and KeyguardClockPositionAlgorithm will recieve the correct parameters depending on whether the large or small clock is shown. Fixes: 261755021 Test: Manually checked a few devices Change-Id: I2bdca38cc70df03dfd952c94559ae8f36e2dc80a --- .../com/android/keyguard/KeyguardClockSwitch.java | 14 +++++++++++--- .../keyguard/KeyguardClockSwitchController.java | 8 -------- .../android/keyguard/KeyguardClockSwitchTest.java | 5 +++++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index 62babadc45d83..ae09620a3f3a5 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -183,6 +183,7 @@ public class KeyguardClockSwitch extends RelativeLayout { if (!animate) { out.setAlpha(0f); + out.setVisibility(INVISIBLE); in.setAlpha(1f); in.setVisibility(VISIBLE); mStatusArea.setTranslationY(statusAreaYTranslation); @@ -198,7 +199,10 @@ public class KeyguardClockSwitch extends RelativeLayout { direction * -mClockSwitchYAmount)); mClockOutAnim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animation) { - mClockOutAnim = null; + if (mClockOutAnim == animation) { + out.setVisibility(INVISIBLE); + mClockOutAnim = null; + } } }); @@ -212,7 +216,9 @@ public class KeyguardClockSwitch extends RelativeLayout { mClockInAnim.setStartDelay(CLOCK_OUT_MILLIS / 2); mClockInAnim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animation) { - mClockInAnim = null; + if (mClockInAnim == animation) { + mClockInAnim = null; + } } }); @@ -225,7 +231,9 @@ public class KeyguardClockSwitch extends RelativeLayout { mStatusAreaAnim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); mStatusAreaAnim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animation) { - mStatusAreaAnim = null; + if (mStatusAreaAnim == animation) { + mStatusAreaAnim = null; + } } }); mStatusAreaAnim.start(); diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index 788f1200d6030..1b8ee734932a6 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -337,10 +337,6 @@ public class KeyguardClockSwitchController extends ViewController