Allow ephemeral users on the split-system-user systems only.
BUG: 27143201 Change-Id: I37f3ca7366648dbf07df39a7a972857e0ff78a9a
This commit is contained in:
@@ -1833,6 +1833,11 @@ public class UserManagerService extends IUserManager.Stub {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!UserManager.isSplitSystemUser() && (flags & UserInfo.FLAG_EPHEMERAL) != 0) {
|
||||||
|
Log.e(LOG_TAG,
|
||||||
|
"Ephemeral users are supported on split-system-user systems only.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// In split system user mode, we assign the first human user the primary flag.
|
// In split system user mode, we assign the first human user the primary flag.
|
||||||
// And if there is no device owner, we also assign the admin flag to primary user.
|
// And if there is no device owner, we also assign the admin flag to primary user.
|
||||||
if (UserManager.isSplitSystemUser()
|
if (UserManager.isSplitSystemUser()
|
||||||
|
|||||||
@@ -4968,6 +4968,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Preconditions.checkNotNull(who, "ComponentName is null");
|
Preconditions.checkNotNull(who, "ComponentName is null");
|
||||||
|
// Allow setting this policy to true only if there is a split system user.
|
||||||
|
if (forceEphemeralUsers && !mInjector.userManagerIsSplitSystemUser()) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Cannot force ephemeral users on systems without split system user.");
|
||||||
|
}
|
||||||
boolean removeAllUsers = false;
|
boolean removeAllUsers = false;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
final ActiveAdmin deviceOwner =
|
final ActiveAdmin deviceOwner =
|
||||||
@@ -6818,6 +6823,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
if (!mInjector.binderGetCallingUserHandle().isSystem()) {
|
if (!mInjector.binderGetCallingUserHandle().isSystem()) {
|
||||||
throw new SecurityException("createAndManageUser was called from non-system user");
|
throw new SecurityException("createAndManageUser was called from non-system user");
|
||||||
}
|
}
|
||||||
|
if (!mInjector.userManagerIsSplitSystemUser()
|
||||||
|
&& (flags & DevicePolicyManager.MAKE_USER_EPHEMERAL) != 0) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Ephemeral users are only supported on systems with a split system user.");
|
||||||
|
}
|
||||||
// Create user.
|
// Create user.
|
||||||
UserHandle user = null;
|
UserHandle user = null;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|||||||
Reference in New Issue
Block a user