Commit 1d6d41dd authored by Svetoslav's avatar Svetoslav
Browse files

Update Launcher2 due to API changes.

bug:17390424

Change-Id: I36e420b8a71058373e9fa00d0376784594a4c5be
parent 7ff00975
......@@ -30,8 +30,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import java.util.HashMap;
......@@ -74,7 +72,6 @@ public class IconCache {
private final Bitmap mDefaultIcon;
private final LauncherApplication mContext;
private final PackageManager mPackageManager;
private final UserManager mUserManager;
private final HashMap<CacheKey, CacheEntry> mCache =
new HashMap<CacheKey, CacheEntry>(INITIAL_ICON_CACHE_CAPACITY);
private int mIconDpi;
......@@ -86,7 +83,6 @@ public class IconCache {
mContext = context;
mPackageManager = context.getPackageManager();
mIconDpi = activityManager.getLauncherLargeIconDensity();
mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
// need to set mIconDpi before getting default icon
mDefaultIcon = makeDefaultIcon();
}
......@@ -107,7 +103,7 @@ public class IconCache {
if (d == null) {
d = getFullResDefaultActivityIcon();
}
return mUserManager.getBadgedIconForUser(d, user);
return mPackageManager.getUserBadgedIcon(d, user);
}
public Drawable getFullResIcon(String packageName, int iconId, UserHandle user) {
......@@ -248,7 +244,7 @@ public class IconCache {
if (entry.title == null) {
entry.title = info.getComponentName().getShortClassName();
}
entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
entry.contentDescription = mPackageManager.getUserBadgedLabel(entry.title, user);
entry.icon = Utilities.createIconBitmap(info.getBadgedIcon(mIconDpi), mContext);
}
return entry;
......
......@@ -2259,7 +2259,7 @@ public class LauncherModel extends BroadcastReceiver {
info.title = componentName.getClassName();
}
info.contentDescription = mUserManager.getBadgedLabelForUser(info.title, user);
info.contentDescription = mApp.getPackageManager().getUserBadgedLabel(info.title, user);
info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
return info;
}
......@@ -2296,7 +2296,7 @@ public class LauncherModel extends BroadcastReceiver {
// TODO: If there's an explicit component and we can't install that, delete it.
info.title = c.getString(titleIndex);
info.contentDescription = mUserManager.getBadgedLabelForUser(
info.contentDescription = mApp.getPackageManager().getUserBadgedLabel(
info.title, info.user);
int iconType = c.getInt(iconTypeIndex);
......@@ -2479,7 +2479,7 @@ public class LauncherModel extends BroadcastReceiver {
info.setIcon(icon);
info.title = name;
info.contentDescription = mUserManager.getBadgedLabelForUser(name, info.user);
info.contentDescription = mApp.getPackageManager().getUserBadgedLabel(name, info.user);
info.intent = intent;
info.customIcon = customIcon;
info.iconResource = iconResource;
......
......@@ -27,7 +27,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.UserManager;
import android.view.View;
import com.android.launcher.R;
......@@ -602,11 +601,9 @@ public class WidgetPreviewLoader {
}
// Badge the preview.
UserManager userManager = (UserManager) mContext.getSystemService(
Context.USER_SERVICE);
BitmapDrawable previewDrawable = new BitmapDrawable(
mContext.getResources(), preview);
Drawable badgedPreviewDrawable = userManager.getBadgedDrawableForUser(
Drawable badgedPreviewDrawable = mContext.getPackageManager().getUserBadgedDrawableForDensity(
previewDrawable, info.getProfile(), badgeLocation, 0);
// Reture the nadged bitmap.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment