From b559278cda9dd63ec031a96fdabdfd1ccb3799ed Mon Sep 17 00:00:00 2001 From: Beverly Date: Fri, 3 Jun 2022 19:00:38 +0000 Subject: [PATCH] Post updateClockViews when called within onLayout updateClockViews may change the view hiearchy and calling it within onLayout was causing view measurement issues. remove chatty debugging logs Test: manually force updateClockViews to occur in onLayout, see the clock is cutoff when notifications are hidden (can use adb: adb shell locksettings require-strong-auth STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN) w/o change, with this change, the clock is never cutoff Bug: 222260948 Bug: 233081863 Change-Id: I4ea5dae1dc8018478cc98e5e2520ef2afd2fdc58 --- .../shared/clocks/AnimatableClockView.kt | 27 ------------------- .../keyguard/AnimatableClockController.java | 3 --- .../android/keyguard/KeyguardClockSwitch.java | 2 +- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/AnimatableClockView.kt b/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/AnimatableClockView.kt index 57340234e5403..92086aaa6fd05 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/AnimatableClockView.kt @@ -25,7 +25,6 @@ import android.graphics.Canvas import android.text.TextUtils import android.text.format.DateFormat import android.util.AttributeSet -import android.util.Log import android.widget.TextView import com.android.systemui.animation.Interpolators import com.android.systemui.animation.TextAnimator @@ -134,22 +133,6 @@ class AnimatableClockView @JvmOverloads constructor( // relayout if the text didn't actually change. if (!TextUtils.equals(text, formattedText)) { text = formattedText - Log.d( - TAG, "refreshTime this=$this" + - " currTimeContextDesc=$contentDescription" + - " measuredHeight=$measuredHeight" + - " lastMeasureCall=$lastMeasureCall" + - " isSingleLineInternal=$isSingleLineInternal" - ) - } else { - Log.d( - TAG, "refreshTime (skipped due to unchanged text)" + - " this=$this" + - " currTimeContextDesc=$contentDescription" + - " measuredHeight=$measuredHeight" + - " lastMeasureCall=$lastMeasureCall" + - " isSingleLineInternal=$isSingleLineInternal" - ) } } @@ -170,20 +153,10 @@ class AnimatableClockView @JvmOverloads constructor( } else { animator.updateLayout(layout) } - Log.v(TAG, "onMeasure this=$this" + - " currTimeContextDesc=$contentDescription" + - " heightMeasureSpecMode=${MeasureSpec.getMode(heightMeasureSpec)}" + - " heightMeasureSpecSize=${MeasureSpec.getSize(heightMeasureSpec)}" + - " measuredWidth=$measuredWidth" + - " measuredHeight=$measuredHeight" + - " isSingleLineInternal=$isSingleLineInternal") } override fun onDraw(canvas: Canvas) { // intentionally doesn't call super.onDraw here or else the text will be rendered twice - Log.d(TAG, "onDraw this=$this" + - " currTimeContextDesc=$contentDescription" + - " isSingleLineInternal=$isSingleLineInternal") textAnimator?.draw(canvas) } diff --git a/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java b/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java index 1c8ffb9b56b24..c69ff7ee1cd80 100644 --- a/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java @@ -23,7 +23,6 @@ import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Color; import android.icu.text.NumberFormat; -import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; @@ -160,7 +159,6 @@ public class AnimatableClockController extends ViewController