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
This commit is contained in:
Matt Pietal
2022-01-26 10:56:23 -05:00
parent a49a494a58
commit ccb7f594ad

View File

@@ -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);