Skip to content

Commit acddb72

Browse files
Amith YamasaniAndroid (Google) Code Review
authored andcommitted
Merge "Make sure that the owner user is marked initialized." into jb-mr1.1-dev
2 parents 159cdd9 + bc96250 commit acddb72

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

services/java/com/android/server/pm/UserManagerService.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class UserManagerService extends IUserManager.Stub {
8888

8989
private static final int MIN_USER_ID = 10;
9090

91-
private static final int USER_VERSION = 1;
91+
private static final int USER_VERSION = 2;
9292

9393
private static final long EPOCH_PLUS_30_YEARS = 30L * 365 * 24 * 60 * 60 * 1000L; // ms
9494

@@ -484,8 +484,7 @@ private void readUserListLocked() {
484484
}
485485

486486
/**
487-
* This fixes an incorrect initialization of user name for the owner.
488-
* TODO: Remove in the next release.
487+
* Upgrade steps between versions, either for fixing bugs or changing the data format.
489488
*/
490489
private void upgradeIfNecessary() {
491490
int userVersion = mUserVersion;
@@ -499,6 +498,16 @@ private void upgradeIfNecessary() {
499498
userVersion = 1;
500499
}
501500

501+
if (userVersion < 2) {
502+
// Owner should be marked as initialized
503+
UserInfo user = mUsers.get(UserHandle.USER_OWNER);
504+
if ((user.flags & UserInfo.FLAG_INITIALIZED) == 0) {
505+
user.flags |= UserInfo.FLAG_INITIALIZED;
506+
writeUserLocked(user);
507+
}
508+
userVersion = 2;
509+
}
510+
502511
if (userVersion < USER_VERSION) {
503512
Slog.w(LOG_TAG, "User version " + mUserVersion + " didn't upgrade as expected to "
504513
+ USER_VERSION);

0 commit comments

Comments
 (0)