Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ababfcd4 authored by Andras Kloczl's avatar Andras Kloczl
Browse files

Add user switcher related strings to SettingsLib.

- Move guest related strings from sysui to settingslib
- Add a new string to settingslib

Test: Build, flash and check if the texts are appearing properly in keyguard and quicksettings user switcher.
Bug: 142798722
Change-Id: I5b3e13581efa274ce8ed899b8a949e5ef69c173c
parent 6cf68098
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1344,5 +1344,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>
+0 −9
Original line number Diff line number Diff line
@@ -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>

+5 −4
Original line number Diff line number Diff line
@@ -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);