From ad63aa3dc9fd71df87941720b211ca4ce8e0106f Mon Sep 17 00:00:00 2001 From: Peter Kalauskas Date: Thu, 2 Sep 2021 11:19:30 -0700 Subject: [PATCH] Only animate user list if there's multiple users Prevent ArrayIndexOutOfBoundsException from occurring if there are no child views yet. Test: Enable keyguard user switcher and reboot several times Bug: 198642878 Change-Id: I4a70e1bb93652996764a533b2c84241653c007da Merged-In: I4a70e1bb93652996764a533b2c84241653c007da (cherry picked from commit 54c8099b3e6a570b28f52d9980a0039d9ffaa527) --- .../systemui/statusbar/policy/KeyguardUserSwitcherListView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherListView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherListView.java index 20b66f03192e8..cd8894cae684d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherListView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcherListView.java @@ -103,7 +103,7 @@ public class KeyguardUserSwitcherListView extends AlphaOptimizedLinearLayout { } } - if (animate) { + if (animate && userItemViews.length > 1) { // AnimationUtils will immediately hide/show the first item in the array. Since the // first view is the current user, we want to manage its visibility separately. // Set first item to null so AnimationUtils ignores it.