Merge "Don't allow showing an activity if user is stopping or shutting down." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2058553b8d
@@ -3025,8 +3025,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
|
|
||||||
/** Checks whether the activity should be shown for current user. */
|
/** Checks whether the activity should be shown for current user. */
|
||||||
boolean okToShowLocked(ActivityRecord r) {
|
boolean okToShowLocked(ActivityRecord r) {
|
||||||
return r != null && (isCurrentProfileLocked(r.userId)
|
return r != null && ((r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0
|
||||||
|| (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0);
|
|| (isCurrentProfileLocked(r.userId)
|
||||||
|
&& !mService.mUserController.isUserStoppingOrShuttingDownLocked(r.userId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<ActivityRecord> processStoppingActivitiesLocked(boolean remove) {
|
final ArrayList<ActivityRecord> processStoppingActivitiesLocked(boolean remove) {
|
||||||
|
|||||||
@@ -1335,6 +1335,15 @@ final class UserController {
|
|||||||
return mStartedUserArray;
|
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) {
|
boolean isUserRunningLocked(int userId, int flags) {
|
||||||
UserState state = getStartedUserStateLocked(userId);
|
UserState state = getStartedUserStateLocked(userId);
|
||||||
if (state == null) {
|
if (state == null) {
|
||||||
|
|||||||
@@ -732,9 +732,9 @@ public class UserManagerService extends IUserManager.Stub {
|
|||||||
long identity = Binder.clearCallingIdentity();
|
long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
if (enableQuietMode) {
|
if (enableQuietMode) {
|
||||||
|
ActivityManagerNative.getDefault().stopUser(userHandle, /* force */true, null);
|
||||||
LocalServices.getService(ActivityManagerInternal.class)
|
LocalServices.getService(ActivityManagerInternal.class)
|
||||||
.killForegroundAppsForUser(userHandle);
|
.killForegroundAppsForUser(userHandle);
|
||||||
ActivityManagerNative.getDefault().stopUser(userHandle, /* force */true, null);
|
|
||||||
} else {
|
} else {
|
||||||
ActivityManagerNative.getDefault().startUserInBackground(userHandle);
|
ActivityManagerNative.getDefault().startUserInBackground(userHandle);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user