summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matt Pietal <mpietal@google.com> 2022-01-26 10:56:23 -0500
committer Matt Pietal <mpietal@google.com> 2022-01-26 13:33:50 -0500
commitccb7f594ad77d5df32c7c37a4220a46dedf6fa63 (patch)
tree2a675fcc1937118e1fc4f6b0635f4da6d05052a0
parenta49a494a583bf261938e3b925bb1ba289514691b (diff)
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
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java6
1 files changed, 6 insertions, 0 deletions
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);