am 2467188e: am a2530e4a: am ee24d848: Merge "Stop guest user on exiting, to conserve resources" into lmp-mr1-dev

* commit '2467188e396503988ea05401011837a18f9a93a1':
  Stop guest user on exiting, to conserve resources
This commit is contained in:
Amith Yamasani
2014-12-11 01:39:49 +00:00
committed by Android Git Automerger

View File

@@ -18973,6 +18973,31 @@ public final class ActivityManagerService extends ActivityManagerNative
}
mUserSwitchObservers.finishBroadcast();
}
stopGuestUserIfBackground();
}
/**
* Stops the guest user if it has gone to the background.
*/
private void stopGuestUserIfBackground() {
synchronized (this) {
final int num = mUserLru.size();
for (int i = 0; i < num; i++) {
Integer oldUserId = mUserLru.get(i);
UserStartedState oldUss = mStartedUsers.get(oldUserId);
if (oldUserId == UserHandle.USER_OWNER || oldUserId == mCurrentUserId
|| oldUss.mState == UserStartedState.STATE_STOPPING
|| oldUss.mState == UserStartedState.STATE_SHUTDOWN) {
continue;
}
UserInfo userInfo = mUserManager.getUserInfo(oldUserId);
if (userInfo.isGuest()) {
// This is a user to be stopped.
stopUserLocked(oldUserId, null);
break;
}
}
}
}
void scheduleStartProfilesLocked() {