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