From 874fd364b09015a03cca4540e0b764c9d5b0cece Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Wed, 16 Mar 2022 09:35:03 -0400 Subject: [PATCH] Fix logcat view layout warnings The one-handed bouncer was requesting layout via setLayoutParams() on each onLayout pass, which was spamming logcat with warnings. Be more selective about when to request an update. Fixes: 224965291 Test: check logcat Change-Id: Ib5afe3cd07180dd1b7ec1641367a6e114c094d56 --- .../com/android/keyguard/KeyguardSecurityContainer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 362fbed7055ae..46a883194e25f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -152,6 +152,7 @@ public class KeyguardSecurityContainer extends FrameLayout { private SwipeListener mSwipeListener; private ViewMode mViewMode = new DefaultViewMode(); private @Mode int mCurrentMode = MODE_DEFAULT; + private int mWidth = -1; private final WindowInsetsAnimation.Callback mWindowInsetsAnimationCallback = new WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) { @@ -649,9 +650,11 @@ public class KeyguardSecurityContainer extends FrameLayout { protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - // After a layout pass, we need to re-place the inner bouncer, as our bounds may have - // changed. - mViewMode.updateSecurityViewLocation(); + int width = right - left; + if (changed && mWidth != width) { + mWidth = width; + mViewMode.updateSecurityViewLocation(); + } } @Override