Merge "SettingsApp Implement DISALLOW_GRANT_ADMIN in user creation flow" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
11d21e57d9
@@ -919,7 +919,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
d = mCreateUserDialogController.createDialog(
|
||||
getActivity(),
|
||||
this::startActivityForResult,
|
||||
UserManager.isMultipleAdminEnabled(),
|
||||
canCreateAdminUser(),
|
||||
(userName, userIcon, isAdmin) -> {
|
||||
mPendingUserIcon = userIcon;
|
||||
mPendingUserName = userName;
|
||||
@@ -937,6 +937,19 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the creation of a new admin user is allowed.
|
||||
* @return {@code true} if creating a new admin is allowed, {@code false} otherwise.
|
||||
*/
|
||||
private boolean canCreateAdminUser() {
|
||||
if (Flags.unicornModeRefactoringForHsumReadOnly()) {
|
||||
return UserManager.isMultipleAdminEnabled()
|
||||
&& !mUserManager.hasUserRestriction(UserManager.DISALLOW_GRANT_ADMIN);
|
||||
} else {
|
||||
return UserManager.isMultipleAdminEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDialogMetricsCategory(int dialogId) {
|
||||
switch (dialogId) {
|
||||
|
||||
Reference in New Issue
Block a user