Loading src/com/android/settings/Utils.java +0 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,6 @@ import android.net.Uri; import android.os.BatteryManager; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor.AutoCloseOutputStream; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.preference.Preference; Loading src/com/android/settings/fuelgauge/PowerUsageSummary.java +2 −5 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.internal.os.BatteryStatsImpl; import com.android.internal.os.PowerProfile; import com.android.settings.R; import com.android.settings.fuelgauge.PowerUsageDetail.DrainType; import com.android.settings.users.UserUtils; import java.io.PrintWriter; import java.io.StringWriter; Loading Loading @@ -768,11 +769,7 @@ public class PowerUsageSummary extends PreferenceFragment implements Runnable { UserInfo info = mUm.getUserInfo(userId); Drawable icon = null; if (info != null && info.iconPath != null) { try { icon = Drawable.createFromPath(info.iconPath); } catch (Exception e) { Log.w(TAG, "Failure loading user picture " + info.iconPath, e); } icon = UserUtils.getUserIcon(mUm, info); } String name = info != null ? info.name : null; if (name == null) { Loading src/com/android/settings/users/UserSettings.java +4 −5 Original line number Diff line number Diff line Loading @@ -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) { Loading src/com/android/settings/users/UserUtils.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * 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; } } Loading
src/com/android/settings/Utils.java +0 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,6 @@ import android.net.Uri; import android.os.BatteryManager; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor.AutoCloseOutputStream; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.preference.Preference; Loading
src/com/android/settings/fuelgauge/PowerUsageSummary.java +2 −5 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.internal.os.BatteryStatsImpl; import com.android.internal.os.PowerProfile; import com.android.settings.R; import com.android.settings.fuelgauge.PowerUsageDetail.DrainType; import com.android.settings.users.UserUtils; import java.io.PrintWriter; import java.io.StringWriter; Loading Loading @@ -768,11 +769,7 @@ public class PowerUsageSummary extends PreferenceFragment implements Runnable { UserInfo info = mUm.getUserInfo(userId); Drawable icon = null; if (info != null && info.iconPath != null) { try { icon = Drawable.createFromPath(info.iconPath); } catch (Exception e) { Log.w(TAG, "Failure loading user picture " + info.iconPath, e); } icon = UserUtils.getUserIcon(mUm, info); } String name = info != null ? info.name : null; if (name == null) { Loading
src/com/android/settings/users/UserSettings.java +4 −5 Original line number Diff line number Diff line Loading @@ -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) { Loading
src/com/android/settings/users/UserUtils.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * 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; } }