summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/users
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2012-09-17 10:21:27 -0700
committerAmith Yamasani <yamasani@google.com>2012-09-17 12:39:41 -0700
commite940dac47a1d978211eea973fe8576edc4626d48 (patch)
tree0f076f9e3413d665da88cfc9947e176ff007207b /src/com/android/settings/users
parentbdb9fc8687fe6fbe7ed9d1222dba21794206c415 (diff)
downloadpackages_apps_settings-e940dac47a1d978211eea973fe8576edc4626d48.zip
packages_apps_settings-e940dac47a1d978211eea973fe8576edc4626d48.tar.gz
packages_apps_settings-e940dac47a1d978211eea973fe8576edc4626d48.tar.bz2
Use UserManager.getUserIcon() to get the user's avatar.
Change-Id: I035a5e2a518eb827a2e44910471ed04923921aa3
Diffstat (limited to 'src/com/android/settings/users')
-rw-r--r--src/com/android/settings/users/UserSettings.java9
-rw-r--r--src/com/android/settings/users/UserUtils.java34
2 files changed, 38 insertions, 5 deletions
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 11948b4..3c7addc 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -418,11 +418,10 @@ public class UserSettings extends SettingsPreferenceFragment
}
private void setPhotoId(Preference pref, UserInfo user) {
- ParcelFileDescriptor fd = mUserManager.setUserIcon(user.id);
- Drawable d = Drawable.createFromStream(new ParcelFileDescriptor.AutoCloseInputStream(fd),
- user.iconPath);
- if (d == null) return;
- pref.setIcon(d);
+ Drawable icon = UserUtils.getUserIcon(mUserManager, user);
+ if (icon != null) {
+ pref.setIcon(icon);
+ }
}
private void setUserName(String name) {
diff --git a/src/com/android/settings/users/UserUtils.java b/src/com/android/settings/users/UserUtils.java
new file mode 100644
index 0000000..19b9c84
--- /dev/null
+++ b/src/com/android/settings/users/UserUtils.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+package com.android.settings.users;
+
+import android.content.pm.UserInfo;
+import android.graphics.drawable.Drawable;
+import android.os.ParcelFileDescriptor;
+import android.os.UserManager;
+
+public class UserUtils {
+
+ public static Drawable getUserIcon(UserManager um, UserInfo user) {
+ if (user.iconPath == null) return null;
+ ParcelFileDescriptor fd = um.getUserIcon(user.id);
+ if (fd == null) return null;
+ Drawable d = Drawable.createFromStream(new ParcelFileDescriptor.AutoCloseInputStream(fd),
+ user.iconPath);
+ return d;
+ }
+}