Don't allow showing an activity if user is stopping or shutting down.
BUG:29264996
Change-Id: I9fc97c5dc37e6d5656b82b277954b5963eb345c4
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 4c515f0..d8a1c77 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -732,9 +732,9 @@
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);
}