From ccb7f594ad77d5df32c7c37a4220a46dedf6fa63 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Wed, 26 Jan 2022 10:56:23 -0500 Subject: Don't allow switching after boot Enable the view based on existing 'isSwitchToEnabled' flag. This covers boot as well as scenarios where an admin has disabled a user. Fixes: 215621940 Test: manual (reboot the device and attempt to switch users) Change-Id: If6fb44ec2cbfeed8cb5ce06e2a025629d6fcca96 --- .../src/com/android/keyguard/KeyguardSecurityContainer.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 3fab72441c89..c387260005b4 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -20,6 +20,8 @@ import static android.view.WindowInsets.Type.systemBars; import static android.view.WindowInsetsAnimation.Callback.DISPATCH_MODE_STOP; import static com.android.systemui.plugins.FalsingManager.LOW_PENALTY; +import static com.android.systemui.statusbar.policy.UserSwitcherController.USER_SWITCH_DISABLED_ALPHA; +import static com.android.systemui.statusbar.policy.UserSwitcherController.USER_SWITCH_ENABLED_ALPHA; import static java.lang.Integer.max; @@ -892,6 +894,9 @@ public class KeyguardSecurityContainer extends FrameLayout { } else { textView.setBackground(null); } + view.setEnabled(item.isSwitchToEnabled); + view.setAlpha(view.isEnabled() ? USER_SWITCH_ENABLED_ALPHA : + USER_SWITCH_DISABLED_ALPHA); return view; } @@ -941,6 +946,7 @@ public class KeyguardSecurityContainer extends FrameLayout { mPopup.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int pos, long id) { if (mFalsingManager.isFalseTap(LOW_PENALTY)) return; + if (!view.isEnabled()) return; // Subtract one for the header UserRecord user = adapter.getItem(pos - 1); -- cgit v1.2.3-59-g8ed1b