diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-01-31 02:05:32 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-01-31 02:05:32 +0000 |
| commit | 3a247b19dd38becf016b0e531fffea92f0b92a5c (patch) | |
| tree | 5fffbc2f0b91f25cbdf159d967f7961351bb4b50 /core/java | |
| parent | b78bb44a87db5788a946434195483c92e3410064 (diff) | |
| parent | 5564f880db3292327872a07df8e230eee78be14b (diff) | |
Merge "Removes EphemrealResolverService and related"
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/EphemeralResolverService.java | 104 | ||||
| -rw-r--r-- | core/java/android/app/InstantAppResolverService.java | 10 | ||||
| -rw-r--r-- | core/java/android/content/Intent.java | 30 | ||||
| -rw-r--r-- | core/java/android/content/pm/EphemeralIntentFilter.java | 85 | ||||
| -rw-r--r-- | core/java/android/content/pm/EphemeralResolveInfo.java | 224 |
5 files changed, 5 insertions, 448 deletions
diff --git a/core/java/android/app/EphemeralResolverService.java b/core/java/android/app/EphemeralResolverService.java deleted file mode 100644 index d1c244136ec9..000000000000 --- a/core/java/android/app/EphemeralResolverService.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2015 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.app; - -import android.annotation.SystemApi; -import android.content.pm.EphemeralResolveInfo; -import android.content.pm.InstantAppResolveInfo; -import android.os.Build; -import android.os.Looper; -import android.util.Log; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Base class for implementing the resolver service. - * @hide - * @removed - * @deprecated use InstantAppResolverService instead - */ -@Deprecated -@SystemApi -public abstract class EphemeralResolverService extends InstantAppResolverService { - private static final boolean DEBUG_EPHEMERAL = Build.IS_DEBUGGABLE; - private static final String TAG = "PackageManager"; - - /** - * Called to retrieve resolve info for ephemeral applications. - * - * @param digestPrefix The hash prefix of the ephemeral's domain. - * @param prefixMask A mask that was applied to each digest prefix. This should - * be used when comparing against the digest prefixes as all bits might - * not be set. - * @deprecated use {@link #onGetEphemeralResolveInfo(int[])} instead - */ - @Deprecated - public abstract List<EphemeralResolveInfo> onEphemeralResolveInfoList( - int digestPrefix[], int prefix); - - /** - * Called to retrieve resolve info for ephemeral applications. - * - * @param digestPrefix The hash prefix of the ephemeral's domain. - */ - public List<EphemeralResolveInfo> onGetEphemeralResolveInfo(int digestPrefix[]) { - return onEphemeralResolveInfoList(digestPrefix, 0xFFFFF000); - } - - /** - * Called to retrieve intent filters for ephemeral applications. - * - * @param hostName The name of the host to get intent filters for. - */ - public EphemeralResolveInfo onGetEphemeralIntentFilter(String hostName) { - throw new IllegalStateException("Must define"); - } - - @Override - public Looper getLooper() { - return super.getLooper(); - } - - void _onGetInstantAppResolveInfo(int[] digestPrefix, String token, - InstantAppResolutionCallback callback) { - if (DEBUG_EPHEMERAL) { - Log.d(TAG, "Legacy resolver; getInstantAppResolveInfo;" - + " prefix: " + Arrays.toString(digestPrefix)); - } - final List<EphemeralResolveInfo> response = onGetEphemeralResolveInfo(digestPrefix); - final int responseSize = response == null ? 0 : response.size(); - final List<InstantAppResolveInfo> resultList = new ArrayList<>(responseSize); - for (int i = 0; i < responseSize; i++) { - resultList.add(response.get(i).getInstantAppResolveInfo()); - } - callback.onInstantAppResolveInfo(resultList); - } - - void _onGetInstantAppIntentFilter(int[] digestPrefix, String token, - String hostName, InstantAppResolutionCallback callback) { - if (DEBUG_EPHEMERAL) { - Log.d(TAG, "Legacy resolver; getInstantAppIntentFilter;" - + " prefix: " + Arrays.toString(digestPrefix)); - } - final EphemeralResolveInfo response = onGetEphemeralIntentFilter(hostName); - final List<InstantAppResolveInfo> resultList = new ArrayList<>(1); - resultList.add(response.getInstantAppResolveInfo()); - callback.onInstantAppResolveInfo(resultList); - } -} diff --git a/core/java/android/app/InstantAppResolverService.java b/core/java/android/app/InstantAppResolverService.java index 89aff36f883a..76a36820ed83 100644 --- a/core/java/android/app/InstantAppResolverService.java +++ b/core/java/android/app/InstantAppResolverService.java @@ -43,7 +43,7 @@ import java.util.List; */ @SystemApi public abstract class InstantAppResolverService extends Service { - private static final boolean DEBUG_EPHEMERAL = Build.IS_DEBUGGABLE; + private static final boolean DEBUG_INSTANT = Build.IS_DEBUGGABLE; private static final String TAG = "PackageManager"; /** @hide */ @@ -133,7 +133,7 @@ public abstract class InstantAppResolverService extends Service { @Override public void getInstantAppResolveInfoList(Intent sanitizedIntent, int[] digestPrefix, String token, int sequence, IRemoteCallback callback) { - if (DEBUG_EPHEMERAL) { + if (DEBUG_INSTANT) { Slog.v(TAG, "[" + token + "] Phase1 called; posting"); } final SomeArgs args = SomeArgs.obtain(); @@ -148,7 +148,7 @@ public abstract class InstantAppResolverService extends Service { @Override public void getInstantAppIntentFilterList(Intent sanitizedIntent, int[] digestPrefix, String token, IRemoteCallback callback) { - if (DEBUG_EPHEMERAL) { + if (DEBUG_INSTANT) { Slog.v(TAG, "[" + token + "] Phase2 called; posting"); } final SomeArgs args = SomeArgs.obtain(); @@ -203,7 +203,7 @@ public abstract class InstantAppResolverService extends Service { final String token = (String) args.arg3; final Intent intent = (Intent) args.arg4; final int sequence = message.arg1; - if (DEBUG_EPHEMERAL) { + if (DEBUG_INSTANT) { Slog.d(TAG, "[" + token + "] Phase1 request;" + " prefix: " + Arrays.toString(digestPrefix)); } @@ -217,7 +217,7 @@ public abstract class InstantAppResolverService extends Service { final int[] digestPrefix = (int[]) args.arg2; final String token = (String) args.arg3; final Intent intent = (Intent) args.arg4; - if (DEBUG_EPHEMERAL) { + if (DEBUG_INSTANT) { Slog.d(TAG, "[" + token + "] Phase2 request;" + " prefix: " + Arrays.toString(digestPrefix)); } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index b3c8737a2831..908465efa0c8 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1554,16 +1554,6 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_INSTALL_FAILURE = "android.intent.action.INSTALL_FAILURE"; /** - * @hide - * @removed - * @deprecated Do not use. This will go away. - * Replace with {@link #ACTION_INSTALL_INSTANT_APP_PACKAGE}. - */ - @SystemApi - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) - public static final String ACTION_INSTALL_EPHEMERAL_PACKAGE - = "android.intent.action.INSTALL_EPHEMERAL_PACKAGE"; - /** * Activity Action: Launch instant application installer. * <p class="note"> * This is a protected intent that can only be sent by the system. @@ -1577,16 +1567,6 @@ public class Intent implements Parcelable, Cloneable { = "android.intent.action.INSTALL_INSTANT_APP_PACKAGE"; /** - * @hide - * @removed - * @deprecated Do not use. This will go away. - * Replace with {@link #ACTION_RESOLVE_INSTANT_APP_PACKAGE}. - */ - @SystemApi - @SdkConstant(SdkConstantType.SERVICE_ACTION) - public static final String ACTION_RESOLVE_EPHEMERAL_PACKAGE - = "android.intent.action.RESOLVE_EPHEMERAL_PACKAGE"; - /** * Service Action: Resolve instant application. * <p> * The system will have a persistent connection to this service. @@ -1601,16 +1581,6 @@ public class Intent implements Parcelable, Cloneable { = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE"; /** - * @hide - * @removed - * @deprecated Do not use. This will go away. - * Replace with {@link #ACTION_INSTANT_APP_RESOLVER_SETTINGS}. - */ - @SystemApi - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) - public static final String ACTION_EPHEMERAL_RESOLVER_SETTINGS - = "android.intent.action.EPHEMERAL_RESOLVER_SETTINGS"; - /** * Activity Action: Launch instant app settings. * * <p class="note"> diff --git a/core/java/android/content/pm/EphemeralIntentFilter.java b/core/java/android/content/pm/EphemeralIntentFilter.java deleted file mode 100644 index 1dbbf816ed93..000000000000 --- a/core/java/android/content/pm/EphemeralIntentFilter.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.annotation.SystemApi; -import android.content.IntentFilter; -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.ArrayList; -import java.util.List; - -/** - * Information about an ephemeral application intent filter. - * @hide - * @removed - */ -@Deprecated -@SystemApi -public final class EphemeralIntentFilter implements Parcelable { - private final InstantAppIntentFilter mInstantAppIntentFilter; - - public EphemeralIntentFilter(@Nullable String splitName, @NonNull List<IntentFilter> filters) { - mInstantAppIntentFilter = new InstantAppIntentFilter(splitName, filters); - } - - EphemeralIntentFilter(@NonNull InstantAppIntentFilter intentFilter) { - mInstantAppIntentFilter = intentFilter; - } - - EphemeralIntentFilter(Parcel in) { - mInstantAppIntentFilter = in.readParcelable(null /*loader*/); - } - - public String getSplitName() { - return mInstantAppIntentFilter.getSplitName(); - } - - public List<IntentFilter> getFilters() { - return mInstantAppIntentFilter.getFilters(); - } - - /** @hide */ - InstantAppIntentFilter getInstantAppIntentFilter() { - return mInstantAppIntentFilter; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - out.writeParcelable(mInstantAppIntentFilter, flags); - } - - public static final Parcelable.Creator<EphemeralIntentFilter> CREATOR - = new Parcelable.Creator<EphemeralIntentFilter>() { - @Override - public EphemeralIntentFilter createFromParcel(Parcel in) { - return new EphemeralIntentFilter(in); - } - @Override - public EphemeralIntentFilter[] newArray(int size) { - return new EphemeralIntentFilter[size]; - } - }; -} diff --git a/core/java/android/content/pm/EphemeralResolveInfo.java b/core/java/android/content/pm/EphemeralResolveInfo.java deleted file mode 100644 index 12131a3ebc98..000000000000 --- a/core/java/android/content/pm/EphemeralResolveInfo.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2015 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.annotation.SystemApi; -import android.content.IntentFilter; -import android.content.pm.InstantAppResolveInfo.InstantAppDigest; -import android.net.Uri; -import android.os.Parcel; -import android.os.Parcelable; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -/** - * Information about an ephemeral application. - * @hide - * @removed - */ -@Deprecated -@SystemApi -public final class EphemeralResolveInfo implements Parcelable { - /** Algorithm that will be used to generate the domain digest */ - public static final String SHA_ALGORITHM = "SHA-256"; - - private final InstantAppResolveInfo mInstantAppResolveInfo; - @Deprecated - private final List<IntentFilter> mLegacyFilters; - - @Deprecated - public EphemeralResolveInfo(@NonNull Uri uri, @NonNull String packageName, - @NonNull List<IntentFilter> filters) { - if (uri == null || packageName == null || filters == null || filters.isEmpty()) { - throw new IllegalArgumentException(); - } - final List<EphemeralIntentFilter> ephemeralFilters = new ArrayList<>(1); - ephemeralFilters.add(new EphemeralIntentFilter(packageName, filters)); - mInstantAppResolveInfo = new InstantAppResolveInfo(uri.getHost(), packageName, - createInstantAppIntentFilterList(ephemeralFilters)); - mLegacyFilters = new ArrayList<IntentFilter>(filters.size()); - mLegacyFilters.addAll(filters); - } - - @Deprecated - public EphemeralResolveInfo(@NonNull EphemeralDigest digest, @Nullable String packageName, - @Nullable List<EphemeralIntentFilter> filters) { - this(digest, packageName, filters, -1 /*versionCode*/); - } - - public EphemeralResolveInfo(@NonNull EphemeralDigest digest, @Nullable String packageName, - @Nullable List<EphemeralIntentFilter> filters, int versionCode) { - mInstantAppResolveInfo = new InstantAppResolveInfo( - digest.getInstantAppDigest(), packageName, - createInstantAppIntentFilterList(filters), versionCode); - mLegacyFilters = null; - } - - public EphemeralResolveInfo(@NonNull String hostName, @Nullable String packageName, - @Nullable List<EphemeralIntentFilter> filters) { - this(new EphemeralDigest(hostName), packageName, filters); - } - - EphemeralResolveInfo(Parcel in) { - mInstantAppResolveInfo = in.readParcelable(null /*loader*/); - mLegacyFilters = new ArrayList<IntentFilter>(); - in.readList(mLegacyFilters, null /*loader*/); - } - - /** @hide */ - public InstantAppResolveInfo getInstantAppResolveInfo() { - return mInstantAppResolveInfo; - } - - private static List<InstantAppIntentFilter> createInstantAppIntentFilterList( - List<EphemeralIntentFilter> filters) { - if (filters == null) { - return null; - } - final int filterCount = filters.size(); - final List<InstantAppIntentFilter> returnList = new ArrayList<>(filterCount); - for (int i = 0; i < filterCount; i++) { - returnList.add(filters.get(i).getInstantAppIntentFilter()); - } - return returnList; - } - - public byte[] getDigestBytes() { - return mInstantAppResolveInfo.getDigestBytes(); - } - - public int getDigestPrefix() { - return mInstantAppResolveInfo.getDigestPrefix(); - } - - public String getPackageName() { - return mInstantAppResolveInfo.getPackageName(); - } - - public List<EphemeralIntentFilter> getIntentFilters() { - final List<InstantAppIntentFilter> filters = mInstantAppResolveInfo.getIntentFilters(); - final int filterCount = filters.size(); - final List<EphemeralIntentFilter> returnList = new ArrayList<>(filterCount); - for (int i = 0; i < filterCount; i++) { - returnList.add(new EphemeralIntentFilter(filters.get(i))); - } - return returnList; - } - - public int getVersionCode() { - return mInstantAppResolveInfo.getVersionCode(); - } - - @Deprecated - public List<IntentFilter> getFilters() { - return mLegacyFilters; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - out.writeParcelable(mInstantAppResolveInfo, flags); - out.writeList(mLegacyFilters); - } - - public static final Parcelable.Creator<EphemeralResolveInfo> CREATOR - = new Parcelable.Creator<EphemeralResolveInfo>() { - @Override - public EphemeralResolveInfo createFromParcel(Parcel in) { - return new EphemeralResolveInfo(in); - } - @Override - public EphemeralResolveInfo[] newArray(int size) { - return new EphemeralResolveInfo[size]; - } - }; - - /** - * Helper class to generate and store each of the digests and prefixes - * sent to the Ephemeral Resolver. - * <p> - * Since intent filters may want to handle multiple hosts within a - * domain [eg “*.google.com”], the resolver is presented with multiple - * hash prefixes. For example, "a.b.c.d.e" generates digests for - * "d.e", "c.d.e", "b.c.d.e" and "a.b.c.d.e". - * - * @hide - */ - @SystemApi - public static final class EphemeralDigest implements Parcelable { - private final InstantAppDigest mInstantAppDigest; - - public EphemeralDigest(@NonNull String hostName) { - this(hostName, -1 /*maxDigests*/); - } - - /** @hide */ - public EphemeralDigest(@NonNull String hostName, int maxDigests) { - mInstantAppDigest = new InstantAppDigest(hostName, maxDigests); - } - - EphemeralDigest(Parcel in) { - mInstantAppDigest = in.readParcelable(null /*loader*/); - } - - /** @hide */ - InstantAppDigest getInstantAppDigest() { - return mInstantAppDigest; - } - - public byte[][] getDigestBytes() { - return mInstantAppDigest.getDigestBytes(); - } - - public int[] getDigestPrefix() { - return mInstantAppDigest.getDigestPrefix(); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - out.writeParcelable(mInstantAppDigest, flags); - } - - @SuppressWarnings("hiding") - public static final Parcelable.Creator<EphemeralDigest> CREATOR = - new Parcelable.Creator<EphemeralDigest>() { - @Override - public EphemeralDigest createFromParcel(Parcel in) { - return new EphemeralDigest(in); - } - @Override - public EphemeralDigest[] newArray(int size) { - return new EphemeralDigest[size]; - } - }; - } -} |
