OSDN Git Service

Switch to using system-wide default user icons
authorAlexandra Gherghina <alexgherghina@google.com>
Wed, 3 Sep 2014 09:22:09 +0000 (10:22 +0100)
committerAlexandra Gherghina <alexgherghina@google.com>
Fri, 12 Sep 2014 16:00:40 +0000 (17:00 +0100)
User icons were either User Settings specific, or missing. This makes it
consistent with the ones in the new helper class.

Bug: 17311038
Change-Id: I20cc1deba989cf7a397c5a8dba41bd91bd62472b

20 files changed:
res/drawable-hdpi/ic_person_white.png [deleted file]
res/drawable-mdpi/ic_person_white.png [deleted file]
res/drawable-xhdpi/ic_person_white.png [deleted file]
res/drawable-xxhdpi/ic_person_white.png [deleted file]
res/drawable-xxxhdpi/ic_person_white.png [deleted file]
res/drawable/ic_avatar_default_1.xml [deleted file]
res/drawable/ic_avatar_default_2.xml [deleted file]
res/drawable/ic_avatar_default_3.xml [deleted file]
res/drawable/ic_avatar_default_4.xml [deleted file]
res/drawable/ic_avatar_default_5.xml [deleted file]
res/drawable/ic_avatar_default_6.xml [deleted file]
res/drawable/ic_avatar_default_7.xml [deleted file]
res/drawable/ic_avatar_default_8.xml [deleted file]
res/drawable/ic_avatar_guest.xml [deleted file]
res/drawable/ic_default_user.png [deleted file]
res/values/colors.xml
src/com/android/settings/UserSpinnerAdapter.java
src/com/android/settings/Utils.java
src/com/android/settings/drawable/CircleFramedDrawable.java
src/com/android/settings/users/UserSettings.java

diff --git a/res/drawable-hdpi/ic_person_white.png b/res/drawable-hdpi/ic_person_white.png
deleted file mode 100644 (file)
index 009524a..0000000
Binary files a/res/drawable-hdpi/ic_person_white.png and /dev/null differ
diff --git a/res/drawable-mdpi/ic_person_white.png b/res/drawable-mdpi/ic_person_white.png
deleted file mode 100644 (file)
index 563f1d1..0000000
Binary files a/res/drawable-mdpi/ic_person_white.png and /dev/null differ
diff --git a/res/drawable-xhdpi/ic_person_white.png b/res/drawable-xhdpi/ic_person_white.png
deleted file mode 100644 (file)
index 0200ece..0000000
Binary files a/res/drawable-xhdpi/ic_person_white.png and /dev/null differ
diff --git a/res/drawable-xxhdpi/ic_person_white.png b/res/drawable-xxhdpi/ic_person_white.png
deleted file mode 100644 (file)
index 6a6f033..0000000
Binary files a/res/drawable-xxhdpi/ic_person_white.png and /dev/null differ
diff --git a/res/drawable-xxxhdpi/ic_person_white.png b/res/drawable-xxxhdpi/ic_person_white.png
deleted file mode 100644 (file)
index 9092553..0000000
Binary files a/res/drawable-xxxhdpi/ic_person_white.png and /dev/null differ
diff --git a/res/drawable/ic_avatar_default_1.xml b/res/drawable/ic_avatar_default_1.xml
deleted file mode 100644 (file)
index edd919a..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/pink_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_2.xml b/res/drawable/ic_avatar_default_2.xml
deleted file mode 100644 (file)
index 77918a0..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/indigo_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_3.xml b/res/drawable/ic_avatar_default_3.xml
deleted file mode 100644 (file)
index 49fd6c4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/blue_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_4.xml b/res/drawable/ic_avatar_default_4.xml
deleted file mode 100644 (file)
index 6992f90..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/teal_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_5.xml b/res/drawable/ic_avatar_default_5.xml
deleted file mode 100644 (file)
index 2aa0db2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/green_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_6.xml b/res/drawable/ic_avatar_default_6.xml
deleted file mode 100644 (file)
index 7f9bb32..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/light_green_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_7.xml b/res/drawable/ic_avatar_default_7.xml
deleted file mode 100644 (file)
index 1c1c5f3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/orange_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_default_8.xml b/res/drawable/ic_avatar_default_8.xml
deleted file mode 100644 (file)
index 478454e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/deep_orange_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_avatar_guest.xml b/res/drawable/ic_avatar_guest.xml
deleted file mode 100644 (file)
index f81fe89..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="oval">
-            <size android:width="40dp" android:height="40dp" />
-            <solid android:color="@color/grey_500" />
-        </shape>
-    </item>
-    <item android:top="8dp" android:bottom="8dp" android:left="8dp" android:right="8dp"
-            android:drawable="@drawable/ic_person_white" />
-</layer-list>
-
diff --git a/res/drawable/ic_default_user.png b/res/drawable/ic_default_user.png
deleted file mode 100644 (file)
index ddf797f..0000000
Binary files a/res/drawable/ic_default_user.png and /dev/null differ
index 58687c9..1c299f5 100644 (file)
     <color name="setup_wizard_preference_background_color_dark">@*android:color/background_material_dark</color>
     <color name="setup_wizard_preference_background_color_light">@*android:color/background_material_light</color>
 
-    <!-- Default avatar colors -->
-    <color name="pink_500">#ffe91e63</color>
-    <color name="indigo_500">#ff3f51b5</color>
-    <color name="blue_500">#ff4285f4</color>
-    <color name="teal_500">#ff00bcd4</color>
-    <color name="green_500">#ff0f9d58</color>
-    <color name="light_green_500">#ff8bc34a</color>
-    <color name="orange_500">#ffff9800</color>
-    <color name="deep_orange_500">#ffff5722</color>
-    <!-- Avatar color used for guest -->
-    <color name="grey_500">#ff9e9e9e</color>
-
     <color name="wifi_divider">#ffe0e0e0</color>
 
 </resources>
index 32ef3be..b44caac 100644 (file)
@@ -31,6 +31,7 @@ import android.widget.ImageView;
 import android.widget.SpinnerAdapter;
 import android.widget.TextView;
 
+import com.android.internal.util.UserIcons;
 import com.android.settings.drawable.CircleFramedDrawable;
 import com.android.settings.R;
 
@@ -57,7 +58,11 @@ public class UserSpinnerAdapter implements SpinnerAdapter {
             } else {
                 name = userInfo.name;
                 Bitmap bitmap = um.getUserIcon(userHandle.getIdentifier());
-                icon = (bitmap == null) ? null : CircleFramedDrawable.getInstance(context, bitmap);
+                if (bitmap != null) {
+                    icon = CircleFramedDrawable.getInstance(context, bitmap);
+                } else {
+                    icon = UserIcons.getDefaultUserIcon(userInfo.id, /* light= */ false);
+                }
             }
         }
     }
index 466944d..60bf226 100644 (file)
@@ -70,6 +70,8 @@ import android.view.ViewGroup;
 import android.widget.ListView;
 import android.widget.TabWidget;
 
+import com.android.internal.util.ImageUtils;
+import com.android.internal.util.UserIcons;
 import com.android.settings.UserSpinnerAdapter.UserDetails;
 import com.android.settings.dashboard.DashboardCategory;
 import com.android.settings.dashboard.DashboardTile;
@@ -847,10 +849,13 @@ public final class Utils {
      * Returns a circular icon for a user.
      */
     public static Drawable getUserIcon(Context context, UserManager um, UserInfo user) {
-        if (user.iconPath == null) return null;
-        Bitmap icon = um.getUserIcon(user.id);
-        if (icon == null) return null;
-        return CircleFramedDrawable.getInstance(context, icon);
+        if (user.iconPath != null) {
+            Bitmap icon = um.getUserIcon(user.id);
+            if (icon != null) {
+                return CircleFramedDrawable.getInstance(context, icon);
+            }
+        }
+        return UserIcons.getDefaultUserIcon(user.id, /* light= */ false);
     }
 
     /**
index f68dace..97c96a0 100644 (file)
@@ -107,7 +107,7 @@ public class CircleFramedDrawable extends Drawable {
         canvas.drawPath(fillPath, mPaint);
 
         // mask in the icon where the bitmap is opaque
-        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
+        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
         canvas.drawBitmap(icon, cropRect, circleRect, mPaint);
 
         // prepare paint for frame drawing
index f5ea6aa..0d7b279 100644 (file)
 
 package com.android.settings.users;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.app.Activity;
@@ -37,7 +33,6 @@ import android.content.SharedPreferences;
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
-import android.graphics.Canvas;
 import android.graphics.drawable.Drawable;
 import android.os.AsyncTask;
 import android.os.Bundle;
@@ -60,6 +55,7 @@ import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.SimpleAdapter;
 
+import com.android.internal.util.UserIcons;
 import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.ChooseLockGeneric;
 import com.android.settings.OwnerInfoSettings;
@@ -70,6 +66,10 @@ import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.Utils;
 import com.android.settings.drawable.CircleFramedDrawable;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * Screen that manages the list of users on the device.
  * Guest user is an always visible entry, even if the guest is not currently
@@ -119,19 +119,6 @@ public class UserSettings extends SettingsPreferenceFragment
     private static final String KEY_ADD_USER_LONG_MESSAGE_DISPLAYED =
             "key_add_user_long_message_displayed";
 
-    static final int[] USER_DRAWABLES = {
-        R.drawable.ic_avatar_default_1,
-        R.drawable.ic_avatar_default_2,
-        R.drawable.ic_avatar_default_3,
-        R.drawable.ic_avatar_default_4,
-        R.drawable.ic_avatar_default_5,
-        R.drawable.ic_avatar_default_6,
-        R.drawable.ic_avatar_default_7,
-        R.drawable.ic_avatar_default_8
-    };
-
-    private static final int GUEST_DRAWABLE_ID = R.drawable.ic_avatar_guest;
-
     private static final String KEY_TITLE = "title";
     private static final String KEY_SUMMARY = "summary";
 
@@ -154,10 +141,8 @@ public class UserSettings extends SettingsPreferenceFragment
     private EditUserInfoController mEditUserInfoController =
             new EditUserInfoController();
 
-    // A place to cache the generated guest avatar
-    private Drawable mGuestDrawable;
     // A place to cache the generated default avatar
-    private Drawable mDefaultAvatarDrawable;
+    private Drawable mDefaultIconDrawable;
 
     private Handler mHandler = new Handler() {
         @Override
@@ -325,7 +310,7 @@ public class UserSettings extends SettingsPreferenceFragment
     private void loadProfile() {
         if (mIsGuest) {
             // No need to load profile information
-            mMePreference.setIcon(getEncircledGuestDrawable());
+            mMePreference.setIcon(getEncircledDefaultIcon());
             mMePreference.setTitle(R.string.user_exit_guest_title);
             return;
         }
@@ -423,9 +408,7 @@ public class UserSettings extends SettingsPreferenceFragment
         Secure.putIntForUser(getContentResolver(),
                 Secure.LOCATION_MODE, Secure.LOCATION_MODE_OFF, userId);
         mUserManager.setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, true, user);
-        Bitmap bitmap = createBitmapFromDrawable(
-                USER_DRAWABLES[userId % UserSettings.USER_DRAWABLES.length]);
-        mUserManager.setUserIcon(userId, bitmap);
+        assignDefaultPhoto(newUserInfo);
         // Add shared accounts
         AccountManager am = AccountManager.get(getActivity());
         Account [] accounts = am.getAccounts();
@@ -437,15 +420,6 @@ public class UserSettings extends SettingsPreferenceFragment
         return newUserInfo;
     }
 
-    private Bitmap createBitmapFromDrawable(int resId) {
-        Drawable icon = getResources().getDrawable(resId);
-        icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
-        Bitmap bitmap = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(),
-                Bitmap.Config.ARGB_8888);
-        icon.draw(new Canvas(bitmap));
-        return bitmap;
-    }
-
     private UserInfo createTrustedUser() {
         UserInfo newUserInfo = mUserManager.createUser(
                 getResources().getString(R.string.user_new_user_name), 0);
@@ -787,13 +761,15 @@ public class UserSettings extends SettingsPreferenceFragment
             }
             if (user.iconPath != null) {
                 if (mUserIcons.get(user.id) == null) {
+                    // Icon not loaded yet, print a placeholder
                     missingIcons.add(user.id);
-                    pref.setIcon(getEncircledDefaultAvatar());
+                    pref.setIcon(getEncircledDefaultIcon());
                 } else {
                     setPhotoId(pref, user);
                 }
             } else {
-                pref.setIcon(getEncircledDefaultAvatar());
+                // Icon not available yet, print a placeholder
+                pref.setIcon(getEncircledDefaultIcon());
             }
         }
 
@@ -803,7 +779,7 @@ public class UserSettings extends SettingsPreferenceFragment
                     null, null);
             pref.setEnabled(false);
             pref.setTitle(R.string.user_new_user_name);
-            pref.setIcon(getEncircledDefaultAvatar());
+            pref.setIcon(getEncircledDefaultIcon());
             mUserListCategory.addPreference(pref);
         }
 
@@ -826,7 +802,7 @@ public class UserSettings extends SettingsPreferenceFragment
                     mIsOwner && voiceCapable? this : null /* settings icon handler */,
                     null /* delete icon handler */);
             pref.setTitle(R.string.user_guest);
-            pref.setIcon(getEncircledGuestDrawable());
+            pref.setIcon(getEncircledDefaultIcon());
             pref.setOnPreferenceClickListener(this);
             mUserListCategory.addPreference(pref);
         }
@@ -854,7 +830,8 @@ public class UserSettings extends SettingsPreferenceFragment
                 for (int userId : values[0]) {
                     Bitmap bitmap = mUserManager.getUserIcon(userId);
                     if (bitmap == null) {
-                        bitmap = createBitmapFromDrawable(R.drawable.ic_avatar_default_1);
+                        bitmap = UserIcons.convertToBitmap(UserIcons.getDefaultUserIcon(userId,
+                                /* light= */ false));
                     }
                     mUserIcons.append(userId, bitmap);
                 }
@@ -870,24 +847,17 @@ public class UserSettings extends SettingsPreferenceFragment
     }
 
     private void assignDefaultPhoto(UserInfo user) {
-        Bitmap bitmap = createBitmapFromDrawable(
-                USER_DRAWABLES[user.id % UserSettings.USER_DRAWABLES.length]);
+        Bitmap bitmap = UserIcons.convertToBitmap(UserIcons.getDefaultUserIcon(user.id,
+                /* light= */ false));
         mUserManager.setUserIcon(user.id, bitmap);
     }
 
-    private Drawable getEncircledGuestDrawable() {
-        if (mGuestDrawable == null) {
-            mGuestDrawable = encircle(createBitmapFromDrawable(GUEST_DRAWABLE_ID));
-        }
-        return mGuestDrawable;
-    }
-
-    private Drawable getEncircledDefaultAvatar() {
-        if (mDefaultAvatarDrawable == null) {
-            mDefaultAvatarDrawable =
-                    encircle(createBitmapFromDrawable(R.drawable.ic_avatar_default_1));
+    private Drawable getEncircledDefaultIcon() {
+        if (mDefaultIconDrawable == null) {
+            mDefaultIconDrawable = encircle(UserIcons.convertToBitmap(
+                    UserIcons.getDefaultUserIcon(UserHandle.USER_NULL, /* light= */ false)));
         }
-        return mDefaultAvatarDrawable;
+        return mDefaultIconDrawable;
     }
 
     private void setPhotoId(Preference pref, UserInfo user) {