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

Commit 39c5f9f0 authored by Nicolas Prévot's avatar Nicolas Prévot Committed by android-build-merger
Browse files

Merge \\"Don\\'t allow showing an activity if user is stopping or shutting...

Merge \\"Don\\'t allow showing an activity if user is stopping or shutting down.\\" into nyc-dev am: 2058553b
am: ea600f9a

Change-Id: I1b43aabc35b45558c90750cab7314b63ae8d4b60
parents 1fef3495 ea600f9a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -3030,8 +3030,9 @@ public final class ActivityStackSupervisor implements DisplayListener {

    /** Checks whether the activity should be shown for current user. */
    boolean okToShowLocked(ActivityRecord r) {
        return r != null && (isCurrentProfileLocked(r.userId)
                || (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0);
        return r != null && ((r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0
                || (isCurrentProfileLocked(r.userId)
                && !mService.mUserController.isUserStoppingOrShuttingDownLocked(r.userId)));
    }

    final ArrayList<ActivityRecord> processStoppingActivitiesLocked(boolean remove) {
+9 −0
Original line number Diff line number Diff line
@@ -1336,6 +1336,15 @@ final class UserController {
        return mStartedUserArray;
    }

    boolean isUserStoppingOrShuttingDownLocked(int userId) {
        UserState state = getStartedUserStateLocked(userId);
        if (state == null) {
            return false;
        }
        return state.state == UserState.STATE_STOPPING
                || state.state == UserState.STATE_SHUTDOWN;
    }

    boolean isUserRunningLocked(int userId, int flags) {
        UserState state = getStartedUserStateLocked(userId);
        if (state == null) {
+1 −1
Original line number Diff line number Diff line
@@ -737,9 +737,9 @@ public class UserManagerService extends IUserManager.Stub {
            long identity = Binder.clearCallingIdentity();
            try {
                if (enableQuietMode) {
                    ActivityManagerNative.getDefault().stopUser(userHandle, /* force */true, null);
                    LocalServices.getService(ActivityManagerInternal.class)
                            .killForegroundAppsForUser(userHandle);
                    ActivityManagerNative.getDefault().stopUser(userHandle, /* force */true, null);
                } else {
                    ActivityManagerNative.getDefault().startUserInBackground(userHandle);
                }