am f5e20ec3: Merge "Retrieve resources for apps, even if not installed for current user." into mnc-dev
* commit 'f5e20ec36480897f4c37fd63554872e74d874f02': Retrieve resources for apps, even if not installed for current user.
This commit is contained in:
@@ -21,6 +21,7 @@ import android.annotation.DrawableRes;
|
|||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@@ -294,7 +295,13 @@ public final class Icon implements Parcelable {
|
|||||||
} else {
|
} else {
|
||||||
final PackageManager pm = context.getPackageManager();
|
final PackageManager pm = context.getPackageManager();
|
||||||
try {
|
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) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e(TAG, String.format("Unable to find pkg=%s for icon %s",
|
Log.e(TAG, String.format("Unable to find pkg=%s for icon %s",
|
||||||
resPackage, this), e);
|
resPackage, this), e);
|
||||||
|
|||||||
Reference in New Issue
Block a user