Add UI for multiple admins on Headless

In a series of CLs under topic add_ui_for_hsum_admins UI and functionality for allowing multiple admins on HSUM build is added. In User settings and User switcher when creating a new user there is a new dialog prompting to choose admin status of the user to be created. In User details view there is a toggle that is visible to admin users that allows to modify admin status of existing users. This toggle is only applicable to full users that are not supervised, guests or a main device user.

Bug: 252790451
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserDetailsSettingsTest"
Change-Id: I447dc168be30aa614aeb3f8b71ad14a7223fd7c1
This commit is contained in:
Tetiana Meronyk
2022-11-24 16:04:16 +00:00
parent ecbb3a2933
commit e5acef9034
7 changed files with 170 additions and 11 deletions

View File

@@ -202,4 +202,19 @@ public final class UserDialogs {
.setNegativeButton(android.R.string.cancel, null)
.create();
}
/**
* Creates a dialog to confirm that the admin privileges of the user should be revoked.
*
* @param onConfirmListener Callback object for positive action
*/
public static Dialog createConfirmRevokeAdmin(Context context,
DialogInterface.OnClickListener onConfirmListener) {
return new AlertDialog.Builder(context)
.setTitle(R.string.user_revoke_admin_confirm_title)
.setMessage(R.string.user_revoke_admin_confirm_message)
.setPositiveButton(R.string.remove, onConfirmListener)
.setNegativeButton(android.R.string.cancel, null)
.create();
}
}