Merge "UserTypeFactory configurable setMaxAllowed"
This commit is contained in:
@@ -83,6 +83,8 @@ Supported optional properties (to be used as shown in the example above) are as
|
||||
For profile and full users:
|
||||
default-restrictions (with values defined in UserRestrictionUtils.USER_RESTRICTIONS)
|
||||
enabled
|
||||
user-properties
|
||||
max-allowed
|
||||
For profile users only:
|
||||
max-allowed-per-parent
|
||||
icon-badge
|
||||
|
||||
@@ -397,6 +397,7 @@ public final class UserTypeFactory {
|
||||
}
|
||||
|
||||
setIntAttribute(parser, "enabled", builder::setEnabled);
|
||||
setIntAttribute(parser, "max-allowed", builder::setMaxAllowed);
|
||||
|
||||
// Process child elements.
|
||||
final int depth = parser.getDepth();
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
<user-types>
|
||||
<full-type
|
||||
name='android.test.1'
|
||||
max-allowed-per-parent='12' >
|
||||
max-allowed-per-parent='12'
|
||||
max-allowed='17' >
|
||||
<default-restrictions no_remove_user='true' no_bluetooth='true' />
|
||||
<badge-colors>
|
||||
<item res='@*android:color/profile_badge_1' />
|
||||
|
||||
@@ -355,6 +355,7 @@ public class UserManagerServiceUserTypeTest {
|
||||
UserTypeDetails details = builders.get(userTypeFull).createUserTypeDetails();
|
||||
assertEquals(UNLIMITED_NUMBER_OF_USERS, details.getMaxAllowedPerParent());
|
||||
assertFalse(details.isEnabled());
|
||||
assertEquals(17, details.getMaxAllowed());
|
||||
assertTrue(UserRestrictionsUtils.areEqual(
|
||||
makeRestrictionsBundle("no_remove_user", "no_bluetooth"),
|
||||
details.getDefaultRestrictions()));
|
||||
|
||||
Reference in New Issue
Block a user