Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ad8a4bd authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

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

* commit 'acddb72c':
  Make sure that the owner user is marked initialized.
parents a1095620 acddb72c
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -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);