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.content.Intent; 20 import android.os.Bundle; 21 import android.text.TextUtils; 22 23 /** 24 * Information needed to make an instant application resolution request. 25 * @hide 26 */ 27 public final class InstantAppRequest { 28 29 /** Response from the first phase of instant application resolution */ 30 public final AuxiliaryResolveInfo responseObj; 31 /** The original intent that triggered instant application resolution */ 32 public final Intent origIntent; 33 /** Resolved type of the intent */ 34 public final String resolvedType; 35 /** The name of the package requesting the instant application */ 36 public final String callingPackage; 37 /** ID of the user requesting the instant application */ 38 public final int userId; 39 /** 40 * Optional extra bundle provided by the source application to the installer for additional 41 * verification. */ 42 public final Bundle verificationBundle; 43 /** Whether resolution occurs because an application is starting */ 44 public final boolean resolveForStart; 45 /** The instant app digest for this request */ 46 public final InstantAppResolveInfo.InstantAppDigest digest; 47 48 public InstantAppRequest(AuxiliaryResolveInfo responseObj, Intent origIntent, 49 String resolvedType, String callingPackage, int userId, Bundle verificationBundle, 50 boolean resolveForStart) { 51 this.responseObj = responseObj; 52 this.origIntent = origIntent; 53 this.resolvedType = resolvedType; 54 this.callingPackage = callingPackage; 55 this.userId = userId; 56 this.verificationBundle = verificationBundle; 57 this.resolveForStart = resolveForStart; 58 if (origIntent.getData() != null && !TextUtils.isEmpty(origIntent.getData().getHost())) { 59 digest = new InstantAppResolveInfo.InstantAppDigest( 60 origIntent.getData().getHost(), 5 /*maxDigests*/); 61 } else { 62 digest = InstantAppResolveInfo.InstantAppDigest.UNDEFINED; 63 } 64 } 65 } 66