Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 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; |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 20 | import android.os.Bundle; |
Patrick Baumann | 4db6bc1 | 2018-02-06 09:55:36 -0800 | [diff] [blame] | 21 | import android.text.TextUtils; |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 22 | |
| 23 | /** |
Todd Kennedy | 1fb3404 | 2017-03-01 13:56:58 -0800 | [diff] [blame] | 24 | * Information needed to make an instant application resolution request. |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 25 | * @hide |
| 26 | */ |
Todd Kennedy | 1fb3404 | 2017-03-01 13:56:58 -0800 | [diff] [blame] | 27 | public final class InstantAppRequest { |
Patrick Baumann | 4db6bc1 | 2018-02-06 09:55:36 -0800 | [diff] [blame] | 28 | |
Todd Kennedy | 1fb3404 | 2017-03-01 13:56:58 -0800 | [diff] [blame] | 29 | /** Response from the first phase of instant application resolution */ |
Todd Kennedy | e991022 | 2017-02-21 16:00:11 -0800 | [diff] [blame] | 30 | public final AuxiliaryResolveInfo responseObj; |
Todd Kennedy | 1fb3404 | 2017-03-01 13:56:58 -0800 | [diff] [blame] | 31 | /** The original intent that triggered instant application resolution */ |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 32 | public final Intent origIntent; |
| 33 | /** Resolved type of the intent */ |
| 34 | public final String resolvedType; |
Todd Kennedy | 1fb3404 | 2017-03-01 13:56:58 -0800 | [diff] [blame] | 35 | /** The name of the package requesting the instant application */ |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 36 | public final String callingPackage; |
Todd Kennedy | 1fb3404 | 2017-03-01 13:56:58 -0800 | [diff] [blame] | 37 | /** ID of the user requesting the instant application */ |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 38 | public final int userId; |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 39 | /** |
| 40 | * Optional extra bundle provided by the source application to the installer for additional |
| 41 | * verification. */ |
| 42 | public final Bundle verificationBundle; |
Todd Kennedy | 6ebabca | 2017-08-22 10:02:12 -0700 | [diff] [blame] | 43 | /** Whether resolution occurs because an application is starting */ |
| 44 | public final boolean resolveForStart; |
Patrick Baumann | 4db6bc1 | 2018-02-06 09:55:36 -0800 | [diff] [blame] | 45 | /** The instant app digest for this request */ |
| 46 | public final InstantAppResolveInfo.InstantAppDigest digest; |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 47 | |
Todd Kennedy | 1fb3404 | 2017-03-01 13:56:58 -0800 | [diff] [blame] | 48 | public InstantAppRequest(AuxiliaryResolveInfo responseObj, Intent origIntent, |
Todd Kennedy | 6ebabca | 2017-08-22 10:02:12 -0700 | [diff] [blame] | 49 | String resolvedType, String callingPackage, int userId, Bundle verificationBundle, |
| 50 | boolean resolveForStart) { |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 51 | this.responseObj = responseObj; |
| 52 | this.origIntent = origIntent; |
| 53 | this.resolvedType = resolvedType; |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 54 | this.callingPackage = callingPackage; |
| 55 | this.userId = userId; |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 56 | this.verificationBundle = verificationBundle; |
Todd Kennedy | 6ebabca | 2017-08-22 10:02:12 -0700 | [diff] [blame] | 57 | this.resolveForStart = resolveForStart; |
Patrick Baumann | 4db6bc1 | 2018-02-06 09:55:36 -0800 | [diff] [blame] | 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 | } |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 64 | } |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 65 | } |