am 30c50b15: Use correct API for badging

* commit '30c50b15d0d716567c71d590aa835dc4a27591d6':
  Use correct API for badging
This commit is contained in:
Amith Yamasani
2014-09-07 23:05:42 +00:00
committed by Android Git Automerger
4 changed files with 8 additions and 9 deletions

View File

@@ -304,8 +304,8 @@ public class DeviceAdminSettings extends ListFragment {
final Activity activity = getActivity(); final Activity activity = getActivity();
ViewHolder vh = (ViewHolder) view.getTag(); ViewHolder vh = (ViewHolder) view.getTag();
Drawable activityIcon = item.loadIcon(activity.getPackageManager()); Drawable activityIcon = item.loadIcon(activity.getPackageManager());
Drawable badgedIcon = activity.getPackageManager().getUserBadgedDrawableForDensity( Drawable badgedIcon = activity.getPackageManager().getUserBadgedIcon(
activityIcon, new UserHandle(getUserId(item)), null, 0); activityIcon, new UserHandle(getUserId(item)));
vh.icon.setImageDrawable(badgedIcon); vh.icon.setImageDrawable(badgedIcon);
vh.name.setText(item.loadLabel(activity.getPackageManager())); vh.name.setText(item.loadLabel(activity.getPackageManager()));
vh.checkbox.setChecked(isActiveAdmin(item)); vh.checkbox.setChecked(isActiveAdmin(item));

View File

@@ -104,8 +104,8 @@ final public class AuthenticatorHelper extends BroadcastReceiver {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType); AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
Context authContext = context.createPackageContextAsUser(desc.packageName, 0, Context authContext = context.createPackageContextAsUser(desc.packageName, 0,
mUserHandle); mUserHandle);
icon = mContext.getPackageManager().getUserBadgedDrawableForDensity( icon = mContext.getPackageManager().getUserBadgedIcon(
authContext.getResources().getDrawable(desc.iconId), mUserHandle, null, 0); authContext.getResources().getDrawable(desc.iconId), mUserHandle);
synchronized (mAccTypeIconCache) { synchronized (mAccTypeIconCache) {
mAccTypeIconCache.put(accountType, icon); mAccTypeIconCache.put(accountType, icon);
} }

View File

@@ -215,8 +215,8 @@ public class ChooseAccountActivity extends PreferenceActivity {
try { try {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType); AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
Context authContext = createPackageContextAsUser(desc.packageName, 0, mUserHandle); Context authContext = createPackageContextAsUser(desc.packageName, 0, mUserHandle);
icon = getPackageManager().getUserBadgedDrawableForDensity( icon = getPackageManager().getUserBadgedIcon(
authContext.getResources().getDrawable(desc.iconId), mUserHandle, null, 0); authContext.getResources().getDrawable(desc.iconId), mUserHandle);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
// TODO: place holder icon for missing account icons? // TODO: place holder icon for missing account icons?
Log.w(TAG, "No icon name for account type " + accountType); Log.w(TAG, "No icon name for account type " + accountType);

View File

@@ -212,10 +212,9 @@ public class RecentLocationApps {
final UserHandle userHandle = new UserHandle(userId); final UserHandle userHandle = new UserHandle(userId);
Drawable appIcon = mPackageManager.getApplicationIcon(appInfo); Drawable appIcon = mPackageManager.getApplicationIcon(appInfo);
Drawable icon = mPackageManager.getUserBadgedDrawableForDensity(appIcon, userHandle, Drawable icon = mPackageManager.getUserBadgedIcon(appIcon, userHandle);
null, 0);
CharSequence appLabel = mPackageManager.getApplicationLabel(appInfo); CharSequence appLabel = mPackageManager.getApplicationLabel(appInfo);
CharSequence badgedAppLabel = um.getBadgedLabelForUser(appLabel.toString(), userHandle); CharSequence badgedAppLabel = mPackageManager.getUserBadgedLabel(appLabel, userHandle);
preference = createRecentLocationEntry(icon, preference = createRecentLocationEntry(icon,
appLabel, highBattery, badgedAppLabel, appLabel, highBattery, badgedAppLabel,
new PackageEntryClickedListener(packageName)); new PackageEntryClickedListener(packageName));