Loading core/java/android/content/pm/AuxiliaryResolveInfo.java +8 −2 Original line number Diff line number Diff line Loading @@ -43,13 +43,16 @@ public final class AuxiliaryResolveInfo extends IntentFilter { public final String token; /** The version code of the package */ public final int versionCode; /** An intent to start upon failure to install */ public final Intent failureIntent; /** Create a response for installing an instant application. */ public AuxiliaryResolveInfo(@NonNull InstantAppResolveInfo resolveInfo, @NonNull IntentFilter orig, @Nullable String splitName, @NonNull String token, boolean needsPhase2) { boolean needsPhase2, @Nullable Intent failureIntent) { super(orig); this.resolveInfo = resolveInfo; this.packageName = resolveInfo.getPackageName(); Loading @@ -57,12 +60,14 @@ public final class AuxiliaryResolveInfo extends IntentFilter { this.token = token; this.needsPhaseTwo = needsPhase2; this.versionCode = resolveInfo.getVersionCode(); this.failureIntent = failureIntent; } /** Create a response for installing a split on demand. */ public AuxiliaryResolveInfo(@NonNull String packageName, @Nullable String splitName, int versionCode) { int versionCode, @Nullable Intent failureIntent) { super(); this.packageName = packageName; this.splitName = splitName; Loading @@ -70,5 +75,6 @@ public final class AuxiliaryResolveInfo extends IntentFilter { this.resolveInfo = null; this.token = null; this.needsPhaseTwo = false; this.failureIntent = failureIntent; } } No newline at end of file services/core/java/com/android/server/am/ActivityStarter.java +2 −1 Original line number Diff line number Diff line Loading @@ -534,7 +534,8 @@ class ActivityStarter { verificationBundle, userId); } return InstantAppResolver.buildEphemeralInstallerIntent(originalIntent, callingPackage, verificationBundle, resolvedType, userId, auxiliaryResponse.packageName, auxiliaryResponse.failureIntent, callingPackage, verificationBundle, resolvedType, userId, auxiliaryResponse.packageName, auxiliaryResponse.splitName, auxiliaryResponse.versionCode, auxiliaryResponse.token, auxiliaryResponse.needsPhaseTwo); } Loading services/core/java/com/android/server/pm/InstantAppResolver.java +31 −21 Original line number Diff line number Diff line Loading @@ -125,6 +125,7 @@ public abstract class InstantAppResolver { final String packageName; final String splitName; final int versionCode; final Intent failureIntent; if (instantAppResolveInfoList != null && instantAppResolveInfoList.size() > 0) { final AuxiliaryResolveInfo instantAppIntentInfo = InstantAppResolver.filterInstantAppIntent( Loading @@ -135,18 +136,22 @@ public abstract class InstantAppResolver { packageName = instantAppIntentInfo.resolveInfo.getPackageName(); splitName = instantAppIntentInfo.splitName; versionCode = instantAppIntentInfo.resolveInfo.getVersionCode(); failureIntent = instantAppIntentInfo.failureIntent; } else { packageName = null; splitName = null; versionCode = -1; failureIntent = null; } } else { packageName = null; splitName = null; versionCode = -1; failureIntent = null; } final Intent installerIntent = buildEphemeralInstallerIntent( requestObj.origIntent, failureIntent, requestObj.callingPackage, requestObj.verificationBundle, requestObj.resolvedType, Loading @@ -172,7 +177,9 @@ public abstract class InstantAppResolver { /** * Builds and returns an intent to launch the instant installer. */ public static Intent buildEphemeralInstallerIntent(@NonNull Intent origIntent, public static Intent buildEphemeralInstallerIntent( @NonNull Intent origIntent, @NonNull Intent failureIntent, @NonNull String callingPackage, @Nullable Bundle verificationBundle, @NonNull String resolvedType, Loading Loading @@ -200,9 +207,7 @@ public abstract class InstantAppResolver { // We have all of the data we need; just start the installer without a second phase if (!needsPhaseTwo) { // Intent that is launched if the package couldn't be installed for any reason. final Intent failureIntent = new Intent(origIntent); failureIntent.setFlags(failureIntent.getFlags() | Intent.FLAG_IGNORE_EPHEMERAL); failureIntent.setLaunchToken(token); if (failureIntent != null) { try { final IIntentSender failureIntentTarget = ActivityManager.getService() .getIntentSender( Loading @@ -216,6 +221,7 @@ public abstract class InstantAppResolver { intent.putExtra(Intent.EXTRA_EPHEMERAL_FAILURE, new IntentSender(failureIntentTarget)); } catch (RemoteException ignore) { /* ignore; same process */ } } // Intent that is launched if the package was installed successfully. final Intent successIntent = new Intent(origIntent); Loading Loading @@ -248,10 +254,13 @@ public abstract class InstantAppResolver { private static AuxiliaryResolveInfo filterInstantAppIntent( List<InstantAppResolveInfo> instantAppResolveInfoList, Intent intent, String resolvedType, int userId, String packageName, Intent origIntent, String resolvedType, int userId, String packageName, InstantAppDigest digest, String token) { final int[] shaPrefix = digest.getDigestPrefix(); final byte[][] digestBytes = digest.getDigestBytes(); final Intent failureIntent = new Intent(origIntent); failureIntent.setFlags(failureIntent.getFlags() | Intent.FLAG_IGNORE_EPHEMERAL); failureIntent.setLaunchToken(token); // Go in reverse order so we match the narrowest scope first. for (int i = shaPrefix.length - 1; i >= 0 ; --i) { for (InstantAppResolveInfo instantAppInfo : instantAppResolveInfoList) { Loading @@ -271,7 +280,8 @@ public abstract class InstantAppResolver { } return new AuxiliaryResolveInfo(instantAppInfo, new IntentFilter(Intent.ACTION_VIEW) /*intentFilter*/, null /*splitName*/, token, true /*needsPhase2*/); null /*splitName*/, token, true /*needsPhase2*/, null /*failureIntent*/); } // We have a domain match; resolve the filters to see if anything matches. final PackageManagerService.EphemeralIntentResolver instantAppResolver = Loading @@ -286,12 +296,12 @@ public abstract class InstantAppResolver { final AuxiliaryResolveInfo intentInfo = new AuxiliaryResolveInfo(instantAppInfo, splitFilters.get(k), instantAppFilter.getSplitName(), token, false /*needsPhase2*/); token, false /*needsPhase2*/, failureIntent); instantAppResolver.addFilter(intentInfo); } } List<AuxiliaryResolveInfo> matchedResolveInfoList = instantAppResolver.queryIntent( intent, resolvedType, false /*defaultOnly*/, userId); origIntent, resolvedType, false /*defaultOnly*/, userId); if (!matchedResolveInfoList.isEmpty()) { if (DEBUG_EPHEMERAL) { final AuxiliaryResolveInfo info = matchedResolveInfoList.get(0); Loading services/core/java/com/android/server/pm/PackageManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -6715,7 +6715,7 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo installerInfo = new ResolveInfo(mInstantAppInstallerInfo); installerInfo.auxiliaryInfo = new AuxiliaryResolveInfo( info.activityInfo.packageName, info.activityInfo.splitName, info.activityInfo.applicationInfo.versionCode); info.activityInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART Loading Loading @@ -7388,7 +7388,7 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo installerInfo = new ResolveInfo(mInstantAppInstallerInfo); installerInfo.auxiliaryInfo = new AuxiliaryResolveInfo( info.serviceInfo.packageName, info.serviceInfo.splitName, info.serviceInfo.applicationInfo.versionCode); info.serviceInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART Loading Loading @@ -7509,7 +7509,7 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo installerInfo = new ResolveInfo(mInstantAppInstallerInfo); installerInfo.auxiliaryInfo = new AuxiliaryResolveInfo( info.providerInfo.packageName, info.providerInfo.splitName, info.providerInfo.applicationInfo.versionCode); info.providerInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART Loading
core/java/android/content/pm/AuxiliaryResolveInfo.java +8 −2 Original line number Diff line number Diff line Loading @@ -43,13 +43,16 @@ public final class AuxiliaryResolveInfo extends IntentFilter { public final String token; /** The version code of the package */ public final int versionCode; /** An intent to start upon failure to install */ public final Intent failureIntent; /** Create a response for installing an instant application. */ public AuxiliaryResolveInfo(@NonNull InstantAppResolveInfo resolveInfo, @NonNull IntentFilter orig, @Nullable String splitName, @NonNull String token, boolean needsPhase2) { boolean needsPhase2, @Nullable Intent failureIntent) { super(orig); this.resolveInfo = resolveInfo; this.packageName = resolveInfo.getPackageName(); Loading @@ -57,12 +60,14 @@ public final class AuxiliaryResolveInfo extends IntentFilter { this.token = token; this.needsPhaseTwo = needsPhase2; this.versionCode = resolveInfo.getVersionCode(); this.failureIntent = failureIntent; } /** Create a response for installing a split on demand. */ public AuxiliaryResolveInfo(@NonNull String packageName, @Nullable String splitName, int versionCode) { int versionCode, @Nullable Intent failureIntent) { super(); this.packageName = packageName; this.splitName = splitName; Loading @@ -70,5 +75,6 @@ public final class AuxiliaryResolveInfo extends IntentFilter { this.resolveInfo = null; this.token = null; this.needsPhaseTwo = false; this.failureIntent = failureIntent; } } No newline at end of file
services/core/java/com/android/server/am/ActivityStarter.java +2 −1 Original line number Diff line number Diff line Loading @@ -534,7 +534,8 @@ class ActivityStarter { verificationBundle, userId); } return InstantAppResolver.buildEphemeralInstallerIntent(originalIntent, callingPackage, verificationBundle, resolvedType, userId, auxiliaryResponse.packageName, auxiliaryResponse.failureIntent, callingPackage, verificationBundle, resolvedType, userId, auxiliaryResponse.packageName, auxiliaryResponse.splitName, auxiliaryResponse.versionCode, auxiliaryResponse.token, auxiliaryResponse.needsPhaseTwo); } Loading
services/core/java/com/android/server/pm/InstantAppResolver.java +31 −21 Original line number Diff line number Diff line Loading @@ -125,6 +125,7 @@ public abstract class InstantAppResolver { final String packageName; final String splitName; final int versionCode; final Intent failureIntent; if (instantAppResolveInfoList != null && instantAppResolveInfoList.size() > 0) { final AuxiliaryResolveInfo instantAppIntentInfo = InstantAppResolver.filterInstantAppIntent( Loading @@ -135,18 +136,22 @@ public abstract class InstantAppResolver { packageName = instantAppIntentInfo.resolveInfo.getPackageName(); splitName = instantAppIntentInfo.splitName; versionCode = instantAppIntentInfo.resolveInfo.getVersionCode(); failureIntent = instantAppIntentInfo.failureIntent; } else { packageName = null; splitName = null; versionCode = -1; failureIntent = null; } } else { packageName = null; splitName = null; versionCode = -1; failureIntent = null; } final Intent installerIntent = buildEphemeralInstallerIntent( requestObj.origIntent, failureIntent, requestObj.callingPackage, requestObj.verificationBundle, requestObj.resolvedType, Loading @@ -172,7 +177,9 @@ public abstract class InstantAppResolver { /** * Builds and returns an intent to launch the instant installer. */ public static Intent buildEphemeralInstallerIntent(@NonNull Intent origIntent, public static Intent buildEphemeralInstallerIntent( @NonNull Intent origIntent, @NonNull Intent failureIntent, @NonNull String callingPackage, @Nullable Bundle verificationBundle, @NonNull String resolvedType, Loading Loading @@ -200,9 +207,7 @@ public abstract class InstantAppResolver { // We have all of the data we need; just start the installer without a second phase if (!needsPhaseTwo) { // Intent that is launched if the package couldn't be installed for any reason. final Intent failureIntent = new Intent(origIntent); failureIntent.setFlags(failureIntent.getFlags() | Intent.FLAG_IGNORE_EPHEMERAL); failureIntent.setLaunchToken(token); if (failureIntent != null) { try { final IIntentSender failureIntentTarget = ActivityManager.getService() .getIntentSender( Loading @@ -216,6 +221,7 @@ public abstract class InstantAppResolver { intent.putExtra(Intent.EXTRA_EPHEMERAL_FAILURE, new IntentSender(failureIntentTarget)); } catch (RemoteException ignore) { /* ignore; same process */ } } // Intent that is launched if the package was installed successfully. final Intent successIntent = new Intent(origIntent); Loading Loading @@ -248,10 +254,13 @@ public abstract class InstantAppResolver { private static AuxiliaryResolveInfo filterInstantAppIntent( List<InstantAppResolveInfo> instantAppResolveInfoList, Intent intent, String resolvedType, int userId, String packageName, Intent origIntent, String resolvedType, int userId, String packageName, InstantAppDigest digest, String token) { final int[] shaPrefix = digest.getDigestPrefix(); final byte[][] digestBytes = digest.getDigestBytes(); final Intent failureIntent = new Intent(origIntent); failureIntent.setFlags(failureIntent.getFlags() | Intent.FLAG_IGNORE_EPHEMERAL); failureIntent.setLaunchToken(token); // Go in reverse order so we match the narrowest scope first. for (int i = shaPrefix.length - 1; i >= 0 ; --i) { for (InstantAppResolveInfo instantAppInfo : instantAppResolveInfoList) { Loading @@ -271,7 +280,8 @@ public abstract class InstantAppResolver { } return new AuxiliaryResolveInfo(instantAppInfo, new IntentFilter(Intent.ACTION_VIEW) /*intentFilter*/, null /*splitName*/, token, true /*needsPhase2*/); null /*splitName*/, token, true /*needsPhase2*/, null /*failureIntent*/); } // We have a domain match; resolve the filters to see if anything matches. final PackageManagerService.EphemeralIntentResolver instantAppResolver = Loading @@ -286,12 +296,12 @@ public abstract class InstantAppResolver { final AuxiliaryResolveInfo intentInfo = new AuxiliaryResolveInfo(instantAppInfo, splitFilters.get(k), instantAppFilter.getSplitName(), token, false /*needsPhase2*/); token, false /*needsPhase2*/, failureIntent); instantAppResolver.addFilter(intentInfo); } } List<AuxiliaryResolveInfo> matchedResolveInfoList = instantAppResolver.queryIntent( intent, resolvedType, false /*defaultOnly*/, userId); origIntent, resolvedType, false /*defaultOnly*/, userId); if (!matchedResolveInfoList.isEmpty()) { if (DEBUG_EPHEMERAL) { final AuxiliaryResolveInfo info = matchedResolveInfoList.get(0); Loading
services/core/java/com/android/server/pm/PackageManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -6715,7 +6715,7 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo installerInfo = new ResolveInfo(mInstantAppInstallerInfo); installerInfo.auxiliaryInfo = new AuxiliaryResolveInfo( info.activityInfo.packageName, info.activityInfo.splitName, info.activityInfo.applicationInfo.versionCode); info.activityInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART Loading Loading @@ -7388,7 +7388,7 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo installerInfo = new ResolveInfo(mInstantAppInstallerInfo); installerInfo.auxiliaryInfo = new AuxiliaryResolveInfo( info.serviceInfo.packageName, info.serviceInfo.splitName, info.serviceInfo.applicationInfo.versionCode); info.serviceInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART Loading Loading @@ -7509,7 +7509,7 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo installerInfo = new ResolveInfo(mInstantAppInstallerInfo); installerInfo.auxiliaryInfo = new AuxiliaryResolveInfo( info.providerInfo.packageName, info.providerInfo.splitName, info.providerInfo.applicationInfo.versionCode); info.providerInfo.applicationInfo.versionCode, null /*failureIntent*/); // make sure this resolver is the default installerInfo.isDefault = true; installerInfo.match = IntentFilter.MATCH_CATEGORY_SCHEME_SPECIFIC_PART