• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.annotation.Nullable;
21 import android.os.Parcelable;
22 import android.os.PersistableBundle;
23 
24 import com.android.ondevicepersonalization.internal.util.AnnotationValidations;
25 import com.android.ondevicepersonalization.internal.util.DataClass;
26 
27 /**
28  * Parcelable version of {@link RenderOutput}.
29  * @hide
30  */
31 @DataClass(genAidl = false, genBuilder = false)
32 public final class RenderOutputParcel implements Parcelable {
33     /**
34      * The HTML content to be rendered in a webview. If this is null, the ODP service
35      * generates HTML from the data in {@link #getTemplateId()} and {@link #getTemplateParams()}
36      * as described below.
37      */
38     @Nullable private String mContent = null;
39 
40     /**
41      * A key in the REMOTE_DATA {@link IsolatedService#getRemoteData(RequestToken)} table that
42      * points to an <a href="velocity.apache.org">Apache Velocity</a> template. This is ignored if
43      * {@link #getContent()} is not null.
44      */
45     @Nullable private String mTemplateId = null;
46 
47     /**
48      * The parameters to be populated in the template from {@link #getTemplateId()}. This is
49      * ignored if {@link #getContent()} is not null.
50      */
51     @NonNull private PersistableBundle mTemplateParams = PersistableBundle.EMPTY;
52 
53     /** @hide */
RenderOutputParcel(@onNull RenderOutput value)54     public RenderOutputParcel(@NonNull RenderOutput value) {
55         this(value.getContent(), value.getTemplateId(), value.getTemplateParams());
56     }
57 
58 
59 
60     // Code below generated by codegen v1.0.23.
61     //
62     // DO NOT MODIFY!
63     // CHECKSTYLE:OFF Generated code
64     //
65     // To regenerate run:
66     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/RenderOutputParcel.java
67     //
68     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
69     //   Settings > Editor > Code Style > Formatter Control
70     //@formatter:off
71 
72 
73     /**
74      * Creates a new RenderOutputParcel.
75      *
76      * @param content
77      *   The HTML content to be rendered in a webview. If this is null, the ODP service
78      *   generates HTML from the data in {@link #getTemplateId()} and {@link #getTemplateParams()}
79      *   as described below.
80      * @param templateId
81      *   A key in the REMOTE_DATA {@link IsolatedService#getRemoteData(RequestToken)} table that
82      *   points to an <a href="velocity.apache.org">Apache Velocity</a> template. This is ignored if
83      *   {@link #getContent()} is not null.
84      * @param templateParams
85      *   The parameters to be populated in the template from {@link #getTemplateId()}. This is
86      *   ignored if {@link #getContent()} is not null.
87      */
88     @DataClass.Generated.Member
RenderOutputParcel( @ullable String content, @Nullable String templateId, @NonNull PersistableBundle templateParams)89     public RenderOutputParcel(
90             @Nullable String content,
91             @Nullable String templateId,
92             @NonNull PersistableBundle templateParams) {
93         this.mContent = content;
94         this.mTemplateId = templateId;
95         this.mTemplateParams = templateParams;
96         AnnotationValidations.validate(
97                 NonNull.class, null, mTemplateParams);
98 
99         // onConstructed(); // You can define this method to get a callback
100     }
101 
102     /**
103      * The HTML content to be rendered in a webview. If this is null, the ODP service
104      * generates HTML from the data in {@link #getTemplateId()} and {@link #getTemplateParams()}
105      * as described below.
106      */
107     @DataClass.Generated.Member
getContent()108     public @Nullable String getContent() {
109         return mContent;
110     }
111 
112     /**
113      * A key in the REMOTE_DATA {@link IsolatedService#getRemoteData(RequestToken)} table that
114      * points to an <a href="velocity.apache.org">Apache Velocity</a> template. This is ignored if
115      * {@link #getContent()} is not null.
116      */
117     @DataClass.Generated.Member
getTemplateId()118     public @Nullable String getTemplateId() {
119         return mTemplateId;
120     }
121 
122     /**
123      * The parameters to be populated in the template from {@link #getTemplateId()}. This is
124      * ignored if {@link #getContent()} is not null.
125      */
126     @DataClass.Generated.Member
getTemplateParams()127     public @NonNull PersistableBundle getTemplateParams() {
128         return mTemplateParams;
129     }
130 
131     @Override
132     @DataClass.Generated.Member
writeToParcel(@onNull android.os.Parcel dest, int flags)133     public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
134         // You can override field parcelling by defining methods like:
135         // void parcelFieldName(Parcel dest, int flags) { ... }
136 
137         byte flg = 0;
138         if (mContent != null) flg |= 0x1;
139         if (mTemplateId != null) flg |= 0x2;
140         dest.writeByte(flg);
141         if (mContent != null) dest.writeString(mContent);
142         if (mTemplateId != null) dest.writeString(mTemplateId);
143         dest.writeTypedObject(mTemplateParams, flags);
144     }
145 
146     @Override
147     @DataClass.Generated.Member
describeContents()148     public int describeContents() { return 0; }
149 
150     /** @hide */
151     @SuppressWarnings({"unchecked", "RedundantCast"})
152     @DataClass.Generated.Member
RenderOutputParcel(@onNull android.os.Parcel in)153     /* package-private */ RenderOutputParcel(@NonNull android.os.Parcel in) {
154         // You can override field unparcelling by defining methods like:
155         // static FieldType unparcelFieldName(Parcel in) { ... }
156 
157         byte flg = in.readByte();
158         String content = (flg & 0x1) == 0 ? null : in.readString();
159         String templateId = (flg & 0x2) == 0 ? null : in.readString();
160         PersistableBundle templateParams = (PersistableBundle) in.readTypedObject(PersistableBundle.CREATOR);
161 
162         this.mContent = content;
163         this.mTemplateId = templateId;
164         this.mTemplateParams = templateParams;
165         AnnotationValidations.validate(
166                 NonNull.class, null, mTemplateParams);
167 
168         // onConstructed(); // You can define this method to get a callback
169     }
170 
171     @DataClass.Generated.Member
172     public static final @NonNull Parcelable.Creator<RenderOutputParcel> CREATOR
173             = new Parcelable.Creator<RenderOutputParcel>() {
174         @Override
175         public RenderOutputParcel[] newArray(int size) {
176             return new RenderOutputParcel[size];
177         }
178 
179         @Override
180         public RenderOutputParcel createFromParcel(@NonNull android.os.Parcel in) {
181             return new RenderOutputParcel(in);
182         }
183     };
184 
185     @DataClass.Generated(
186             time = 1698864341247L,
187             codegenVersion = "1.0.23",
188             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/RenderOutputParcel.java",
189             inputSignatures = "private @android.annotation.Nullable java.lang.String mContent\nprivate @android.annotation.Nullable java.lang.String mTemplateId\nprivate @android.annotation.NonNull android.os.PersistableBundle mTemplateParams\nclass RenderOutputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genAidl=false, genBuilder=false)")
190     @Deprecated
__metadata()191     private void __metadata() {}
192 
193 
194     //@formatter:on
195     // End of generated code
196 
197 }
198