UserDetailsSettings uses Guest string, not Guest name

The UserDetailsSettings panel, and its title, show the user's UserInfo.name.
This is correct for a regular user (and for the Owner). But for a Guest user,
this is incorrect, and the user_guest string should be used instead.

The difference occurs if the system language is changed after the guest is created;
the word 'guest' should update to the current language, not be frozen to the
language at the time of the guest's creation.

Bug: 185309160
Test: atest UserDetailsSettingsTest
Change-Id: I545aa3e6cc5d00c0bcc49960f37dddd9334b153b
This commit is contained in:
Adam Bookatz
2021-04-22 17:03:41 -07:00
parent f05822549c
commit f493bf0cdb
2 changed files with 32 additions and 23 deletions

View File

@@ -206,7 +206,7 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
mSwitchUserPref.setTitle(
context.getString(com.android.settingslib.R.string.user_switch_to_user,
mUserInfo.name));
UserSettings.getUserName(context, mUserInfo)));
if (mUserCaps.mDisallowSwitchUser) {
mSwitchUserPref.setDisabledByAdmin(RestrictedLockUtilsInternal.getDeviceOwner(context));