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