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 54c8099b3e)
This commit is contained in:
Peter Kalauskas
2021-09-02 11:19:30 -07:00
parent ea3298f1fd
commit ad63aa3dc9

View File

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