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(
|
d = mCreateUserDialogController.createDialog(
|
||||||
getActivity(),
|
getActivity(),
|
||||||
this::startActivityForResult,
|
this::startActivityForResult,
|
||||||
UserManager.isMultipleAdminEnabled(),
|
canCreateAdminUser(),
|
||||||
(userName, userIcon, isAdmin) -> {
|
(userName, userIcon, isAdmin) -> {
|
||||||
mPendingUserIcon = userIcon;
|
mPendingUserIcon = userIcon;
|
||||||
mPendingUserName = userName;
|
mPendingUserName = userName;
|
||||||
@@ -937,6 +937,19 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
return d;
|
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
|
@Override
|
||||||
public int getDialogMetricsCategory(int dialogId) {
|
public int getDialogMetricsCategory(int dialogId) {
|
||||||
switch (dialogId) {
|
switch (dialogId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user