summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Felipe Leme <felipeal@google.com> 2019-10-29 18:03:18 -0700
committer Felipe Leme <felipeal@google.com> 2019-11-27 14:36:00 -0800
commitd1def616b5c12eeec571eea4a8d133378d96be9c (patch)
tree1749df0605675464da92178e47750b58455395d7
parentf6166035c424fc6bbc11d5d387085c411c359ed2 (diff)
Removed FLAG_EPHEMERAL from pre-created users.
When a User is pre-created with that flag, its CE & DE keys are not persisted on storage. Hence, when that pre-creatd user is converted to full-user, the expected keys don't exist and the user doesn't boot properly. This change fix the issue by making the pre-created user non-ephemeral, and changing it to ephemeral when it's converted to a "real" user. Test: manual verification on Automotive by creating a new user than deleting it using the UI - that creates and switches to a new guest user (which was pre-created); without this change, that user would be hanging with a "Android is starting..." message Bug: 143092698 Bug: 143553590 Change-Id: I2699f55a30d72fd5a88202bf6c83f7ca7c65fac0
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 8ddfad9ec81c..3a00e6067e97 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -3191,6 +3191,13 @@ public class UserManagerService extends IUserManager.Stub {
flags |= UserInfo.FLAG_EPHEMERAL;
}
+ // Always clear EPHEMERAL for pre-created users, otherwise the storage key
+ // won't be persisted. The flag will be re-added (if needed) when the
+ // pre-created user is "converted" to a normal user.
+ if (preCreate) {
+ flags &= ~UserInfo.FLAG_EPHEMERAL;
+ }
+
userInfo = new UserInfo(userId, name, null, flags, userType);
userInfo.serialNumber = mNextSerialNumber++;
userInfo.creationTime = getCreationTime();
@@ -4409,6 +4416,7 @@ public class UserManagerService extends IUserManager.Stub {
pw.println(" Supports switchable users: " + UserManager.supportsMultipleUsers());
pw.println(" All guests ephemeral: " + Resources.getSystem().getBoolean(
com.android.internal.R.bool.config_guestUserEphemeral));
+ pw.println(" Force ephemeral users: " + mForceEphemeralUsers);
pw.println(" Is split-system user: " + UserManager.isSplitSystemUser());
pw.println(" Is headless-system mode: " + UserManager.isHeadlessSystemUserMode());
pw.println(" User version: " + mUserVersion);