am 4ad8a4bd: am acddb72c: Merge "Make sure that the owner user is marked initialized." into jb-mr1.1-dev

* commit '4ad8a4bd89c0a93705864e9beda39065b34545d6':
  Make sure that the owner user is marked initialized.
This commit is contained in:
Amith Yamasani
2012-11-16 10:50:29 -08:00
committed by Android Git Automerger

View File

@@ -88,7 +88,7 @@ public class UserManagerService extends IUserManager.Stub {
private static final int MIN_USER_ID = 10;
private static final int USER_VERSION = 1;
private static final int USER_VERSION = 2;
private static final long EPOCH_PLUS_30_YEARS = 30L * 365 * 24 * 60 * 60 * 1000L; // ms
@@ -484,8 +484,7 @@ public class UserManagerService extends IUserManager.Stub {
}
/**
* This fixes an incorrect initialization of user name for the owner.
* TODO: Remove in the next release.
* Upgrade steps between versions, either for fixing bugs or changing the data format.
*/
private void upgradeIfNecessary() {
int userVersion = mUserVersion;
@@ -499,6 +498,16 @@ public class UserManagerService extends IUserManager.Stub {
userVersion = 1;
}
if (userVersion < 2) {
// Owner should be marked as initialized
UserInfo user = mUsers.get(UserHandle.USER_OWNER);
if ((user.flags & UserInfo.FLAG_INITIALIZED) == 0) {
user.flags |= UserInfo.FLAG_INITIALIZED;
writeUserLocked(user);
}
userVersion = 2;
}
if (userVersion < USER_VERSION) {
Slog.w(LOG_TAG, "User version " + mUserVersion + " didn't upgrade as expected to "
+ USER_VERSION);