am 35ae7a0a: am f4874b74: am 2ed576fa: am 66b73dce: am f5e20ec3: Merge "Retrieve resources for apps, even if not installed for current user." into mnc-dev
* commit '35ae7a0a8d66c6a19ec82150a60a23730639f382':
Retrieve resources for apps, even if not installed for current user.
diff --git a/graphics/java/android/graphics/drawable/Icon.java b/graphics/java/android/graphics/drawable/Icon.java
index 7c9b30b..26232a9 100644
--- a/graphics/java/android/graphics/drawable/Icon.java
+++ b/graphics/java/android/graphics/drawable/Icon.java
@@ -21,6 +21,7 @@
import android.content.res.ColorStateList;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -294,7 +295,13 @@
} else {
final PackageManager pm = context.getPackageManager();
try {
- mObj1 = pm.getResourcesForApplication(resPackage);
+ ApplicationInfo ai = pm.getApplicationInfo(
+ resPackage, PackageManager.GET_UNINSTALLED_PACKAGES);
+ if (ai != null) {
+ mObj1 = pm.getResourcesForApplication(ai);
+ } else {
+ break;
+ }
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, String.format("Unable to find pkg=%s for icon %s",
resPackage, this), e);