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

Commit 3aea4620 authored by Jovana Knezevic's avatar Jovana Knezevic Committed by Android (Google) Code Review
Browse files

Merge "Gets rid of the conditional keyguard dismissal in full screen user switcher."

parents 216142bf f01ea6c6
Loading
Loading
Loading
Loading
+2 −18
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ public class FullscreenUserSwitcher {
    private final int mShortAnimDuration;
    private final StatusBar mStatusBar;
    private final UserManagerHelper mUserManagerHelper;
    private int mCurrentForegroundUserId;
    private boolean mShowing;

    public FullscreenUserSwitcher(StatusBar statusBar, ViewStub containerStub, Context context) {
@@ -55,7 +54,6 @@ public class FullscreenUserSwitcher {
        mUserGridView.setUserSelectionListener(this::onUserSelected);

        mUserManagerHelper = new UserManagerHelper(context);
        updateCurrentForegroundUser();

        mShortAnimDuration = mContainer.getResources()
            .getInteger(android.R.integer.config_shortAnimTime);
@@ -78,23 +76,9 @@ public class FullscreenUserSwitcher {
    }

    public void onUserSwitched(int newUserId) {
        // The logic for foreground user change is needed here to exclude the reboot case. On
        // reboot, system fires ACTION_USER_SWITCHED change from -1 to 0 user. This is not an actual
        // user switch. We only want to trigger keyguard dismissal when foreground user changes.
        if (foregroundUserChanged()) {
        toggleSwitchInProgress(false);
            updateCurrentForegroundUser();
        mParent.post(this::dismissKeyguard);
    }
    }

    private boolean foregroundUserChanged() {
        return mCurrentForegroundUserId != mUserManagerHelper.getForegroundUserId();
    }

    private void updateCurrentForegroundUser() {
        mCurrentForegroundUserId = mUserManagerHelper.getForegroundUserId();
    }

    private void onUserSelected(UserGridRecyclerView.UserRecord record) {
        if (mUserManagerHelper.isHeadlessSystemUser()) {