Merge "Adds metadata to InstantAppResolveInfo"
This commit is contained in:
committed by
Android (Google) Code Review
commit
9e33289902
@@ -783,11 +783,12 @@ package android.content.pm {
|
||||
|
||||
public final class InstantAppResolveInfo implements android.os.Parcelable {
|
||||
ctor public InstantAppResolveInfo(android.content.pm.InstantAppResolveInfo.InstantAppDigest, java.lang.String, java.util.List<android.content.pm.InstantAppIntentFilter>, int);
|
||||
ctor public InstantAppResolveInfo(android.content.pm.InstantAppResolveInfo.InstantAppDigest, java.lang.String, java.util.List<android.content.pm.InstantAppIntentFilter>, long);
|
||||
ctor public InstantAppResolveInfo(android.content.pm.InstantAppResolveInfo.InstantAppDigest, java.lang.String, java.util.List<android.content.pm.InstantAppIntentFilter>, long, android.os.Bundle);
|
||||
ctor public InstantAppResolveInfo(java.lang.String, java.lang.String, java.util.List<android.content.pm.InstantAppIntentFilter>);
|
||||
method public int describeContents();
|
||||
method public byte[] getDigestBytes();
|
||||
method public int getDigestPrefix();
|
||||
method public android.os.Bundle getExtras();
|
||||
method public java.util.List<android.content.pm.InstantAppIntentFilter> getIntentFilters();
|
||||
method public long getLongVersionCode();
|
||||
method public java.lang.String getPackageName();
|
||||
|
||||
@@ -4460,6 +4460,16 @@ public class Intent implements Parcelable, Cloneable {
|
||||
*/
|
||||
public static final String EXTRA_INSTANT_APP_ACTION = "android.intent.extra.INSTANT_APP_ACTION";
|
||||
|
||||
/**
|
||||
* A {@link Bundle} of metadata that describes the instanta application that needs to be
|
||||
* installed. This data is populated from the response to
|
||||
* {@link android.content.pm.InstantAppResolveInfo#getExtras()} as provided by the registered
|
||||
* instant application resolver.
|
||||
* @hide
|
||||
*/
|
||||
public static final String EXTRA_INSTANT_APP_EXTRAS =
|
||||
"android.intent.extra.INSTANT_APP_EXTRAS";
|
||||
|
||||
/**
|
||||
* The version code of the app to install components from.
|
||||
* @deprecated Use {@link #EXTRA_LONG_VERSION_CODE).
|
||||
|
||||
@@ -19,8 +19,7 @@ package android.content.pm;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -45,14 +44,17 @@ public final class InstantAppResolveInfo implements Parcelable {
|
||||
private final List<InstantAppIntentFilter> mFilters;
|
||||
/** The version code of the app that this class resolves to */
|
||||
private final long mVersionCode;
|
||||
/** Data about the app that should be passed along to the Instant App installer on resolve */
|
||||
private final Bundle mExtras;
|
||||
|
||||
public InstantAppResolveInfo(@NonNull InstantAppDigest digest, @Nullable String packageName,
|
||||
@Nullable List<InstantAppIntentFilter> filters, int versionCode) {
|
||||
this(digest, packageName, filters, (long)versionCode);
|
||||
this(digest, packageName, filters, (long) versionCode, null /* extras */);
|
||||
}
|
||||
|
||||
public InstantAppResolveInfo(@NonNull InstantAppDigest digest, @Nullable String packageName,
|
||||
@Nullable List<InstantAppIntentFilter> filters, long versionCode) {
|
||||
@Nullable List<InstantAppIntentFilter> filters, long versionCode,
|
||||
@Nullable Bundle extras) {
|
||||
// validate arguments
|
||||
if ((packageName == null && (filters != null && filters.size() != 0))
|
||||
|| (packageName != null && (filters == null || filters.size() == 0))) {
|
||||
@@ -67,11 +69,13 @@ public final class InstantAppResolveInfo implements Parcelable {
|
||||
}
|
||||
mPackageName = packageName;
|
||||
mVersionCode = versionCode;
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
public InstantAppResolveInfo(@NonNull String hostName, @Nullable String packageName,
|
||||
@Nullable List<InstantAppIntentFilter> filters) {
|
||||
this(new InstantAppDigest(hostName), packageName, filters, -1 /*versionCode*/);
|
||||
this(new InstantAppDigest(hostName), packageName, filters, -1 /*versionCode*/,
|
||||
null /* extras */);
|
||||
}
|
||||
|
||||
InstantAppResolveInfo(Parcel in) {
|
||||
@@ -80,6 +84,7 @@ public final class InstantAppResolveInfo implements Parcelable {
|
||||
mFilters = new ArrayList<InstantAppIntentFilter>();
|
||||
in.readList(mFilters, null /*loader*/);
|
||||
mVersionCode = in.readLong();
|
||||
mExtras = in.readBundle();
|
||||
}
|
||||
|
||||
public byte[] getDigestBytes() {
|
||||
@@ -110,6 +115,11 @@ public final class InstantAppResolveInfo implements Parcelable {
|
||||
return mVersionCode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Bundle getExtras() {
|
||||
return mExtras;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -121,6 +131,7 @@ public final class InstantAppResolveInfo implements Parcelable {
|
||||
out.writeString(mPackageName);
|
||||
out.writeList(mFilters);
|
||||
out.writeLong(mVersionCode);
|
||||
out.writeBundle(mExtras);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<InstantAppResolveInfo> CREATOR
|
||||
|
||||
@@ -86,7 +86,6 @@ import android.content.IntentSender;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.AuxiliaryResolveInfo;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
@@ -673,7 +672,8 @@ class ActivityStarter {
|
||||
auxiliaryResponse.failureIntent, callingPackage, verificationBundle,
|
||||
resolvedType, userId, auxiliaryResponse.packageName, auxiliaryResponse.splitName,
|
||||
auxiliaryResponse.installFailureActivity, auxiliaryResponse.versionCode,
|
||||
auxiliaryResponse.token, auxiliaryResponse.needsPhaseTwo);
|
||||
auxiliaryResponse.token, auxiliaryResponse.resolveInfo.getExtras(),
|
||||
auxiliaryResponse.needsPhaseTwo);
|
||||
}
|
||||
|
||||
void postStartActivityProcessing(ActivityRecord r, int result, ActivityStack targetStack) {
|
||||
|
||||
@@ -40,14 +40,11 @@ import android.content.pm.InstantAppIntentFilter;
|
||||
import android.content.pm.InstantAppResolveInfo;
|
||||
import android.content.pm.InstantAppResolveInfo.InstantAppDigest;
|
||||
import android.metrics.LogMaker;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
@@ -56,11 +53,9 @@ import com.android.server.pm.EphemeralResolverConnection.PhaseTwoCallback;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/** @hide */
|
||||
public abstract class InstantAppResolver {
|
||||
@@ -161,6 +156,7 @@ public abstract class InstantAppResolver {
|
||||
final String splitName;
|
||||
final long versionCode;
|
||||
final Intent failureIntent;
|
||||
final Bundle extras;
|
||||
if (instantAppResolveInfoList != null && instantAppResolveInfoList.size() > 0) {
|
||||
final AuxiliaryResolveInfo instantAppIntentInfo =
|
||||
InstantAppResolver.filterInstantAppIntent(
|
||||
@@ -172,17 +168,20 @@ public abstract class InstantAppResolver {
|
||||
splitName = instantAppIntentInfo.splitName;
|
||||
versionCode = instantAppIntentInfo.resolveInfo.getVersionCode();
|
||||
failureIntent = instantAppIntentInfo.failureIntent;
|
||||
extras = instantAppIntentInfo.resolveInfo.getExtras();
|
||||
} else {
|
||||
packageName = null;
|
||||
splitName = null;
|
||||
versionCode = -1;
|
||||
failureIntent = null;
|
||||
extras = null;
|
||||
}
|
||||
} else {
|
||||
packageName = null;
|
||||
splitName = null;
|
||||
versionCode = -1;
|
||||
failureIntent = null;
|
||||
extras = null;
|
||||
}
|
||||
final Intent installerIntent = buildEphemeralInstallerIntent(
|
||||
Intent.ACTION_RESOLVE_INSTANT_APP_PACKAGE,
|
||||
@@ -197,6 +196,7 @@ public abstract class InstantAppResolver {
|
||||
requestObj.responseObj.installFailureActivity,
|
||||
versionCode,
|
||||
token,
|
||||
extras,
|
||||
false /*needsPhaseTwo*/);
|
||||
installerIntent.setComponent(new ComponentName(
|
||||
instantAppInstaller.packageName, instantAppInstaller.name));
|
||||
@@ -243,6 +243,7 @@ public abstract class InstantAppResolver {
|
||||
@Nullable ComponentName installFailureActivity,
|
||||
long versionCode,
|
||||
@Nullable String token,
|
||||
@Nullable Bundle extras,
|
||||
boolean needsPhaseTwo) {
|
||||
// Construct the intent that launches the instant installer
|
||||
int flags = origIntent.getFlags();
|
||||
@@ -259,6 +260,9 @@ public abstract class InstantAppResolver {
|
||||
intent.putExtra(Intent.EXTRA_EPHEMERAL_HOSTNAME, origIntent.getData().getHost());
|
||||
}
|
||||
intent.putExtra(Intent.EXTRA_INSTANT_APP_ACTION, origIntent.getAction());
|
||||
if (extras != null) {
|
||||
intent.putExtra(Intent.EXTRA_INSTANT_APP_EXTRAS, extras);
|
||||
}
|
||||
|
||||
// We have all of the data we need; just start the installer without a second phase
|
||||
if (!needsPhaseTwo) {
|
||||
|
||||
Reference in New Issue
Block a user