1e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani/* 2e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * Copyright (C) 2012 The Android Open Source Project 3e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * 4e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * Licensed under the Apache License, Version 2.0 (the "License"); 5e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * you may not use this file except in compliance with the License. 6e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * You may obtain a copy of the License at 7e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * 8e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * http://www.apache.org/licenses/LICENSE-2.0 9e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * 10e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * Unless required by applicable law or agreed to in writing, software 11e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * distributed under the License is distributed on an "AS IS" BASIS, 12e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * See the License for the specific language governing permissions and 14e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani * limitations under the License. 15e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani */ 16e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani 17e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasanipackage com.android.settings.users; 18e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani 19b0b0b110c04ddbbe5e2651dcb1a6f13551c61fb8Amith Yamasaniimport android.content.Context; 20e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasaniimport android.content.pm.UserInfo; 218882ccdd3eafc338213b312f1b73fb4de1776a60Jeff Sharkeyimport android.content.res.Resources; 22f34a85d5d54738b4b6d091c36f828788ff67ede1Amith Yamasaniimport android.graphics.Bitmap; 23f34a85d5d54738b4b6d091c36f828788ff67ede1Amith Yamasaniimport android.graphics.drawable.BitmapDrawable; 24e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasaniimport android.graphics.drawable.Drawable; 25e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasaniimport android.os.UserManager; 26e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani 27e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasanipublic class UserUtils { 28b0b0b110c04ddbbe5e2651dcb1a6f13551c61fb8Amith Yamasani public static Drawable getUserIcon(Context context, UserManager um, UserInfo user, Resources res) { 29e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani if (user.iconPath == null) return null; 30f34a85d5d54738b4b6d091c36f828788ff67ede1Amith Yamasani Bitmap icon = um.getUserIcon(user.id); 31f34a85d5d54738b4b6d091c36f828788ff67ede1Amith Yamasani if (icon == null) return null; 32b0b0b110c04ddbbe5e2651dcb1a6f13551c61fb8Amith Yamasani return CircleFramedDrawable.getInstance(context, icon); 33e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani } 34e940dac47a1d978211eea973fe8576edc4626d48Amith Yamasani} 35