Merge "Add user switcher related strings to SettingsLib." into rvc-dev am: 66041721d7 am: 71a605714f am: fb79b493d6 am: 534d249544

Change-Id: I20c14b2e879db22b33e5b3dd745a003f275fb70c
This commit is contained in:
Ben Murdoch
2020-03-30 18:16:58 +00:00
committed by Automerger Merge Worker
3 changed files with 14 additions and 13 deletions

View File

@@ -1352,5 +1352,14 @@
<string name="user_need_lock_message">Before you can create a restricted profile, you\u2019ll need to set up a screen lock to protect your apps and personal data.</string>
<!-- User settings dialog button to set screen lock [CHAR LIMIT=25] -->
<string name="user_set_lock_button">Set lock</string>
<!-- Label for switching to other user in the user switcher [CHAR LIMIT=35] -->
<string name="user_switch_to_user">Switch to <xliff:g id="user_name" example="John Doe">%s</xliff:g></string>
<!-- Label for adding a new guest in the user switcher [CHAR LIMIT=35] -->
<string name="guest_new_guest">Add guest</string>
<!-- Label for exiting and removing the guest session in the user switcher [CHAR LIMIT=35] -->
<string name="guest_exit_guest">Remove guest</string>
<!-- Name for the guest user [CHAR LIMIT=35] -->
<string name="guest_nickname">Guest</string>
</resources>

View File

@@ -1151,15 +1151,6 @@
<!-- Name for a freshly added user [CHAR LIMIT=30] -->
<string name="user_new_user_name">New user</string>
<!-- Name for the guest user [CHAR LIMIT=35] -->
<string name="guest_nickname">Guest</string>
<!-- Label for adding a new guest in the user switcher [CHAR LIMIT=35] -->
<string name="guest_new_guest">Add guest</string>
<!-- Label for exiting and removing the guest session in the user switcher [CHAR LIMIT=35] -->
<string name="guest_exit_guest">Remove guest</string>
<!-- Title of the confirmation dialog when exiting guest session [CHAR LIMIT=NONE] -->
<string name="guest_exit_guest_dialog_title">Remove guest?</string>

View File

@@ -360,7 +360,7 @@ public class UserSwitcherController implements Dumpable {
if (record.isGuest && record.info == null) {
// No guest user. Create one.
UserInfo guest = mUserManager.createGuest(
mContext, mContext.getString(R.string.guest_nickname));
mContext, mContext.getString(com.android.settingslib.R.string.guest_nickname));
if (guest == null) {
// Couldn't create guest, most likely because there already exists one, we just
// haven't reloaded the user list yet.
@@ -583,7 +583,7 @@ public class UserSwitcherController implements Dumpable {
if (mUsers.isEmpty()) return null;
UserRecord item = mUsers.get(0);
if (item == null || item.info == null) return null;
if (item.isGuest) return context.getString(R.string.guest_nickname);
if (item.isGuest) return context.getString(com.android.settingslib.R.string.guest_nickname);
return item.info.name;
}
@@ -671,10 +671,11 @@ public class UserSwitcherController implements Dumpable {
public String getName(Context context, UserRecord item) {
if (item.isGuest) {
if (item.isCurrent) {
return context.getString(R.string.guest_exit_guest);
return context.getString(com.android.settingslib.R.string.guest_exit_guest);
} else {
return context.getString(
item.info == null ? R.string.guest_new_guest : R.string.guest_nickname);
item.info == null ? com.android.settingslib.R.string.guest_new_guest
: com.android.settingslib.R.string.guest_nickname);
}
} else if (item.isAddUser) {
return context.getString(R.string.user_add_user);