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