summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTodd Kennedy <toddke@google.com>2016-11-16 23:05:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-11-16 23:05:34 +0000
commit3e12f413d40e55da3d8a964740bc2aa9899c622b (patch)
tree5e94ca6467b84ded8651af50e2312a5901a554b4 /core/java/android
parent2eb0a8b4d5f1e9c2d569c3cf07d450ebc1ab41e5 (diff)
parent01ad0c7e403794b272494f187d91f57bdfa07c9d (diff)
Merge "Implement 2-phase resolution"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/Intent.java12
-rw-r--r--core/java/android/content/pm/EphemeralRequest.java48
-rw-r--r--core/java/android/content/pm/EphemeralResolveInfo.java22
-rw-r--r--core/java/android/content/pm/EphemeralResponse.java51
-rw-r--r--core/java/android/content/pm/PackageManagerInternal.java13
-rw-r--r--core/java/android/content/pm/ResolveInfo.java3
6 files changed, 125 insertions, 24 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index a9e987a45b2b..c87de9ade034 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -3835,6 +3835,18 @@ public class Intent implements Parcelable, Cloneable {
public static final String EXTRA_EPHEMERAL_FAILURE = "android.intent.extra.EPHEMERAL_FAILURE";
/**
+ * The host name that triggered an ephemeral resolution.
+ * @hide
+ */
+ public static final String EXTRA_EPHEMERAL_HOSTNAME = "android.intent.extra.EPHEMERAL_HOSTNAME";
+
+ /**
+ * An opaque token to track ephemeral resolution.
+ * @hide
+ */
+ public static final String EXTRA_EPHEMERAL_TOKEN = "android.intent.extra.EPHEMERAL_TOKEN";
+
+ /**
* A Bundle forming a mapping of potential target package names to different extras Bundles
* to add to the default intent extras in {@link #EXTRA_INTENT} when used with
* {@link #ACTION_CHOOSER}. Each key should be a package name. The package need not
diff --git a/core/java/android/content/pm/EphemeralRequest.java b/core/java/android/content/pm/EphemeralRequest.java
new file mode 100644
index 000000000000..7f2b3ee1245b
--- /dev/null
+++ b/core/java/android/content/pm/EphemeralRequest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.content.pm;
+
+import android.content.Intent;
+
+/**
+ * Information needed to make an ephemeral application resolution request.
+ * @hide
+ */
+public final class EphemeralRequest {
+ /** Response from the first phase of ephemeral application resolution */
+ public final EphemeralResponse responseObj;
+ /** The original intent that triggered ephemeral application resolution */
+ public final Intent origIntent;
+ /** Resolved type of the intent */
+ public final String resolvedType;
+ /** The intent that would launch if there were no ephemeral applications */
+ public final Intent launchIntent;
+ /** The name of the package requesting the ephemeral application */
+ public final String callingPackage;
+ /** ID of the user requesting the ephemeral application */
+ public final int userId;
+
+ public EphemeralRequest(EphemeralResponse responseObj, Intent origIntent,
+ String resolvedType, Intent launchIntent, String callingPackage, int userId) {
+ this.responseObj = responseObj;
+ this.origIntent = origIntent;
+ this.resolvedType = resolvedType;
+ this.launchIntent = launchIntent;
+ this.callingPackage = callingPackage;
+ this.userId = userId;
+ }
+} \ No newline at end of file
diff --git a/core/java/android/content/pm/EphemeralResolveInfo.java b/core/java/android/content/pm/EphemeralResolveInfo.java
index 3bed06b4816f..f6200886cd71 100644
--- a/core/java/android/content/pm/EphemeralResolveInfo.java
+++ b/core/java/android/content/pm/EphemeralResolveInfo.java
@@ -137,28 +137,6 @@ public final class EphemeralResolveInfo implements Parcelable {
}
};
- /** @hide */
- public static final class EphemeralResolveIntentInfo extends IntentFilter {
- private final EphemeralResolveInfo mResolveInfo;
- private final String mSplitName;
-
- public EphemeralResolveIntentInfo(@NonNull IntentFilter orig,
- @NonNull EphemeralResolveInfo resolveInfo,
- @Nullable String splitName) {
- super(orig);
- mResolveInfo = resolveInfo;
- mSplitName = splitName;
- }
-
- public EphemeralResolveInfo getEphemeralResolveInfo() {
- return mResolveInfo;
- }
-
- public String getSplitName() {
- return mSplitName;
- }
- }
-
/**
* Helper class to generate and store each of the digests and prefixes
* sent to the Ephemeral Resolver.
diff --git a/core/java/android/content/pm/EphemeralResponse.java b/core/java/android/content/pm/EphemeralResponse.java
new file mode 100644
index 000000000000..6e569f7d4667
--- /dev/null
+++ b/core/java/android/content/pm/EphemeralResponse.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.content.pm;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.content.IntentFilter;
+
+/**
+ * Ephemeral application resolution response.
+ * @hide
+ */
+public final class EphemeralResponse extends IntentFilter {
+ /** Resolved information returned from the external ephemeral resolver */
+ public final EphemeralResolveInfo resolveInfo;
+ /** The resolved package. Copied from {@link #resolveInfo}. */
+ public final String packageName;
+ /** The resolve split. Copied from the matched filter in {@link #resolveInfo}. */
+ public final String splitName;
+ /** Whether or not ephemeral resolution needs the second phase */
+ public final boolean needsPhase2;
+ /** Opaque token to track the ephemeral application resolution */
+ public final String token;
+
+ public EphemeralResponse(@NonNull EphemeralResolveInfo resolveInfo,
+ @NonNull IntentFilter orig,
+ @Nullable String splitName,
+ @NonNull String token,
+ boolean needsPhase2) {
+ super(orig);
+ this.resolveInfo = resolveInfo;
+ this.packageName = resolveInfo.getPackageName();
+ this.splitName = splitName;
+ this.token = token;
+ this.needsPhase2 = needsPhase2;
+ }
+} \ No newline at end of file
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index 2aa7ac6ff5b6..ad0a6b25c4f1 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -17,6 +17,7 @@
package android.content.pm;
import android.content.ComponentName;
+import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.SparseArray;
@@ -208,4 +209,16 @@ public abstract class PackageManagerInternal {
*/
public abstract String getNameForUid(int uid);
+ /**
+ * Request to perform the second phase of ephemeral resolution.
+ * @param responseObj The response of the first phase of ephemeral resolution
+ * @param origIntent The original intent that triggered ephemeral resolution
+ * @param resolvedType The resolved type of the intent
+ * @param launchIntent The intent that would launch if there was no ephemeral application
+ * @param callingPackage The name of the package requesting the ephemeral application
+ * @param userId The ID of the user that triggered ephemeral resolution
+ */
+ public abstract void requestEphemeralResolutionPhaseTwo(EphemeralResponse responseObj,
+ Intent origIntent, String resolvedType, Intent launchIntent, String callingPackage,
+ int userId);
}
diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java
index 86dbe8a64ed8..f8b4570be6cc 100644
--- a/core/java/android/content/pm/ResolveInfo.java
+++ b/core/java/android/content/pm/ResolveInfo.java
@@ -18,7 +18,6 @@ package android.content.pm;
import android.content.ComponentName;
import android.content.IntentFilter;
-import android.content.pm.EphemeralResolveInfo.EphemeralResolveIntentInfo;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
@@ -66,7 +65,7 @@ public class ResolveInfo implements Parcelable {
* only be set in specific circumstances.
* @hide
*/
- public EphemeralResolveIntentInfo ephemeralIntentInfo;
+ public EphemeralResponse ephemeralResponse;
/**
* The IntentFilter that was matched for this ResolveInfo.