summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2014-05-08 12:22:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-08 12:22:02 +0000
commit63812fd9f20d2a0f96ef0fac69497d3334ae6d97 (patch)
tree8f020512db0119c554230a6affc1f95c3953ecfb /services
parentb325c80d3da0c14107597a4c5423dba938e1a633 (diff)
parent1a7eaaa50e7f1a021129ebbe2f6ae1ac469b8812 (diff)
downloadframeworks_base-63812fd9f20d2a0f96ef0fac69497d3334ae6d97.zip
frameworks_base-63812fd9f20d2a0f96ef0fac69497d3334ae6d97.tar.gz
frameworks_base-63812fd9f20d2a0f96ef0fac69497d3334ae6d97.tar.bz2
Merge "Send boot_completed for users started in the background"
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java12
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java29
2 files changed, 36 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index a09b8d2..29c781b 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -16523,7 +16523,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
if ((userInfo.flags&UserInfo.FLAG_INITIALIZED) == 0) {
- if (userId != 0) {
+ if (userId != UserHandle.USER_OWNER) {
Intent intent = new Intent(Intent.ACTION_USER_INITIALIZE);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
broadcastIntentLocked(null, null, intent, null,
@@ -16552,6 +16552,8 @@ public final class ActivityManagerService extends ActivityManagerNative
EventLogTags.writeAmSwitchUser(userId);
getUserManagerLocked().userForeground(userId);
sendUserSwitchBroadcastsLocked(oldUserId, userId);
+ } else {
+ mStackSupervisor.startBackgroundUserLocked(userId, uss);
}
if (needStart) {
@@ -16727,7 +16729,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
- void finishUserSwitch(UserStartedState uss) {
+ void finishUserBoot(UserStartedState uss) {
synchronized (this) {
if (uss.mState == UserStartedState.STATE_BOOTING
&& mStartedUsers.get(uss.mHandle.getIdentifier()) == uss) {
@@ -16741,6 +16743,12 @@ public final class ActivityManagerService extends ActivityManagerNative
android.Manifest.permission.RECEIVE_BOOT_COMPLETED, AppOpsManager.OP_NONE,
true, false, MY_PID, Process.SYSTEM_UID, userId);
}
+ }
+ }
+
+ void finishUserSwitch(UserStartedState uss) {
+ synchronized (this) {
+ finishUserBoot(uss);
startProfilesLocked();
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index b93b1d9..00327ac 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -193,6 +193,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
/** Used on user changes */
final ArrayList<UserStartedState> mStartingUsers = new ArrayList<UserStartedState>();
+ /** Used to queue up any background users being started */
+ final ArrayList<UserStartedState> mStartingBackgroundUsers = new ArrayList<UserStartedState>();
+
/** Set to indicate whether to issue an onUserLeaving callback when a newly launched activity
* is being brought in front of us. */
boolean mUserLeaving = false;
@@ -1999,9 +2002,20 @@ public final class ActivityStackSupervisor implements DisplayListener {
if (booting) {
mService.finishBooting();
- } else if (startingUsers != null) {
- for (int i = 0; i < startingUsers.size(); i++) {
- mService.finishUserSwitch(startingUsers.get(i));
+ } else {
+ // Complete user switch
+ if (startingUsers != null) {
+ for (int i = 0; i < startingUsers.size(); i++) {
+ mService.finishUserSwitch(startingUsers.get(i));
+ }
+ }
+ // Complete starting up of background users
+ if (mStartingBackgroundUsers.size() > 0) {
+ startingUsers = new ArrayList<UserStartedState>(mStartingBackgroundUsers);
+ mStartingBackgroundUsers.clear();
+ for (int i = 0; i < startingUsers.size(); i++) {
+ mService.finishUserBoot(startingUsers.get(i));
+ }
}
}
@@ -2507,6 +2521,15 @@ public final class ActivityStackSupervisor implements DisplayListener {
return homeInFront;
}
+ /**
+ * Add background users to send boot completed events to.
+ * @param userId The user being started in the background
+ * @param uss The state object for the user.
+ */
+ public void startBackgroundUserLocked(int userId, UserStartedState uss) {
+ mStartingBackgroundUsers.add(uss);
+ }
+
final ArrayList<ActivityRecord> processStoppingActivitiesLocked(boolean remove) {
int N = mStoppingActivities.size();
if (N <= 0) return null;