diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index 82d9ae0dcd1eb..c881fbeeccddf 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -587,7 +587,7 @@
"Allows the app to write new words into the user dictionary."
"test access to protected storage"
"test access to protected storage"
- "Allows the app to test a permission for USB storage that will be availabe on future devices."
+ "Allows the app to test a permission for USB storage that will be available on future devices."
"Allows the app to test a permission for the SD card that will be available on future devices."
"modify or delete the contents of your USB storage"
"modify or delete the contents of your SD card"
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index f8dbd84da82c8..47a8fc5af7f13 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1721,7 +1721,7 @@
test access to protected storage
- Allows the app to test a permission for USB storage that will be availabe on future devices.
+ Allows the app to test a permission for USB storage that will be available on future devices.
Allows the app to test a permission for the SD card that will be available on future devices.
@@ -3950,5 +3950,7 @@
Accessibility canceled.
Current user %1$s.
+
+ Owner
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index f518e7f3d87a5..f697d65e2f6a6 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -842,6 +842,7 @@
+
diff --git a/services/java/com/android/server/pm/UserManagerService.java b/services/java/com/android/server/pm/UserManagerService.java
index fb93d059a14b6..e05442b3b9058 100644
--- a/services/java/com/android/server/pm/UserManagerService.java
+++ b/services/java/com/android/server/pm/UserManagerService.java
@@ -26,6 +26,7 @@ import android.app.IStopUserCallback;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.graphics.Bitmap;
@@ -75,6 +76,7 @@ public class UserManagerService extends IUserManager.Stub {
private static final String ATTR_SERIAL_NO = "serialNumber";
private static final String ATTR_NEXT_SERIAL_NO = "nextSerialNumber";
private static final String ATTR_PARTIAL = "partial";
+ private static final String ATTR_USER_VERSION = "version";
private static final String TAG_USERS = "users";
private static final String TAG_USER = "user";
@@ -84,6 +86,8 @@ public class UserManagerService extends IUserManager.Stub {
private static final int MIN_USER_ID = 10;
+ private static final int USER_VERSION = 1;
+
private static final long EPOCH_PLUS_30_YEARS = 30L * 365 * 24 * 60 * 60 * 1000L; // ms
private final Context mContext;
@@ -104,6 +108,7 @@ public class UserManagerService extends IUserManager.Stub {
// This resets on a reboot. Otherwise it keeps incrementing so that user ids are
// not reused in quick succession
private int mNextUserId = MIN_USER_ID;
+ private int mUserVersion = 0;
private static UserManagerService sInstance;
@@ -432,12 +437,17 @@ public class UserManagerService extends IUserManager.Stub {
if (lastSerialNumber != null) {
mNextSerialNumber = Integer.parseInt(lastSerialNumber);
}
+ String versionNumber = parser.getAttributeValue(null, ATTR_USER_VERSION);
+ if (versionNumber != null) {
+ mUserVersion = Integer.parseInt(versionNumber);
+ }
}
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT) {
if (type == XmlPullParser.START_TAG && parser.getName().equals(TAG_USER)) {
String id = parser.getAttributeValue(null, ATTR_ID);
UserInfo user = readUser(Integer.parseInt(id));
+
if (user != null) {
mUsers.put(user.id, user);
if (user.isGuest()) {
@@ -450,6 +460,7 @@ public class UserManagerService extends IUserManager.Stub {
}
}
updateUserIdsLocked();
+ upgradeIfNecessary();
} catch (IOException ioe) {
fallbackToSingleUserLocked();
} catch (XmlPullParserException pe) {
@@ -464,9 +475,35 @@ public class UserManagerService extends IUserManager.Stub {
}
}
+ /**
+ * This fixes an incorrect initialization of user name for the owner.
+ * TODO: Remove in the next release.
+ */
+ private void upgradeIfNecessary() {
+ int userVersion = mUserVersion;
+ if (userVersion < 1) {
+ // Assign a proper name for the owner, if not initialized correctly before
+ UserInfo user = mUsers.get(UserHandle.USER_OWNER);
+ if ("Primary".equals(user.name)) {
+ user.name = mContext.getResources().getString(com.android.internal.R.string.owner_name);
+ writeUserLocked(user);
+ }
+ userVersion = 1;
+ }
+
+ if (userVersion < USER_VERSION) {
+ Slog.w(LOG_TAG, "User version " + mUserVersion + " didn't upgrade as expected to "
+ + USER_VERSION);
+ } else {
+ mUserVersion = userVersion;
+ writeUserListLocked();
+ }
+ }
+
private void fallbackToSingleUserLocked() {
// Create the primary user
- UserInfo primary = new UserInfo(0, "Primary", null,
+ UserInfo primary = new UserInfo(0,
+ mContext.getResources().getString(com.android.internal.R.string.owner_name), null,
UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY | UserInfo.FLAG_INITIALIZED);
mUsers.put(0, primary);
mNextSerialNumber = MIN_USER_ID;
@@ -547,6 +584,7 @@ public class UserManagerService extends IUserManager.Stub {
serializer.startTag(null, TAG_USERS);
serializer.attribute(null, ATTR_NEXT_SERIAL_NO, Integer.toString(mNextSerialNumber));
+ serializer.attribute(null, ATTR_USER_VERSION, Integer.toString(mUserVersion));
for (int i = 0; i < mUsers.size(); i++) {
UserInfo user = mUsers.valueAt(i);