Merge "Implement 2-phase resolution"
This commit is contained in:
@@ -3834,6 +3834,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
|
||||
|
||||
48
core/java/android/content/pm/EphemeralRequest.java
Normal file
48
core/java/android/content/pm/EphemeralRequest.java
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
51
core/java/android/content/pm/EphemeralResponse.java
Normal file
51
core/java/android/content/pm/EphemeralResponse.java
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user