Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccb7f594 authored by Matt Pietal's avatar Matt Pietal
Browse files

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
parent a49a494a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);