Using a common class for loading drawables and handling various badging

Test: make RunSettingsRoboTests -j31
Bug: 36591157

Change-Id: I4cb1d313920d5d8604fd79ff65b40e2dda180e2e
This commit is contained in:
Sunny Goyal
2017-04-12 15:53:30 -07:00
parent cf172040a9
commit 3b172d7b89
12 changed files with 37 additions and 116 deletions

View File

@@ -16,17 +16,29 @@
package android.util;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
/**
* This class is only needed to get around RoboElectric issue.
* This class is only needed to get around Robolectric issue.
*/
public final class LauncherIcons {
public class IconDrawableFactory {
public LauncherIcons(Context context) {
public static IconDrawableFactory newInstance(Context context) {
return new IconDrawableFactory();
}
public Drawable wrapIconDrawableWithShadow(Drawable drawable) {
return drawable;
public Drawable getBadgedIcon(ApplicationInfo appInfo) {
return getBadgedIcon(appInfo, 0);
}
public Drawable getBadgedIcon(ApplicationInfo appInfo, int userId) {
return getBadgedIcon(appInfo, appInfo, userId);
}
public Drawable getBadgedIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo, int userId) {
return new ColorDrawable(0);
}
}