From 6b33f9659158d94bfa09e00f30731937839349ed Mon Sep 17 00:00:00 2001 From: Peter Kalauskas Date: Thu, 8 Jul 2021 13:32:35 -0700 Subject: [PATCH] Fix user icon visibility bugs Remove call that made user icon VISIBLE whenever view was attached. This fixes issue where lock screen user icon was shown in QS after phone was unlocked. Also, remove call that made user icon GONE whenever the current user is null. This could cause the user switcher icon to erroneously disappear. Instead, handle the null case by drawing a default user icon. Additionally, - Remove unused dependency on UserManager - Add fallback TalkBack announcement if current user is null so it does not announce "unlabeled, double-tap to choose user." Instead it will now announce "Switch user, double-tap to choose user." - Remove redundant/unnecessary calls in getCurrentUserIcon - mCurrentUser.isCurrentUser is redundant - mCurrentUser.isSwitchToEnabled should not affect how icon is drawn - Call to mAdapter.getIconDrawable is unnecessary because all it does is check for whether it should drawn an "Add user" icon, but the lock screen user icon should never be an "Add user" icon Test: With config_keyguard_user_switch_opens_qs_details=true, disable lock screen for owner, then run adb shell am restart. Open QS, ensure that user icon isn't shown in the upper right. Fixes: 190062147 Change-Id: Ieb9a9274af452b69c0a916afb3ef0e177cab8d0d --- .../KeyguardQsUserSwitchController.java | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java index 1f1817cd29f00..5e70d0dbc4181 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java @@ -21,7 +21,7 @@ import android.content.res.Resources; import android.database.DataSetObserver; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; -import android.os.UserManager; +import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -76,7 +76,6 @@ public class KeyguardQsUserSwitchController extends ViewController