Loading core/java/android/content/pm/ResolveInfo.java +41 −29 Original line number Diff line number Diff line Loading @@ -116,7 +116,8 @@ public class ResolveInfo implements Parcelable { /** * A drawable resource identifier (in the package's resources) of this * match's icon. From the "icon" attribute or, if not set, 0. * match's icon. From the "icon" attribute or, if not set, 0. It is * set only if the icon can be obtained by resource id alone. */ public int icon; Loading @@ -134,10 +135,20 @@ public class ResolveInfo implements Parcelable { public int targetUserId; /** * Set to true if the icon cannot be obtained by resource ids alone. * It is set to true for ResolveInfos from the managed profile: They need to * have their icon badged, so it cannot be obtained by resource ids alone. * @hide */ public boolean noResourceId; /** * Same as {@link #icon} but it will always correspond to "icon" attribute * regardless of {@link #noResourceId} value. * @hide */ public int iconResourceId; /** * @hide Target comes from system process? */ Loading Loading @@ -204,20 +215,17 @@ public class ResolveInfo implements Parcelable { * item does not have an icon, the default activity icon is returned. */ public Drawable loadIcon(PackageManager pm) { Drawable dr; if (resolvePackageName != null && icon != 0) { dr = pm.getDrawable(resolvePackageName, icon, null); if (dr != null) { return dr; } Drawable dr = null; if (resolvePackageName != null && iconResourceId != 0) { dr = pm.getDrawable(resolvePackageName, iconResourceId, null); } ComponentInfo ci = getComponentInfo(); if (dr == null && iconResourceId != 0) { ApplicationInfo ai = ci.applicationInfo; if (icon != 0) { dr = pm.getDrawable(ci.packageName, icon, ai); if (dr != null) { return dr; dr = pm.getDrawable(ci.packageName, iconResourceId, ai); } if (dr != null) { return pm.getUserBadgedIcon(dr, new UserHandle(UserHandle.myUserId())); } return ci.loadIcon(pm); } Loading @@ -231,7 +239,7 @@ public class ResolveInfo implements Parcelable { * @return The icon associated with this match. */ final int getIconResourceInternal() { if (icon != 0) return icon; if (iconResourceId != 0) return iconResourceId; final ComponentInfo ci = getComponentInfo(); if (ci != null) { return ci.getIconResource(); Loading Loading @@ -298,6 +306,8 @@ public class ResolveInfo implements Parcelable { nonLocalizedLabel = orig.nonLocalizedLabel; icon = orig.icon; resolvePackageName = orig.resolvePackageName; noResourceId = orig.noResourceId; iconResourceId = orig.iconResourceId; system = orig.system; targetUserId = orig.targetUserId; handleAllWebDataURI = orig.handleAllWebDataURI; Loading Loading @@ -362,6 +372,7 @@ public class ResolveInfo implements Parcelable { dest.writeInt(targetUserId); dest.writeInt(system ? 1 : 0); dest.writeInt(noResourceId ? 1 : 0); dest.writeInt(iconResourceId); dest.writeInt(handleAllWebDataURI ? 1 : 0); } Loading Loading @@ -408,6 +419,7 @@ public class ResolveInfo implements Parcelable { targetUserId = source.readInt(); system = source.readInt() != 0; noResourceId = source.readInt() != 0; iconResourceId = source.readInt(); handleAllWebDataURI = source.readInt() != 0; } Loading core/java/com/android/internal/app/ChooserActivity.java +5 −3 Original line number Diff line number Diff line Loading @@ -613,15 +613,17 @@ public class ChooserActivity extends ResolverActivity { ri.activityInfo = ai; UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); if (userManager.isManagedProfile()) { ri.noResourceId = true; } if (ii instanceof LabeledIntent) { LabeledIntent li = (LabeledIntent)ii; ri.resolvePackageName = li.getSourcePackage(); ri.labelRes = li.getLabelResource(); ri.nonLocalizedLabel = li.getNonLocalizedLabel(); ri.icon = li.getIconResource(); ri.iconResourceId = ri.icon; } if (userManager.isManagedProfile()) { ri.noResourceId = true; ri.icon = 0; } mCallerTargets.add(new DisplayResolveInfo(ii, ri, ri.loadLabel(pm), null, ii)); Loading core/java/com/android/internal/app/ResolverActivity.java +5 −3 Original line number Diff line number Diff line Loading @@ -1186,15 +1186,17 @@ public class ResolverActivity extends Activity { ri.activityInfo = ai; UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); if (userManager.isManagedProfile()) { ri.noResourceId = true; } if (ii instanceof LabeledIntent) { LabeledIntent li = (LabeledIntent)ii; ri.resolvePackageName = li.getSourcePackage(); ri.labelRes = li.getLabelResource(); ri.nonLocalizedLabel = li.getNonLocalizedLabel(); ri.icon = li.getIconResource(); ri.iconResourceId = ri.icon; } if (userManager.isManagedProfile()) { ri.noResourceId = true; ri.icon = 0; } addResolveInfo(new DisplayResolveInfo(ii, ri, ri.loadLabel(getPackageManager()), null, ii)); Loading services/core/java/com/android/server/pm/PackageManagerService.java +1 −0 Original line number Diff line number Diff line Loading @@ -8253,6 +8253,7 @@ public class PackageManagerService extends IPackageManager.Stub { } else { res.icon = info.icon; } res.iconResourceId = info.icon; res.system = res.activityInfo.applicationInfo.isSystemApp(); return res; } Loading Loading
core/java/android/content/pm/ResolveInfo.java +41 −29 Original line number Diff line number Diff line Loading @@ -116,7 +116,8 @@ public class ResolveInfo implements Parcelable { /** * A drawable resource identifier (in the package's resources) of this * match's icon. From the "icon" attribute or, if not set, 0. * match's icon. From the "icon" attribute or, if not set, 0. It is * set only if the icon can be obtained by resource id alone. */ public int icon; Loading @@ -134,10 +135,20 @@ public class ResolveInfo implements Parcelable { public int targetUserId; /** * Set to true if the icon cannot be obtained by resource ids alone. * It is set to true for ResolveInfos from the managed profile: They need to * have their icon badged, so it cannot be obtained by resource ids alone. * @hide */ public boolean noResourceId; /** * Same as {@link #icon} but it will always correspond to "icon" attribute * regardless of {@link #noResourceId} value. * @hide */ public int iconResourceId; /** * @hide Target comes from system process? */ Loading Loading @@ -204,20 +215,17 @@ public class ResolveInfo implements Parcelable { * item does not have an icon, the default activity icon is returned. */ public Drawable loadIcon(PackageManager pm) { Drawable dr; if (resolvePackageName != null && icon != 0) { dr = pm.getDrawable(resolvePackageName, icon, null); if (dr != null) { return dr; } Drawable dr = null; if (resolvePackageName != null && iconResourceId != 0) { dr = pm.getDrawable(resolvePackageName, iconResourceId, null); } ComponentInfo ci = getComponentInfo(); if (dr == null && iconResourceId != 0) { ApplicationInfo ai = ci.applicationInfo; if (icon != 0) { dr = pm.getDrawable(ci.packageName, icon, ai); if (dr != null) { return dr; dr = pm.getDrawable(ci.packageName, iconResourceId, ai); } if (dr != null) { return pm.getUserBadgedIcon(dr, new UserHandle(UserHandle.myUserId())); } return ci.loadIcon(pm); } Loading @@ -231,7 +239,7 @@ public class ResolveInfo implements Parcelable { * @return The icon associated with this match. */ final int getIconResourceInternal() { if (icon != 0) return icon; if (iconResourceId != 0) return iconResourceId; final ComponentInfo ci = getComponentInfo(); if (ci != null) { return ci.getIconResource(); Loading Loading @@ -298,6 +306,8 @@ public class ResolveInfo implements Parcelable { nonLocalizedLabel = orig.nonLocalizedLabel; icon = orig.icon; resolvePackageName = orig.resolvePackageName; noResourceId = orig.noResourceId; iconResourceId = orig.iconResourceId; system = orig.system; targetUserId = orig.targetUserId; handleAllWebDataURI = orig.handleAllWebDataURI; Loading Loading @@ -362,6 +372,7 @@ public class ResolveInfo implements Parcelable { dest.writeInt(targetUserId); dest.writeInt(system ? 1 : 0); dest.writeInt(noResourceId ? 1 : 0); dest.writeInt(iconResourceId); dest.writeInt(handleAllWebDataURI ? 1 : 0); } Loading Loading @@ -408,6 +419,7 @@ public class ResolveInfo implements Parcelable { targetUserId = source.readInt(); system = source.readInt() != 0; noResourceId = source.readInt() != 0; iconResourceId = source.readInt(); handleAllWebDataURI = source.readInt() != 0; } Loading
core/java/com/android/internal/app/ChooserActivity.java +5 −3 Original line number Diff line number Diff line Loading @@ -613,15 +613,17 @@ public class ChooserActivity extends ResolverActivity { ri.activityInfo = ai; UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); if (userManager.isManagedProfile()) { ri.noResourceId = true; } if (ii instanceof LabeledIntent) { LabeledIntent li = (LabeledIntent)ii; ri.resolvePackageName = li.getSourcePackage(); ri.labelRes = li.getLabelResource(); ri.nonLocalizedLabel = li.getNonLocalizedLabel(); ri.icon = li.getIconResource(); ri.iconResourceId = ri.icon; } if (userManager.isManagedProfile()) { ri.noResourceId = true; ri.icon = 0; } mCallerTargets.add(new DisplayResolveInfo(ii, ri, ri.loadLabel(pm), null, ii)); Loading
core/java/com/android/internal/app/ResolverActivity.java +5 −3 Original line number Diff line number Diff line Loading @@ -1186,15 +1186,17 @@ public class ResolverActivity extends Activity { ri.activityInfo = ai; UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); if (userManager.isManagedProfile()) { ri.noResourceId = true; } if (ii instanceof LabeledIntent) { LabeledIntent li = (LabeledIntent)ii; ri.resolvePackageName = li.getSourcePackage(); ri.labelRes = li.getLabelResource(); ri.nonLocalizedLabel = li.getNonLocalizedLabel(); ri.icon = li.getIconResource(); ri.iconResourceId = ri.icon; } if (userManager.isManagedProfile()) { ri.noResourceId = true; ri.icon = 0; } addResolveInfo(new DisplayResolveInfo(ii, ri, ri.loadLabel(getPackageManager()), null, ii)); Loading
services/core/java/com/android/server/pm/PackageManagerService.java +1 −0 Original line number Diff line number Diff line Loading @@ -8253,6 +8253,7 @@ public class PackageManagerService extends IPackageManager.Stub { } else { res.icon = info.icon; } res.iconResourceId = info.icon; res.system = res.activityInfo.applicationInfo.isSystemApp(); return res; } Loading