1 /*
2  * Copyright (C) 2023 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 
23 import com.android.ondevicepersonalization.internal.util.DataClass;
24 
25 /**
26  * Parcelable version of {@link EventOutput}.
27  * @hide
28  */
29 @DataClass(genAidl = false, genBuilder = false)
30 public final class EventOutputParcel implements Parcelable {
31     /**
32      * An {@link EventLogRecord} to be written to the EVENTS table, if not null. Each
33      * {@link EventLogRecord} is associated with a row in an existing {@link RequestLogRecord} that
34      * has been written to the REQUESTS table.
35      */
36     @Nullable EventLogRecord mEventLogRecord = null;
37 
38     /** @hide */
EventOutputParcel(@onNull EventOutput value)39     public EventOutputParcel(@NonNull EventOutput value) {
40         this(value.getEventLogRecord());
41     }
42 
43 
44 
45     // Code below generated by codegen v1.0.23.
46     //
47     // DO NOT MODIFY!
48     // CHECKSTYLE:OFF Generated code
49     //
50     // To regenerate run:
51     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/EventOutputParcel.java
52     //
53     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
54     //   Settings > Editor > Code Style > Formatter Control
55     //@formatter:off
56 
57 
58     /**
59      * Creates a new EventOutputParcel.
60      *
61      * @param eventLogRecord
62      *   An {@link EventLogRecord} to be written to the EVENTS table, if not null. Each
63      *   {@link EventLogRecord} is associated with a row in an existing {@link RequestLogRecord} that
64      *   has been written to the REQUESTS table.
65      */
66     @DataClass.Generated.Member
EventOutputParcel( @ullable EventLogRecord eventLogRecord)67     public EventOutputParcel(
68             @Nullable EventLogRecord eventLogRecord) {
69         this.mEventLogRecord = eventLogRecord;
70 
71         // onConstructed(); // You can define this method to get a callback
72     }
73 
74     /**
75      * An {@link EventLogRecord} to be written to the EVENTS table, if not null. Each
76      * {@link EventLogRecord} is associated with a row in an existing {@link RequestLogRecord} that
77      * has been written to the REQUESTS table.
78      */
79     @DataClass.Generated.Member
getEventLogRecord()80     public @Nullable EventLogRecord getEventLogRecord() {
81         return mEventLogRecord;
82     }
83 
84     @Override
85     @DataClass.Generated.Member
writeToParcel(@ndroid.annotation.NonNull android.os.Parcel dest, int flags)86     public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
87         // You can override field parcelling by defining methods like:
88         // void parcelFieldName(Parcel dest, int flags) { ... }
89 
90         byte flg = 0;
91         if (mEventLogRecord != null) flg |= 0x1;
92         dest.writeByte(flg);
93         if (mEventLogRecord != null) dest.writeTypedObject(mEventLogRecord, flags);
94     }
95 
96     @Override
97     @DataClass.Generated.Member
describeContents()98     public int describeContents() { return 0; }
99 
100     /** @hide */
101     @SuppressWarnings({"unchecked", "RedundantCast"})
102     @DataClass.Generated.Member
EventOutputParcel(@ndroid.annotation.NonNull android.os.Parcel in)103     /* package-private */ EventOutputParcel(@android.annotation.NonNull android.os.Parcel in) {
104         // You can override field unparcelling by defining methods like:
105         // static FieldType unparcelFieldName(Parcel in) { ... }
106 
107         byte flg = in.readByte();
108         EventLogRecord eventLogRecord = (flg & 0x1) == 0 ? null : (EventLogRecord) in.readTypedObject(EventLogRecord.CREATOR);
109 
110         this.mEventLogRecord = eventLogRecord;
111 
112         // onConstructed(); // You can define this method to get a callback
113     }
114 
115     @DataClass.Generated.Member
116     public static final @android.annotation.NonNull Parcelable.Creator<EventOutputParcel> CREATOR
117             = new Parcelable.Creator<EventOutputParcel>() {
118         @Override
119         public EventOutputParcel[] newArray(int size) {
120             return new EventOutputParcel[size];
121         }
122 
123         @Override
124         public EventOutputParcel createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
125             return new EventOutputParcel(in);
126         }
127     };
128 
129     @DataClass.Generated(
130             time = 1698864082503L,
131             codegenVersion = "1.0.23",
132             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/EventOutputParcel.java",
133             inputSignatures = " @android.annotation.Nullable android.adservices.ondevicepersonalization.EventLogRecord mEventLogRecord\nclass EventOutputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genAidl=false, genBuilder=false)")
134     @Deprecated
__metadata()135     private void __metadata() {}
136 
137 
138     //@formatter:on
139     // End of generated code
140 
141 }
142