Loading core/java/android/content/pm/ResolveInfo.java +34 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,40 @@ public class ResolveInfo implements Parcelable { return data; } /** * @return The resource that would be used when loading * the label for this resolve info. * * @hide */ public int resolveLabelResId() { if (labelRes != 0) { return labelRes; } final ComponentInfo componentInfo = getComponentInfo(); if (componentInfo.labelRes != 0) { return componentInfo.labelRes; } return componentInfo.applicationInfo.labelRes; } /** * @return The resource that would be used when loading * the icon for this resolve info. * * @hide */ public int resolveIconResId() { if (icon != 0) { return icon; } final ComponentInfo componentInfo = getComponentInfo(); if (componentInfo.icon != 0) { return componentInfo.icon; } return componentInfo.applicationInfo.icon; } /** * Retrieve the current graphical icon associated with this resolution. This * will call back on the given PackageManager to load the icon from Loading services/core/java/com/android/server/pm/PackageManagerService.java +18 −3 Original line number Diff line number Diff line Loading @@ -7589,6 +7589,13 @@ public class PackageManagerService extends IPackageManager.Stub && info.activityInfo.splitName != null && !ArrayUtils.contains(info.activityInfo.applicationInfo.splitNames, info.activityInfo.splitName)) { if (mInstantAppInstallerInfo == null) { if (DEBUG_INSTALL) { Slog.v(TAG, "No installer - not adding it to the ResolveInfo list"); } resolveInfos.remove(i); continue; } // requested activity is defined in a split that hasn't been installed yet. // add the installer to the resolve list if (DEBUG_INSTALL) { Loading @@ -7602,14 +7609,22 @@ public class PackageManagerService extends IPackageManager.Stub installFailureActivity, info.activityInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART | IntentFilter.MATCH_ADJUSTMENT_NORMAL; // add a non-generic filter installerInfo.filter = new IntentFilter(); // load resources from the correct package // This resolve info may appear in the chooser UI, so let us make it // look as the one it replaces as far as the user is concerned which // requires loading the correct label and icon for the resolve info. installerInfo.resolvePackageName = info.getComponentInfo().packageName; installerInfo.labelRes = info.resolveLabelResId(); installerInfo.icon = info.resolveIconResId(); // propagate priority/preferred order/default installerInfo.priority = info.priority; installerInfo.preferredOrder = info.preferredOrder; installerInfo.isDefault = info.isDefault; resolveInfos.set(i, installerInfo); continue; } Loading
core/java/android/content/pm/ResolveInfo.java +34 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,40 @@ public class ResolveInfo implements Parcelable { return data; } /** * @return The resource that would be used when loading * the label for this resolve info. * * @hide */ public int resolveLabelResId() { if (labelRes != 0) { return labelRes; } final ComponentInfo componentInfo = getComponentInfo(); if (componentInfo.labelRes != 0) { return componentInfo.labelRes; } return componentInfo.applicationInfo.labelRes; } /** * @return The resource that would be used when loading * the icon for this resolve info. * * @hide */ public int resolveIconResId() { if (icon != 0) { return icon; } final ComponentInfo componentInfo = getComponentInfo(); if (componentInfo.icon != 0) { return componentInfo.icon; } return componentInfo.applicationInfo.icon; } /** * Retrieve the current graphical icon associated with this resolution. This * will call back on the given PackageManager to load the icon from Loading
services/core/java/com/android/server/pm/PackageManagerService.java +18 −3 Original line number Diff line number Diff line Loading @@ -7589,6 +7589,13 @@ public class PackageManagerService extends IPackageManager.Stub && info.activityInfo.splitName != null && !ArrayUtils.contains(info.activityInfo.applicationInfo.splitNames, info.activityInfo.splitName)) { if (mInstantAppInstallerInfo == null) { if (DEBUG_INSTALL) { Slog.v(TAG, "No installer - not adding it to the ResolveInfo list"); } resolveInfos.remove(i); continue; } // requested activity is defined in a split that hasn't been installed yet. // add the installer to the resolve list if (DEBUG_INSTALL) { Loading @@ -7602,14 +7609,22 @@ public class PackageManagerService extends IPackageManager.Stub installFailureActivity, info.activityInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART | IntentFilter.MATCH_ADJUSTMENT_NORMAL; // add a non-generic filter installerInfo.filter = new IntentFilter(); // load resources from the correct package // This resolve info may appear in the chooser UI, so let us make it // look as the one it replaces as far as the user is concerned which // requires loading the correct label and icon for the resolve info. installerInfo.resolvePackageName = info.getComponentInfo().packageName; installerInfo.labelRes = info.resolveLabelResId(); installerInfo.icon = info.resolveIconResId(); // propagate priority/preferred order/default installerInfo.priority = info.priority; installerInfo.preferredOrder = info.preferredOrder; installerInfo.isDefault = info.isDefault; resolveInfos.set(i, installerInfo); continue; }