OSDN Git Service

Use localized name for guest user
authorAmith Yamasani <yamasani@google.com>
Tue, 7 Jul 2015 17:13:12 +0000 (10:13 -0700)
committerAmith Yamasani <yamasani@google.com>
Tue, 7 Jul 2015 17:13:12 +0000 (10:13 -0700)
Rather than use the stored name, which depends on the language
in use when the Guest was created, always try to use the localized
word for Guest.

Bug: 22205776
Change-Id: I1a4912b9561196eee811eae31c8df2b72413648f

src/com/android/settings/Utils.java

index 21a5019..14b5576 100644 (file)
@@ -923,11 +923,13 @@ public final class Utils {
      * Returns a label for the user, in the form of "User: user name" or "Work profile".
      */
     public static String getUserLabel(Context context, UserInfo info) {
+        String name = info != null ? info.name : null;
         if (info.isManagedProfile()) {
             // We use predefined values for managed profiles
             return context.getString(R.string.managed_user_title);
+        } else if (info.isGuest()) {
+            name = context.getString(R.string.user_guest);
         }
-        String name = info != null ? info.name : null;
         if (name == null && info != null) {
             name = Integer.toString(info.id);
         } else if (info == null) {