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.Nullable;
20 import android.os.IBinder;
21 import android.os.Parcelable;
22 
23 import com.android.ondevicepersonalization.internal.util.DataClass;
24 
25 /**
26  * The input sent to the {@link IsolatedService}.
27  *
28  * @hide
29  */
30 @DataClass(genBuilder = true, genEqualsHashCode = true)
31 public class DownloadInputParcel implements Parcelable {
32     /** DataAccessService binder for downloaded content */
33     @Nullable
34     IBinder mDataAccessServiceBinder = null;
35 
36 
37 
38     // Code below generated by codegen v1.0.23.
39     //
40     // DO NOT MODIFY!
41     // CHECKSTYLE:OFF Generated code
42     //
43     // To regenerate run:
44     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/DownloadInputParcel.java
45     //
46     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
47     //   Settings > Editor > Code Style > Formatter Control
48     //@formatter:off
49 
50 
51     @DataClass.Generated.Member
DownloadInputParcel( @ullable IBinder dataAccessServiceBinder)52     /* package-private */ DownloadInputParcel(
53             @Nullable IBinder dataAccessServiceBinder) {
54         this.mDataAccessServiceBinder = dataAccessServiceBinder;
55 
56         // onConstructed(); // You can define this method to get a callback
57     }
58 
59     /**
60      * DataAccessService binder for downloaded content
61      */
62     @DataClass.Generated.Member
getDataAccessServiceBinder()63     public @Nullable IBinder getDataAccessServiceBinder() {
64         return mDataAccessServiceBinder;
65     }
66 
67     @Override
68     @DataClass.Generated.Member
equals(@ullable Object o)69     public boolean equals(@Nullable Object o) {
70         // You can override field equality logic by defining either of the methods like:
71         // boolean fieldNameEquals(DownloadInputParcel other) { ... }
72         // boolean fieldNameEquals(FieldType otherValue) { ... }
73 
74         if (this == o) return true;
75         if (o == null || getClass() != o.getClass()) return false;
76         @SuppressWarnings("unchecked")
77         DownloadInputParcel that = (DownloadInputParcel) o;
78         //noinspection PointlessBooleanExpression
79         return true
80                 && java.util.Objects.equals(mDataAccessServiceBinder, that.mDataAccessServiceBinder);
81     }
82 
83     @Override
84     @DataClass.Generated.Member
hashCode()85     public int hashCode() {
86         // You can override field hashCode logic by defining methods like:
87         // int fieldNameHashCode() { ... }
88 
89         int _hash = 1;
90         _hash = 31 * _hash + java.util.Objects.hashCode(mDataAccessServiceBinder);
91         return _hash;
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 (mDataAccessServiceBinder != null) flg |= 0x1;
102         dest.writeByte(flg);
103         if (mDataAccessServiceBinder != null) dest.writeStrongBinder(mDataAccessServiceBinder);
104     }
105 
106     @Override
107     @DataClass.Generated.Member
describeContents()108     public int describeContents() { return 0; }
109 
110     /** @hide */
111     @SuppressWarnings({"unchecked", "RedundantCast"})
112     @DataClass.Generated.Member
DownloadInputParcel(@ndroid.annotation.NonNull android.os.Parcel in)113     protected DownloadInputParcel(@android.annotation.NonNull android.os.Parcel in) {
114         // You can override field unparcelling by defining methods like:
115         // static FieldType unparcelFieldName(Parcel in) { ... }
116 
117         byte flg = in.readByte();
118         IBinder dataAccessServiceBinder = (flg & 0x1) == 0 ? null : (IBinder) in.readStrongBinder();
119 
120         this.mDataAccessServiceBinder = dataAccessServiceBinder;
121 
122         // onConstructed(); // You can define this method to get a callback
123     }
124 
125     @DataClass.Generated.Member
126     public static final @android.annotation.NonNull Parcelable.Creator<DownloadInputParcel> CREATOR
127             = new Parcelable.Creator<DownloadInputParcel>() {
128         @Override
129         public DownloadInputParcel[] newArray(int size) {
130             return new DownloadInputParcel[size];
131         }
132 
133         @Override
134         public DownloadInputParcel createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
135             return new DownloadInputParcel(in);
136         }
137     };
138 
139     /**
140      * A builder for {@link DownloadInputParcel}
141      */
142     @SuppressWarnings("WeakerAccess")
143     @DataClass.Generated.Member
144     public static class Builder {
145 
146         private @Nullable IBinder mDataAccessServiceBinder;
147 
148         private long mBuilderFieldsSet = 0L;
149 
Builder()150         public Builder() {
151         }
152 
153         /**
154          * DataAccessService binder for downloaded content
155          */
156         @DataClass.Generated.Member
setDataAccessServiceBinder(@ndroid.annotation.NonNull IBinder value)157         public @android.annotation.NonNull Builder setDataAccessServiceBinder(@android.annotation.NonNull IBinder value) {
158             checkNotUsed();
159             mBuilderFieldsSet |= 0x1;
160             mDataAccessServiceBinder = value;
161             return this;
162         }
163 
164         /** Builds the instance. This builder should not be touched after calling this! */
build()165         public @android.annotation.NonNull DownloadInputParcel build() {
166             checkNotUsed();
167             mBuilderFieldsSet |= 0x2; // Mark builder used
168 
169             if ((mBuilderFieldsSet & 0x1) == 0) {
170                 mDataAccessServiceBinder = null;
171             }
172             DownloadInputParcel o = new DownloadInputParcel(
173                     mDataAccessServiceBinder);
174             return o;
175         }
176 
checkNotUsed()177         private void checkNotUsed() {
178             if ((mBuilderFieldsSet & 0x2) != 0) {
179                 throw new IllegalStateException(
180                         "This Builder should not be reused. Use a new Builder instance instead");
181             }
182         }
183     }
184 
185     @DataClass.Generated(
186             time = 1705968510939L,
187             codegenVersion = "1.0.23",
188             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/DownloadInputParcel.java",
189             inputSignatures = " @android.annotation.Nullable android.adservices.ondevicepersonalization.IBinder mDataAccessServiceBinder\nclass DownloadInputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true)")
190     @Deprecated
__metadata()191     private void __metadata() {}
192 
193 
194     //@formatter:on
195     // End of generated code
196 
197 }
198