1 /*
2  * Copyright (C) 2022 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.adservices.ondevicepersonalization;
18 
19 import android.annotation.NonNull;
20 import android.net.Uri;
21 import android.os.Parcelable;
22 
23 import com.android.ondevicepersonalization.internal.util.AnnotationValidations;
24 import com.android.ondevicepersonalization.internal.util.DataClass;
25 
26 /**
27  * Parcelable version of {@link WebTriggerInput}.
28  * @hide
29  */
30 @DataClass(genAidl = false, genHiddenBuilder = true)
31 public final class WebTriggerInputParcel implements Parcelable {
32     /** The destination URL (landing page) where the trigger registration occurred. */
33     @NonNull private Uri mDestinationUrl;
34 
35     /** The app where the trigger registration occurred */
36     @NonNull private String mAppPackageName;
37 
38     /** The data to be sent to the isolated service.  */
39     @NonNull private byte[] mData;
40 
41 
42 
43     // Code below generated by codegen v1.0.23.
44     //
45     // DO NOT MODIFY!
46     // CHECKSTYLE:OFF Generated code
47     //
48     // To regenerate run:
49     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/WebTriggerInputParcel.java
50     //
51     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
52     //   Settings > Editor > Code Style > Formatter Control
53     //@formatter:off
54 
55 
56     @DataClass.Generated.Member
WebTriggerInputParcel( @onNull Uri destinationUrl, @NonNull String appPackageName, @NonNull byte[] data)57     /* package-private */ WebTriggerInputParcel(
58             @NonNull Uri destinationUrl,
59             @NonNull String appPackageName,
60             @NonNull byte[] data) {
61         this.mDestinationUrl = destinationUrl;
62         AnnotationValidations.validate(
63                 NonNull.class, null, mDestinationUrl);
64         this.mAppPackageName = appPackageName;
65         AnnotationValidations.validate(
66                 NonNull.class, null, mAppPackageName);
67         this.mData = data;
68         AnnotationValidations.validate(
69                 NonNull.class, null, mData);
70 
71         // onConstructed(); // You can define this method to get a callback
72     }
73 
74     /**
75      * The destination URL (landing page) where the trigger registration occurred.
76      */
77     @DataClass.Generated.Member
getDestinationUrl()78     public @NonNull Uri getDestinationUrl() {
79         return mDestinationUrl;
80     }
81 
82     /**
83      * The app where the trigger registration occurred
84      */
85     @DataClass.Generated.Member
getAppPackageName()86     public @NonNull String getAppPackageName() {
87         return mAppPackageName;
88     }
89 
90     /**
91      * The data to be sent to the isolated service.
92      */
93     @DataClass.Generated.Member
getData()94     public @NonNull byte[] getData() {
95         return mData;
96     }
97 
98     @Override
99     @DataClass.Generated.Member
writeToParcel(@onNull android.os.Parcel dest, int flags)100     public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
101         // You can override field parcelling by defining methods like:
102         // void parcelFieldName(Parcel dest, int flags) { ... }
103 
104         dest.writeTypedObject(mDestinationUrl, flags);
105         dest.writeString(mAppPackageName);
106         dest.writeByteArray(mData);
107     }
108 
109     @Override
110     @DataClass.Generated.Member
describeContents()111     public int describeContents() { return 0; }
112 
113     /** @hide */
114     @SuppressWarnings({"unchecked", "RedundantCast"})
115     @DataClass.Generated.Member
WebTriggerInputParcel(@onNull android.os.Parcel in)116     /* package-private */ WebTriggerInputParcel(@NonNull android.os.Parcel in) {
117         // You can override field unparcelling by defining methods like:
118         // static FieldType unparcelFieldName(Parcel in) { ... }
119 
120         Uri destinationUrl = (Uri) in.readTypedObject(Uri.CREATOR);
121         String appPackageName = in.readString();
122         byte[] data = in.createByteArray();
123 
124         this.mDestinationUrl = destinationUrl;
125         AnnotationValidations.validate(
126                 NonNull.class, null, mDestinationUrl);
127         this.mAppPackageName = appPackageName;
128         AnnotationValidations.validate(
129                 NonNull.class, null, mAppPackageName);
130         this.mData = data;
131         AnnotationValidations.validate(
132                 NonNull.class, null, mData);
133 
134         // onConstructed(); // You can define this method to get a callback
135     }
136 
137     @DataClass.Generated.Member
138     public static final @NonNull Parcelable.Creator<WebTriggerInputParcel> CREATOR
139             = new Parcelable.Creator<WebTriggerInputParcel>() {
140         @Override
141         public WebTriggerInputParcel[] newArray(int size) {
142             return new WebTriggerInputParcel[size];
143         }
144 
145         @Override
146         public WebTriggerInputParcel createFromParcel(@NonNull android.os.Parcel in) {
147             return new WebTriggerInputParcel(in);
148         }
149     };
150 
151     /**
152      * A builder for {@link WebTriggerInputParcel}
153      * @hide
154      */
155     @SuppressWarnings("WeakerAccess")
156     @DataClass.Generated.Member
157     public static final class Builder {
158 
159         private @NonNull Uri mDestinationUrl;
160         private @NonNull String mAppPackageName;
161         private @NonNull byte[] mData;
162 
163         private long mBuilderFieldsSet = 0L;
164 
165         /**
166          * Creates a new Builder.
167          *
168          * @param destinationUrl
169          *   The destination URL (landing page) where the trigger registration occurred.
170          * @param appPackageName
171          *   The app where the trigger registration occurred
172          * @param data
173          *   The data to be sent to the isolated service.
174          */
Builder( @onNull Uri destinationUrl, @NonNull String appPackageName, @NonNull byte[] data)175         public Builder(
176                 @NonNull Uri destinationUrl,
177                 @NonNull String appPackageName,
178                 @NonNull byte[] data) {
179             mDestinationUrl = destinationUrl;
180             AnnotationValidations.validate(
181                     NonNull.class, null, mDestinationUrl);
182             mAppPackageName = appPackageName;
183             AnnotationValidations.validate(
184                     NonNull.class, null, mAppPackageName);
185             mData = data;
186             AnnotationValidations.validate(
187                     NonNull.class, null, mData);
188         }
189 
190         /**
191          * The destination URL (landing page) where the trigger registration occurred.
192          */
193         @DataClass.Generated.Member
setDestinationUrl(@onNull Uri value)194         public @NonNull Builder setDestinationUrl(@NonNull Uri value) {
195             checkNotUsed();
196             mBuilderFieldsSet |= 0x1;
197             mDestinationUrl = value;
198             return this;
199         }
200 
201         /**
202          * The app where the trigger registration occurred
203          */
204         @DataClass.Generated.Member
setAppPackageName(@onNull String value)205         public @NonNull Builder setAppPackageName(@NonNull String value) {
206             checkNotUsed();
207             mBuilderFieldsSet |= 0x2;
208             mAppPackageName = value;
209             return this;
210         }
211 
212         /**
213          * The data to be sent to the isolated service.
214          */
215         @DataClass.Generated.Member
setData(@onNull byte... value)216         public @NonNull Builder setData(@NonNull byte... value) {
217             checkNotUsed();
218             mBuilderFieldsSet |= 0x4;
219             mData = value;
220             return this;
221         }
222 
223         /** Builds the instance. This builder should not be touched after calling this! */
build()224         public @NonNull WebTriggerInputParcel build() {
225             checkNotUsed();
226             mBuilderFieldsSet |= 0x8; // Mark builder used
227 
228             WebTriggerInputParcel o = new WebTriggerInputParcel(
229                     mDestinationUrl,
230                     mAppPackageName,
231                     mData);
232             return o;
233         }
234 
checkNotUsed()235         private void checkNotUsed() {
236             if ((mBuilderFieldsSet & 0x8) != 0) {
237                 throw new IllegalStateException(
238                         "This Builder should not be reused. Use a new Builder instance instead");
239             }
240         }
241     }
242 
243     @DataClass.Generated(
244             time = 1707510196470L,
245             codegenVersion = "1.0.23",
246             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/WebTriggerInputParcel.java",
247             inputSignatures = "private @android.annotation.NonNull android.net.Uri mDestinationUrl\nprivate @android.annotation.NonNull java.lang.String mAppPackageName\nprivate @android.annotation.NonNull byte[] mData\nclass WebTriggerInputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genAidl=false, genHiddenBuilder=true)")
248     @Deprecated
__metadata()249     private void __metadata() {}
250 
251 
252     //@formatter:on
253     // End of generated code
254 
255 }
256