Merge "Add separate summary "Owner" for main user on the device" into main

This commit is contained in:
Tetiana Meronyk
2024-04-24 10:28:33 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 6 deletions

View File

@@ -6948,6 +6948,8 @@
<!-- User summary to indicate that a work profile is currently not set up [CHAR LIMIT=100] --> <!-- User summary to indicate that a work profile is currently not set up [CHAR LIMIT=100] -->
<string name="user_summary_managed_profile_not_set_up">Not set up - Work profile</string> <string name="user_summary_managed_profile_not_set_up">Not set up - Work profile</string>
<!-- User information string to represent the owner of the device [CHAR LIMIT=25] --> <!-- User information string to represent the owner of the device [CHAR LIMIT=25] -->
<string name="user_owner">Owner</string>
<!-- User information string to represent the admin of the device [CHAR LIMIT=25] -->
<string name="user_admin">Admin</string> <string name="user_admin">Admin</string>
<!-- User settings title for current user entry "You" user. [CHAR LIMIT=30] --> <!-- User settings title for current user entry "You" user. [CHAR LIMIT=30] -->
<string name="user_you">You (<xliff:g id="name" example="Name">%s</xliff:g>)</string> <string name="user_you">You (<xliff:g id="name" example="Name">%s</xliff:g>)</string>

View File

@@ -368,9 +368,6 @@ public class UserSettings extends SettingsPreferenceFragment
mMePreference = new UserPreference(getPrefContext(), null /* attrs */, myUserId); mMePreference = new UserPreference(getPrefContext(), null /* attrs */, myUserId);
mMePreference.setKey(KEY_USER_ME); mMePreference.setKey(KEY_USER_ME);
mMePreference.setOnPreferenceClickListener(this); mMePreference.setOnPreferenceClickListener(this);
if (isCurrentUserAdmin()) {
mMePreference.setSummary(R.string.user_admin);
}
mGuestCategory = findPreference(KEY_GUEST_CATEGORY); mGuestCategory = findPreference(KEY_GUEST_CATEGORY);
@@ -1241,13 +1238,15 @@ public class UserSettings extends SettingsPreferenceFragment
pref.setEnabled(canOpenUserDetails); pref.setEnabled(canOpenUserDetails);
pref.setSelectable(true); pref.setSelectable(true);
pref.setKey("id=" + user.id); pref.setKey("id=" + user.id);
if (user.isAdmin()) {
pref.setSummary(R.string.user_admin);
}
} }
if (pref == null) { if (pref == null) {
continue; continue;
} }
if (user.isMain()) {
pref.setSummary(R.string.user_owner);
} else if (user.isAdmin()) {
pref.setSummary(R.string.user_admin);
}
if (user.id != UserHandle.myUserId() && !user.isGuest() && !user.isInitialized()) { if (user.id != UserHandle.myUserId() && !user.isGuest() && !user.isInitialized()) {
// sometimes after creating a guest the initialized flag isn't immediately set // sometimes after creating a guest the initialized flag isn't immediately set
// and we don't want to show "Not set up" summary for them // and we don't want to show "Not set up" summary for them