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.os.Parcelable;
21 
22 import com.android.ondevicepersonalization.internal.util.DataClass;
23 
24 /**
25  * Wrapper class for additional information returned with IPC results.
26 *
27 * @hide
28 */
29 @DataClass(genBuilder = true, genEqualsHashCode = true)
30 public final class CalleeMetadata implements Parcelable {
31     /** Time elapsed in callee, as measured by callee. */
32     private long mElapsedTimeMillis = 0;
33     private long mServiceEntryTimeMillis = 0;
34     private long mCallbackInvokeTimeMillis = 0;
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/CalleeMetadata.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
CalleeMetadata( long elapsedTimeMillis, long serviceEntryTimeMillis, long callbackInvokeTimeMillis)52     /* package-private */ CalleeMetadata(
53             long elapsedTimeMillis,
54             long serviceEntryTimeMillis,
55             long callbackInvokeTimeMillis) {
56         this.mElapsedTimeMillis = elapsedTimeMillis;
57         this.mServiceEntryTimeMillis = serviceEntryTimeMillis;
58         this.mCallbackInvokeTimeMillis = callbackInvokeTimeMillis;
59 
60         // onConstructed(); // You can define this method to get a callback
61     }
62 
63     /**
64      * Time elapsed in callee, as measured by callee.
65      */
66     @DataClass.Generated.Member
getElapsedTimeMillis()67     public long getElapsedTimeMillis() {
68         return mElapsedTimeMillis;
69     }
70 
71     @DataClass.Generated.Member
getServiceEntryTimeMillis()72     public long getServiceEntryTimeMillis() {
73         return mServiceEntryTimeMillis;
74     }
75 
76     @DataClass.Generated.Member
getCallbackInvokeTimeMillis()77     public long getCallbackInvokeTimeMillis() {
78         return mCallbackInvokeTimeMillis;
79     }
80 
81     @Override
82     @DataClass.Generated.Member
equals(@ndroid.annotation.Nullable Object o)83     public boolean equals(@android.annotation.Nullable Object o) {
84         // You can override field equality logic by defining either of the methods like:
85         // boolean fieldNameEquals(CalleeMetadata other) { ... }
86         // boolean fieldNameEquals(FieldType otherValue) { ... }
87 
88         if (this == o) return true;
89         if (o == null || getClass() != o.getClass()) return false;
90         @SuppressWarnings("unchecked")
91         CalleeMetadata that = (CalleeMetadata) o;
92         //noinspection PointlessBooleanExpression
93         return true
94                 && mElapsedTimeMillis == that.mElapsedTimeMillis
95                 && mServiceEntryTimeMillis == that.mServiceEntryTimeMillis
96                 && mCallbackInvokeTimeMillis == that.mCallbackInvokeTimeMillis;
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 + Long.hashCode(mElapsedTimeMillis);
107         _hash = 31 * _hash + Long.hashCode(mServiceEntryTimeMillis);
108         _hash = 31 * _hash + Long.hashCode(mCallbackInvokeTimeMillis);
109         return _hash;
110     }
111 
112     @Override
113     @DataClass.Generated.Member
writeToParcel(@onNull android.os.Parcel dest, int flags)114     public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
115         // You can override field parcelling by defining methods like:
116         // void parcelFieldName(Parcel dest, int flags) { ... }
117 
118         dest.writeLong(mElapsedTimeMillis);
119         dest.writeLong(mServiceEntryTimeMillis);
120         dest.writeLong(mCallbackInvokeTimeMillis);
121     }
122 
123     @Override
124     @DataClass.Generated.Member
describeContents()125     public int describeContents() { return 0; }
126 
127     /** @hide */
128     @SuppressWarnings({"unchecked", "RedundantCast"})
129     @DataClass.Generated.Member
CalleeMetadata(@onNull android.os.Parcel in)130     /* package-private */ CalleeMetadata(@NonNull android.os.Parcel in) {
131         // You can override field unparcelling by defining methods like:
132         // static FieldType unparcelFieldName(Parcel in) { ... }
133 
134         long elapsedTimeMillis = in.readLong();
135         long serviceEntryTimeMillis = in.readLong();
136         long callbackInvokeTimeMillis = in.readLong();
137 
138         this.mElapsedTimeMillis = elapsedTimeMillis;
139         this.mServiceEntryTimeMillis = serviceEntryTimeMillis;
140         this.mCallbackInvokeTimeMillis = callbackInvokeTimeMillis;
141 
142         // onConstructed(); // You can define this method to get a callback
143     }
144 
145     @DataClass.Generated.Member
146     public static final @NonNull Parcelable.Creator<CalleeMetadata> CREATOR
147             = new Parcelable.Creator<CalleeMetadata>() {
148         @Override
149         public CalleeMetadata[] newArray(int size) {
150             return new CalleeMetadata[size];
151         }
152 
153         @Override
154         public CalleeMetadata createFromParcel(@NonNull android.os.Parcel in) {
155             return new CalleeMetadata(in);
156         }
157     };
158 
159     /**
160      * A builder for {@link CalleeMetadata}
161      */
162     @SuppressWarnings("WeakerAccess")
163     @DataClass.Generated.Member
164     public static final class Builder {
165 
166         private long mElapsedTimeMillis;
167         private long mServiceEntryTimeMillis;
168         private long mCallbackInvokeTimeMillis;
169 
170         private long mBuilderFieldsSet = 0L;
171 
Builder()172         public Builder() {
173         }
174 
175         /**
176          * Time elapsed in callee, as measured by callee.
177          */
178         @DataClass.Generated.Member
setElapsedTimeMillis(long value)179         public @NonNull Builder setElapsedTimeMillis(long value) {
180             checkNotUsed();
181             mBuilderFieldsSet |= 0x1;
182             mElapsedTimeMillis = value;
183             return this;
184         }
185 
186         @DataClass.Generated.Member
setServiceEntryTimeMillis(long value)187         public @NonNull Builder setServiceEntryTimeMillis(long value) {
188             checkNotUsed();
189             mBuilderFieldsSet |= 0x2;
190             mServiceEntryTimeMillis = value;
191             return this;
192         }
193 
194         @DataClass.Generated.Member
setCallbackInvokeTimeMillis(long value)195         public @NonNull Builder setCallbackInvokeTimeMillis(long value) {
196             checkNotUsed();
197             mBuilderFieldsSet |= 0x4;
198             mCallbackInvokeTimeMillis = value;
199             return this;
200         }
201 
202         /** Builds the instance. This builder should not be touched after calling this! */
build()203         public @NonNull CalleeMetadata build() {
204             checkNotUsed();
205             mBuilderFieldsSet |= 0x8; // Mark builder used
206 
207             if ((mBuilderFieldsSet & 0x1) == 0) {
208                 mElapsedTimeMillis = 0;
209             }
210             if ((mBuilderFieldsSet & 0x2) == 0) {
211                 mServiceEntryTimeMillis = 0;
212             }
213             if ((mBuilderFieldsSet & 0x4) == 0) {
214                 mCallbackInvokeTimeMillis = 0;
215             }
216             CalleeMetadata o = new CalleeMetadata(
217                     mElapsedTimeMillis,
218                     mServiceEntryTimeMillis,
219                     mCallbackInvokeTimeMillis);
220             return o;
221         }
222 
checkNotUsed()223         private void checkNotUsed() {
224             if ((mBuilderFieldsSet & 0x8) != 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 = 1716227988090L,
233             codegenVersion = "1.0.23",
234             sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/CalleeMetadata.java",
235             inputSignatures = "private  long mElapsedTimeMillis\nprivate  long mServiceEntryTimeMillis\nprivate  long mCallbackInvokeTimeMillis\nclass CalleeMetadata 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