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
This commit is contained in:
Matt Pietal
2022-03-16 09:35:03 -04:00
parent 8e98ddc6b0
commit 874fd364b0

View File

@@ -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