1 /* 2 * Copyright (C) 2019 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.annotation.SystemApi; 22 import android.content.Intent; 23 import android.os.Parcelable; 24 import android.os.UserHandle; 25 26 import com.android.internal.util.DataClass; 27 28 /** 29 * Information exposed to {@link android.app.InstantAppResolverService} to complete 30 * an instant application resolution request. 31 * @hide 32 */ 33 @SystemApi 34 @DataClass(genParcelable = true, genConstructor = true, genAidl = true, genGetters = true) 35 public final class InstantAppRequestInfo implements Parcelable { 36 37 /** 38 * The sanitized {@link Intent} used for resolution. A sanitized Intent is an intent with 39 * potential PII removed from the original intent. Fields removed include extras and the 40 * host + path of the data, if defined. 41 */ 42 @NonNull 43 private final Intent mIntent; 44 45 /** The hash prefix of the instant app's domain or null if no host is defined. */ 46 @Nullable 47 private final int[] mHostDigestPrefix; 48 49 /** The user requesting the instant application */ 50 @NonNull 51 private final UserHandle mUserHandle; 52 53 /** Whether or not the requesting package was an instant app itself */ 54 private final boolean mRequesterInstantApp; 55 56 /** A unique identifier */ 57 @NonNull 58 private final String mToken; 59 60 61 62 // Code below generated by codegen v1.0.15. 63 // 64 // DO NOT MODIFY! 65 // CHECKSTYLE:OFF Generated code 66 // 67 // To regenerate run: 68 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/InstantAppRequestInfo.java 69 // 70 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 71 // Settings > Editor > Code Style > Formatter Control 72 //@formatter:off 73 74 75 /** 76 * Creates a new InstantAppRequestInfo. 77 * 78 * @param intent 79 * The sanitized {@link Intent} used for resolution. A sanitized Intent is an intent with 80 * potential PII removed from the original intent. Fields removed include extras and the 81 * host + path of the data, if defined. 82 * @param hostDigestPrefix 83 * The hash prefix of the instant app's domain or null if no host is defined. 84 * @param userHandle 85 * The user requesting the instant application 86 * @param requesterInstantApp 87 * Whether or not the requesting package was an instant app itself 88 * @param token 89 * A unique identifier 90 */ 91 @DataClass.Generated.Member InstantAppRequestInfo( @onNull Intent intent, @Nullable int[] hostDigestPrefix, @NonNull UserHandle userHandle, boolean requesterInstantApp, @NonNull String token)92 public InstantAppRequestInfo( 93 @NonNull Intent intent, 94 @Nullable int[] hostDigestPrefix, 95 @NonNull UserHandle userHandle, 96 boolean requesterInstantApp, 97 @NonNull String token) { 98 this.mIntent = intent; 99 com.android.internal.util.AnnotationValidations.validate( 100 NonNull.class, null, mIntent); 101 this.mHostDigestPrefix = hostDigestPrefix; 102 this.mUserHandle = userHandle; 103 com.android.internal.util.AnnotationValidations.validate( 104 NonNull.class, null, mUserHandle); 105 this.mRequesterInstantApp = requesterInstantApp; 106 this.mToken = token; 107 com.android.internal.util.AnnotationValidations.validate( 108 NonNull.class, null, mToken); 109 110 // onConstructed(); // You can define this method to get a callback 111 } 112 113 /** 114 * The sanitized {@link Intent} used for resolution. A sanitized Intent is an intent with 115 * potential PII removed from the original intent. Fields removed include extras and the 116 * host + path of the data, if defined. 117 */ 118 @DataClass.Generated.Member getIntent()119 public @NonNull Intent getIntent() { 120 return mIntent; 121 } 122 123 /** 124 * The hash prefix of the instant app's domain or null if no host is defined. 125 */ 126 @DataClass.Generated.Member getHostDigestPrefix()127 public @Nullable int[] getHostDigestPrefix() { 128 return mHostDigestPrefix; 129 } 130 131 /** 132 * The user requesting the instant application 133 */ 134 @DataClass.Generated.Member getUserHandle()135 public @NonNull UserHandle getUserHandle() { 136 return mUserHandle; 137 } 138 139 /** 140 * Whether or not the requesting package was an instant app itself 141 */ 142 @DataClass.Generated.Member isRequesterInstantApp()143 public boolean isRequesterInstantApp() { 144 return mRequesterInstantApp; 145 } 146 147 /** 148 * A unique identifier 149 */ 150 @DataClass.Generated.Member getToken()151 public @NonNull String getToken() { 152 return mToken; 153 } 154 155 @Override 156 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)157 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 158 // You can override field parcelling by defining methods like: 159 // void parcelFieldName(Parcel dest, int flags) { ... } 160 161 byte flg = 0; 162 if (mRequesterInstantApp) flg |= 0x8; 163 if (mHostDigestPrefix != null) flg |= 0x2; 164 dest.writeByte(flg); 165 dest.writeTypedObject(mIntent, flags); 166 if (mHostDigestPrefix != null) dest.writeIntArray(mHostDigestPrefix); 167 dest.writeTypedObject(mUserHandle, flags); 168 dest.writeString(mToken); 169 } 170 171 @Override 172 @DataClass.Generated.Member describeContents()173 public int describeContents() { return 0; } 174 175 /** @hide */ 176 @SuppressWarnings({"unchecked", "RedundantCast"}) 177 @DataClass.Generated.Member InstantAppRequestInfo(@onNull android.os.Parcel in)178 /* package-private */ InstantAppRequestInfo(@NonNull android.os.Parcel in) { 179 // You can override field unparcelling by defining methods like: 180 // static FieldType unparcelFieldName(Parcel in) { ... } 181 182 byte flg = in.readByte(); 183 boolean requesterInstantApp = (flg & 0x8) != 0; 184 Intent intent = (Intent) in.readTypedObject(Intent.CREATOR); 185 int[] hostDigestPrefix = (flg & 0x2) == 0 ? null : in.createIntArray(); 186 UserHandle userHandle = (UserHandle) in.readTypedObject(UserHandle.CREATOR); 187 String token = in.readString(); 188 189 this.mIntent = intent; 190 com.android.internal.util.AnnotationValidations.validate( 191 NonNull.class, null, mIntent); 192 this.mHostDigestPrefix = hostDigestPrefix; 193 this.mUserHandle = userHandle; 194 com.android.internal.util.AnnotationValidations.validate( 195 NonNull.class, null, mUserHandle); 196 this.mRequesterInstantApp = requesterInstantApp; 197 this.mToken = token; 198 com.android.internal.util.AnnotationValidations.validate( 199 NonNull.class, null, mToken); 200 201 // onConstructed(); // You can define this method to get a callback 202 } 203 204 @DataClass.Generated.Member 205 public static final @NonNull Parcelable.Creator<InstantAppRequestInfo> CREATOR 206 = new Parcelable.Creator<InstantAppRequestInfo>() { 207 @Override 208 public InstantAppRequestInfo[] newArray(int size) { 209 return new InstantAppRequestInfo[size]; 210 } 211 212 @Override 213 public InstantAppRequestInfo createFromParcel(@NonNull android.os.Parcel in) { 214 return new InstantAppRequestInfo(in); 215 } 216 }; 217 218 @DataClass.Generated( 219 time = 1583964236162L, 220 codegenVersion = "1.0.15", 221 sourceFile = "frameworks/base/core/java/android/content/pm/InstantAppRequestInfo.java", 222 inputSignatures = "private final @android.annotation.NonNull android.content.Intent mIntent\nprivate final @android.annotation.Nullable int[] mHostDigestPrefix\nprivate final @android.annotation.NonNull android.os.UserHandle mUserHandle\nprivate final boolean mRequesterInstantApp\nprivate final @android.annotation.NonNull java.lang.String mToken\nclass InstantAppRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genConstructor=true, genAidl=true, genGetters=true)") 223 @Deprecated __metadata()224 private void __metadata() {} 225 226 227 //@formatter:on 228 // End of generated code 229 230 } 231