• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.ondevicepersonalization;
18 
19 import android.annotation.Nullable;
20 import android.os.Parcelable;
21 
22 import com.android.modules.utils.StringParceledListSlice;
23 import com.android.ondevicepersonalization.internal.util.ByteArrayParceledListSlice;
24 import com.android.ondevicepersonalization.internal.util.DataClass;
25 
26 /**
27  * The input sent to the {@link IsolatedComputationService}.
28  *
29  * @hide
30  */
31 @DataClass(genBuilder = true, genEqualsHashCode = true)
32 public class DownloadInputParcel implements Parcelable {
33     /** List of downloaded keys */
34     @Nullable
35     StringParceledListSlice mDownloadedKeys;
36 
37     /** List of downloaded values */
38     @Nullable
39     ByteArrayParceledListSlice mDownloadedValues;
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/ondevicepersonalization/DownloadInputParcel.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
DownloadInputParcel( @ullable StringParceledListSlice downloadedKeys, @Nullable ByteArrayParceledListSlice downloadedValues)57     /* package-private */ DownloadInputParcel(
58             @Nullable StringParceledListSlice downloadedKeys,
59             @Nullable ByteArrayParceledListSlice downloadedValues) {
60         this.mDownloadedKeys = downloadedKeys;
61         this.mDownloadedValues = downloadedValues;
62 
63         // onConstructed(); // You can define this method to get a callback
64     }
65 
66     /**
67      * List of downloaded keys
68      */
69     @DataClass.Generated.Member
getDownloadedKeys()70     public @Nullable StringParceledListSlice getDownloadedKeys() {
71         return mDownloadedKeys;
72     }
73 
74     /**
75      * List of downloaded values
76      */
77     @DataClass.Generated.Member
getDownloadedValues()78     public @Nullable ByteArrayParceledListSlice getDownloadedValues() {
79         return mDownloadedValues;
80     }
81 
82     @Override
83     @DataClass.Generated.Member
equals(@ullable Object o)84     public boolean equals(@Nullable Object o) {
85         // You can override field equality logic by defining either of the methods like:
86         // boolean fieldNameEquals(DownloadInputParcel other) { ... }
87         // boolean fieldNameEquals(FieldType otherValue) { ... }
88 
89         if (this == o) return true;
90         if (o == null || getClass() != o.getClass()) return false;
91         @SuppressWarnings("unchecked")
92         DownloadInputParcel that = (DownloadInputParcel) o;
93         //noinspection PointlessBooleanExpression
94         return true
95                 && java.util.Objects.equals(mDownloadedKeys, that.mDownloadedKeys)
96                 && java.util.Objects.equals(mDownloadedValues, that.mDownloadedValues);
97     }
98 
99     @Override
100     @DataClass.Generated.Member
hashCode()101     public int hashCode() {
102         // You can override field hashCode logic by defining methods like:
103         // int fieldNameHashCode() { ... }
104 
105         int _hash = 1;
106         _hash = 31 * _hash + java.util.Objects.hashCode(mDownloadedKeys);
107         _hash = 31 * _hash + java.util.Objects.hashCode(mDownloadedValues);
108         return _hash;
109     }
110 
111     @Override
112     @DataClass.Generated.Member
writeToParcel(@ndroid.annotation.NonNull android.os.Parcel dest, int flags)113     public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
114         // You can override field parcelling by defining methods like:
115         // void parcelFieldName(Parcel dest, int flags) { ... }
116 
117         byte flg = 0;
118         if (mDownloadedKeys != null) flg |= 0x1;
119         if (mDownloadedValues != null) flg |= 0x2;
120         dest.writeByte(flg);
121         if (mDownloadedKeys != null) dest.writeTypedObject(mDownloadedKeys, flags);
122         if (mDownloadedValues != null) dest.writeTypedObject(mDownloadedValues, flags);
123     }
124 
125     @Override
126     @DataClass.Generated.Member
describeContents()127     public int describeContents() { return 0; }
128 
129     /** @hide */
130     @SuppressWarnings({"unchecked", "RedundantCast"})
131     @DataClass.Generated.Member
DownloadInputParcel(@ndroid.annotation.NonNull android.os.Parcel in)132     protected DownloadInputParcel(@android.annotation.NonNull android.os.Parcel in) {
133         // You can override field unparcelling by defining methods like:
134         // static FieldType unparcelFieldName(Parcel in) { ... }
135 
136         byte flg = in.readByte();
137         StringParceledListSlice downloadedKeys = (flg & 0x1) == 0 ? null : (StringParceledListSlice) in.readTypedObject(StringParceledListSlice.CREATOR);
138         ByteArrayParceledListSlice downloadedValues = (flg & 0x2) == 0 ? null : (ByteArrayParceledListSlice) in.readTypedObject(ByteArrayParceledListSlice.CREATOR);
139 
140         this.mDownloadedKeys = downloadedKeys;
141         this.mDownloadedValues = downloadedValues;
142 
143         // onConstructed(); // You can define this method to get a callback
144     }
145 
146     @DataClass.Generated.Member
147     public static final @android.annotation.NonNull Parcelable.Creator<DownloadInputParcel> CREATOR
148             = new Parcelable.Creator<DownloadInputParcel>() {
149         @Override
150         public DownloadInputParcel[] newArray(int size) {
151             return new DownloadInputParcel[size];
152         }
153 
154         @Override
155         public DownloadInputParcel createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
156             return new DownloadInputParcel(in);
157         }
158     };
159 
160     /**
161      * A builder for {@link DownloadInputParcel}
162      */
163     @SuppressWarnings("WeakerAccess")
164     @DataClass.Generated.Member
165     public static class Builder {
166 
167         private @Nullable StringParceledListSlice mDownloadedKeys;
168         private @Nullable ByteArrayParceledListSlice mDownloadedValues;
169 
170         private long mBuilderFieldsSet = 0L;
171 
Builder()172         public Builder() {
173         }
174 
175         /**
176          * Creates a new Builder.
177          *
178          * @param downloadedKeys
179          *   List of downloaded keys
180          * @param downloadedValues
181          *   List of downloaded values
182          */
Builder( @ullable StringParceledListSlice downloadedKeys, @Nullable ByteArrayParceledListSlice downloadedValues)183         public Builder(
184                 @Nullable StringParceledListSlice downloadedKeys,
185                 @Nullable ByteArrayParceledListSlice downloadedValues) {
186             mDownloadedKeys = downloadedKeys;
187             mDownloadedValues = downloadedValues;
188         }
189 
190         /**
191          * List of downloaded keys
192          */
193         @DataClass.Generated.Member
setDownloadedKeys(@ndroid.annotation.NonNull StringParceledListSlice value)194         public @android.annotation.NonNull Builder setDownloadedKeys(@android.annotation.NonNull StringParceledListSlice value) {
195             checkNotUsed();
196             mBuilderFieldsSet |= 0x1;
197             mDownloadedKeys = value;
198             return this;
199         }
200 
201         /**
202          * List of downloaded values
203          */
204         @DataClass.Generated.Member
setDownloadedValues(@ndroid.annotation.NonNull ByteArrayParceledListSlice value)205         public @android.annotation.NonNull Builder setDownloadedValues(@android.annotation.NonNull ByteArrayParceledListSlice value) {
206             checkNotUsed();
207             mBuilderFieldsSet |= 0x2;
208             mDownloadedValues = value;
209             return this;
210         }
211 
212         /** Builds the instance. This builder should not be touched after calling this! */
build()213         public @android.annotation.NonNull DownloadInputParcel build() {
214             checkNotUsed();
215             mBuilderFieldsSet |= 0x4; // Mark builder used
216 
217             DownloadInputParcel o = new DownloadInputParcel(
218                     mDownloadedKeys,
219                     mDownloadedValues);
220             return o;
221         }
222 
checkNotUsed()223         private void checkNotUsed() {
224             if ((mBuilderFieldsSet & 0x4) != 0) {
225                 throw new IllegalStateException(
226                         "This Builder should not be reused. Use a new Builder instance instead");
227             }
228         }
229     }
230 
231     @DataClass.Generated(
232             time = 1678905403334L,
233             codegenVersion = "1.0.23",
234             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/DownloadInputParcel.java",
235             inputSignatures = " @android.annotation.Nullable com.android.modules.utils.StringParceledListSlice mDownloadedKeys\n @android.annotation.Nullable com.android.ondevicepersonalization.internal.util.ByteArrayParceledListSlice mDownloadedValues\nclass DownloadInputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true)")
236     @Deprecated
__metadata()237     private void __metadata() {}
238 
239 
240     //@formatter:on
241     // End of generated code
242 
243 }
244