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

Commit 416ec500 authored by Alex Stetson's avatar Alex Stetson
Browse files

Check for null before using user switcher view

On certain platforms, this view may not be relevant or set when switch
is called via an alternative method (such as a guest exit notification).
Therefore, if the null state is not accounted for, sysui will crash.

Bug: 239738046
Test: manual
Change-Id: Ief87945e3811b74c6a44c29ae029343663f085bb
parent 8d5e38f7
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@ public class UserSwitcherController implements Dumpable {
    private final AtomicBoolean mGuestIsResetting;
    private final AtomicBoolean mGuestCreationScheduled;
    private FalsingManager mFalsingManager;
    @Nullable
    private View mView;
    private String mCreateSupervisedUserPackage;
    private GlobalSettings mGlobalSettings;
@@ -572,9 +573,11 @@ public class UserSwitcherController implements Dumpable {

    protected void switchToUserId(int id) {
        try {
            if (mView != null) {
                mInteractionJankMonitor.begin(InteractionJankMonitor.Configuration.Builder
                        .withView(InteractionJankMonitor.CUJ_USER_SWITCH, mView)
                        .setTimeout(MULTI_USER_JOURNEY_TIMEOUT));
            }
            mLatencyTracker.onActionStart(LatencyTracker.ACTION_USER_SWITCH);
            pauseRefreshUsers();
            mActivityManager.switchUser(id);