diff options
author | Julia Reynolds <juliacr@google.com> | 2015-07-14 09:24:22 -0400 |
---|---|---|
committer | Julia Reynolds <juliacr@google.com> | 2015-07-14 09:24:22 -0400 |
commit | c7fd3462a2699f73d5f2ba6d863d8be4ddd570a9 (patch) | |
tree | aed0e806ebcaaa4aba70e311604643aeab9496d4 /graphics/java | |
parent | 208934ff010cc2aff7d8fee9237d6cee0e5bb563 (diff) | |
download | frameworks_base-c7fd3462a2699f73d5f2ba6d863d8be4ddd570a9.zip frameworks_base-c7fd3462a2699f73d5f2ba6d863d8be4ddd570a9.tar.gz frameworks_base-c7fd3462a2699f73d5f2ba6d863d8be4ddd570a9.tar.bz2 |
Retrieve resources for apps, even if not installed for current user.
Bug: 21448052
Change-Id: Id5db428a6faca4a905684088c47e070752ac2899
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/drawable/Icon.java | 9 |
1 files changed, 8 insertions, 1 deletions
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.annotation.DrawableRes; 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 @@ public final class Icon implements Parcelable { } 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); |