1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.content.pm; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.content.Intent; 22 import android.content.IntentFilter; 23 24 /** 25 * Auxiliary application resolution response. 26 * <p> 27 * Used when resolution occurs, but, the target is not actually on the device. 28 * This happens resolving instant apps that haven't been installed yet or if 29 * the application consists of multiple feature splits and the needed split 30 * hasn't been installed. 31 * @hide 32 */ 33 public final class AuxiliaryResolveInfo extends IntentFilter { 34 /** Resolved information returned from the external instant resolver */ 35 public final InstantAppResolveInfo resolveInfo; 36 /** The resolved package. Copied from {@link #resolveInfo}. */ 37 public final String packageName; 38 /** The resolve split. Copied from the matched filter in {@link #resolveInfo}. */ 39 public final String splitName; 40 /** Whether or not instant resolution needs the second phase */ 41 public final boolean needsPhaseTwo; 42 /** Opaque token to track the instant application resolution */ 43 public final String token; 44 /** The version code of the package */ 45 public final int versionCode; 46 /** An intent to start upon failure to install */ 47 public final Intent failureIntent; 48 49 /** Create a response for installing an instant application. */ AuxiliaryResolveInfo(@onNull InstantAppResolveInfo resolveInfo, @NonNull IntentFilter orig, @Nullable String splitName, @NonNull String token, boolean needsPhase2, @Nullable Intent failureIntent)50 public AuxiliaryResolveInfo(@NonNull InstantAppResolveInfo resolveInfo, 51 @NonNull IntentFilter orig, 52 @Nullable String splitName, 53 @NonNull String token, 54 boolean needsPhase2, 55 @Nullable Intent failureIntent) { 56 super(orig); 57 this.resolveInfo = resolveInfo; 58 this.packageName = resolveInfo.getPackageName(); 59 this.splitName = splitName; 60 this.token = token; 61 this.needsPhaseTwo = needsPhase2; 62 this.versionCode = resolveInfo.getVersionCode(); 63 this.failureIntent = failureIntent; 64 } 65 66 /** Create a response for installing a split on demand. */ AuxiliaryResolveInfo(@onNull String packageName, @Nullable String splitName, int versionCode, @Nullable Intent failureIntent)67 public AuxiliaryResolveInfo(@NonNull String packageName, 68 @Nullable String splitName, 69 int versionCode, 70 @Nullable Intent failureIntent) { 71 super(); 72 this.packageName = packageName; 73 this.splitName = splitName; 74 this.versionCode = versionCode; 75 this.resolveInfo = null; 76 this.token = null; 77 this.needsPhaseTwo = false; 78 this.failureIntent = failureIntent; 79 } 80 }