1 /*
2  * Copyright (C) 2020 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.content.pm.parsing.component;
18 
19 import static java.util.Collections.emptySet;
20 
21 import android.annotation.NonNull;
22 import android.annotation.Nullable;
23 import android.content.pm.ApplicationInfo;
24 import android.os.Parcel;
25 import android.os.Parcelable;
26 import android.util.ArraySet;
27 
28 import com.android.internal.util.CollectionUtils;
29 import com.android.internal.util.DataClass;
30 import com.android.internal.util.Parcelling;
31 
32 import java.util.Set;
33 
34 /** @hide */
35 @DataClass(genGetters = true, genSetters = false, genParcelable = true, genAidl = false,
36         genBuilder = false)
37 public class ParsedProcess implements Parcelable {
38 
39     @NonNull
40     protected String name;
41     @NonNull
42     @DataClass.ParcelWith(Parcelling.BuiltIn.ForInternedStringSet.class)
43     protected Set<String> deniedPermissions = emptySet();
44 
45     @ApplicationInfo.GwpAsanMode
46     protected int gwpAsanMode = ApplicationInfo.GWP_ASAN_DEFAULT;
47     @ApplicationInfo.MemtagMode
48     protected int memtagMode = ApplicationInfo.MEMTAG_DEFAULT;
49     @ApplicationInfo.NativeHeapZeroInitialized
50     protected int nativeHeapZeroInitialized = ApplicationInfo.ZEROINIT_DEFAULT;
51 
ParsedProcess()52     public ParsedProcess() {
53     }
54 
ParsedProcess(@onNull ParsedProcess other)55     public ParsedProcess(@NonNull ParsedProcess other) {
56         name = other.name;
57         deniedPermissions = new ArraySet<>(other.deniedPermissions);
58     }
59 
addStateFrom(@onNull ParsedProcess other)60     public void addStateFrom(@NonNull ParsedProcess other) {
61         deniedPermissions = CollectionUtils.addAll(deniedPermissions, other.deniedPermissions);
62     }
63 
64 
65 
66     // Code below generated by codegen v1.0.22.
67     //
68     // DO NOT MODIFY!
69     // CHECKSTYLE:OFF Generated code
70     //
71     // To regenerate run:
72     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/parsing/component/ParsedProcess.java
73     //
74     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
75     //   Settings > Editor > Code Style > Formatter Control
76     //@formatter:off
77 
78 
79     @DataClass.Generated.Member
ParsedProcess( @onNull String name, @NonNull Set<String> deniedPermissions, @ApplicationInfo.GwpAsanMode int gwpAsanMode, @ApplicationInfo.MemtagMode int memtagMode, @ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized)80     public ParsedProcess(
81             @NonNull String name,
82             @NonNull Set<String> deniedPermissions,
83             @ApplicationInfo.GwpAsanMode int gwpAsanMode,
84             @ApplicationInfo.MemtagMode int memtagMode,
85             @ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized) {
86         this.name = name;
87         com.android.internal.util.AnnotationValidations.validate(
88                 NonNull.class, null, name);
89         this.deniedPermissions = deniedPermissions;
90         com.android.internal.util.AnnotationValidations.validate(
91                 NonNull.class, null, deniedPermissions);
92         this.gwpAsanMode = gwpAsanMode;
93         com.android.internal.util.AnnotationValidations.validate(
94                 ApplicationInfo.GwpAsanMode.class, null, gwpAsanMode);
95         this.memtagMode = memtagMode;
96         com.android.internal.util.AnnotationValidations.validate(
97                 ApplicationInfo.MemtagMode.class, null, memtagMode);
98         this.nativeHeapZeroInitialized = nativeHeapZeroInitialized;
99         com.android.internal.util.AnnotationValidations.validate(
100                 ApplicationInfo.NativeHeapZeroInitialized.class, null, nativeHeapZeroInitialized);
101 
102         // onConstructed(); // You can define this method to get a callback
103     }
104 
105     @DataClass.Generated.Member
getName()106     public @NonNull String getName() {
107         return name;
108     }
109 
110     @DataClass.Generated.Member
getDeniedPermissions()111     public @NonNull Set<String> getDeniedPermissions() {
112         return deniedPermissions;
113     }
114 
115     @DataClass.Generated.Member
getGwpAsanMode()116     public @ApplicationInfo.GwpAsanMode int getGwpAsanMode() {
117         return gwpAsanMode;
118     }
119 
120     @DataClass.Generated.Member
getMemtagMode()121     public @ApplicationInfo.MemtagMode int getMemtagMode() {
122         return memtagMode;
123     }
124 
125     @DataClass.Generated.Member
getNativeHeapZeroInitialized()126     public @ApplicationInfo.NativeHeapZeroInitialized int getNativeHeapZeroInitialized() {
127         return nativeHeapZeroInitialized;
128     }
129 
130     @DataClass.Generated.Member
131     static Parcelling<Set<String>> sParcellingForDeniedPermissions =
132             Parcelling.Cache.get(
133                     Parcelling.BuiltIn.ForInternedStringSet.class);
134     static {
135         if (sParcellingForDeniedPermissions == null) {
136             sParcellingForDeniedPermissions = Parcelling.Cache.put(
137                     new Parcelling.BuiltIn.ForInternedStringSet());
138         }
139     }
140 
141     @Override
142     @DataClass.Generated.Member
writeToParcel(@onNull Parcel dest, int flags)143     public void writeToParcel(@NonNull Parcel dest, int flags) {
144         // You can override field parcelling by defining methods like:
145         // void parcelFieldName(Parcel dest, int flags) { ... }
146 
147         dest.writeString(name);
148         sParcellingForDeniedPermissions.parcel(deniedPermissions, dest, flags);
149         dest.writeInt(gwpAsanMode);
150         dest.writeInt(memtagMode);
151         dest.writeInt(nativeHeapZeroInitialized);
152     }
153 
154     @Override
155     @DataClass.Generated.Member
describeContents()156     public int describeContents() { return 0; }
157 
158     /** @hide */
159     @SuppressWarnings({"unchecked", "RedundantCast"})
160     @DataClass.Generated.Member
ParsedProcess(@onNull Parcel in)161     protected ParsedProcess(@NonNull Parcel in) {
162         // You can override field unparcelling by defining methods like:
163         // static FieldType unparcelFieldName(Parcel in) { ... }
164 
165         String _name = in.readString();
166         Set<String> _deniedPermissions = sParcellingForDeniedPermissions.unparcel(in);
167         int _gwpAsanMode = in.readInt();
168         int _memtagMode = in.readInt();
169         int _nativeHeapZeroInitialized = in.readInt();
170 
171         this.name = _name;
172         com.android.internal.util.AnnotationValidations.validate(
173                 NonNull.class, null, name);
174         this.deniedPermissions = _deniedPermissions;
175         com.android.internal.util.AnnotationValidations.validate(
176                 NonNull.class, null, deniedPermissions);
177         this.gwpAsanMode = _gwpAsanMode;
178         com.android.internal.util.AnnotationValidations.validate(
179                 ApplicationInfo.GwpAsanMode.class, null, gwpAsanMode);
180         this.memtagMode = _memtagMode;
181         com.android.internal.util.AnnotationValidations.validate(
182                 ApplicationInfo.MemtagMode.class, null, memtagMode);
183         this.nativeHeapZeroInitialized = _nativeHeapZeroInitialized;
184         com.android.internal.util.AnnotationValidations.validate(
185                 ApplicationInfo.NativeHeapZeroInitialized.class, null, nativeHeapZeroInitialized);
186 
187         // onConstructed(); // You can define this method to get a callback
188     }
189 
190     @DataClass.Generated.Member
191     public static final @NonNull Parcelable.Creator<ParsedProcess> CREATOR
192             = new Parcelable.Creator<ParsedProcess>() {
193         @Override
194         public ParsedProcess[] newArray(int size) {
195             return new ParsedProcess[size];
196         }
197 
198         @Override
199         public ParsedProcess createFromParcel(@NonNull Parcel in) {
200             return new ParsedProcess(in);
201         }
202     };
203 
204     @DataClass.Generated(
205             time = 1615850515058L,
206             codegenVersion = "1.0.22",
207             sourceFile = "frameworks/base/core/java/android/content/pm/parsing/component/ParsedProcess.java",
208             inputSignatures = "protected @android.annotation.NonNull java.lang.String name\nprotected @android.annotation.NonNull @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedStringSet.class) java.util.Set<java.lang.String> deniedPermissions\nprotected @android.content.pm.ApplicationInfo.GwpAsanMode int gwpAsanMode\nprotected @android.content.pm.ApplicationInfo.MemtagMode int memtagMode\nprotected @android.content.pm.ApplicationInfo.NativeHeapZeroInitialized int nativeHeapZeroInitialized\npublic  void addStateFrom(android.content.pm.parsing.component.ParsedProcess)\nclass ParsedProcess extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genGetters=true, genSetters=false, genParcelable=true, genAidl=false, genBuilder=false)")
209     @Deprecated
__metadata()210     private void __metadata() {}
211 
212 
213     //@formatter:on
214     // End of generated code
215 
216 }
217