Debian Codegraph @

core/java/android/content/pm/permission/SplitPermissionInfoParcelable.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2019 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.permission;
18
19 import android.annotation.IntRange;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24
25 import com.android.internal.util.DataClass;
26 import com.android.internal.util.Preconditions;
27
28 import java.util.List;
29 import java.util.Objects;
30
31 /**
32 * Parcelable version of {@link android.permission.PermissionManager.SplitPermissionInfo}
33 * @hide
34 */
35 @DataClass(genEqualsHashCode = true)
36 public class SplitPermissionInfoParcelable implements Parcelable {
37
38 /**
39 * The permission that is split.
40 */
41 @NonNull
42 private final String mSplitPermission;
43
44 /**
45 * The permissions that are added.
46 */
47 @NonNull
48 private final List<String> mNewPermissions;
49
50 /**
51 * The target API level when the permission was split.
52 */
53 @IntRange(from = 0)
54 private final int mTargetSdk;
55
56 private void onConstructed() {
57 Preconditions.checkCollectionElementsNotNull(mNewPermissions, "newPermissions");
58 }
59
60
61
62 // Code below generated by codegen v1.0.20.
63 //
64 // DO NOT MODIFY!
65 // CHECKSTYLE:OFF Generated code
66 //
67 // To regenerate run:
68 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/permission/SplitPermissionInfoParcelable.java
69 //
70 // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
71 // Settings > Editor > Code Style > Formatter Control
72 //@formatter:off
73
74
75 /**
76 * Creates a new SplitPermissionInfoParcelable.
77 *
78 * @param splitPermission
79 * The permission that is split.
80 * @param newPermissions
81 * The permissions that are added.
82 * @param targetSdk
83 * The target API level when the permission was split.
84 */
85 @DataClass.Generated.Member
86 public SplitPermissionInfoParcelable(
87 @NonNull String splitPermission,
88 @NonNull List<String> newPermissions,
89 @IntRange(from = 0) int targetSdk) {
90 this.mSplitPermission = splitPermission;
91 com.android.internal.util.AnnotationValidations.validate(
92 NonNull.class, null, mSplitPermission);
93 this.mNewPermissions = newPermissions;
94 com.android.internal.util.AnnotationValidations.validate(
95 NonNull.class, null, mNewPermissions);
96 this.mTargetSdk = targetSdk;
97 com.android.internal.util.AnnotationValidations.validate(
98 IntRange.class, null, mTargetSdk,
99 "from", 0);
100
101 onConstructed();
102 }
103
104 /**
105 * The permission that is split.
106 */
107 @DataClass.Generated.Member
108 public @NonNull String getSplitPermission() {
109 return mSplitPermission;
110 }
111
112 /**
113 * The permissions that are added.
114 */
115 @DataClass.Generated.Member
116 public @NonNull List<String> getNewPermissions() {
117 return mNewPermissions;
118 }
119
120 /**
121 * The target API level when the permission was split.
122 */
123 @DataClass.Generated.Member
124 public @IntRange(from = 0) int getTargetSdk() {
125 return mTargetSdk;
126 }
127
128 @Override
129 @DataClass.Generated.Member
130 public boolean equals(@Nullable Object o) {
131 // You can override field equality logic by defining either of the methods like:
132 // boolean fieldNameEquals(SplitPermissionInfoParcelable other) { ... }
133 // boolean fieldNameEquals(FieldType otherValue) { ... }
134
135 if (this == o) return true;
136 if (o == null || getClass() != o.getClass()) return false;
137 @SuppressWarnings("unchecked")
138 SplitPermissionInfoParcelable that = (SplitPermissionInfoParcelable) o;
139 //noinspection PointlessBooleanExpression
140 return true
141 && Objects.equals(mSplitPermission, that.mSplitPermission)
142 && Objects.equals(mNewPermissions, that.mNewPermissions)
143 && mTargetSdk == that.mTargetSdk;
144 }
145
146 @Override
147 @DataClass.Generated.Member
148 public int hashCode() {
149 // You can override field hashCode logic by defining methods like:
150 // int fieldNameHashCode() { ... }
151
152 int _hash = 1;
153 _hash = 31 * _hash + Objects.hashCode(mSplitPermission);
154 _hash = 31 * _hash + Objects.hashCode(mNewPermissions);
155 _hash = 31 * _hash + mTargetSdk;
156 return _hash;
157 }
158
159 @Override
160 @DataClass.Generated.Member
161 public void writeToParcel(@NonNull Parcel dest, int flags) {
162 // You can override field parcelling by defining methods like:
163 // void parcelFieldName(Parcel dest, int flags) { ... }
164
165 dest.writeString(mSplitPermission);
166 dest.writeStringList(mNewPermissions);
167 dest.writeInt(mTargetSdk);
168 }
169
170 @Override
171 @DataClass.Generated.Member
172 public int describeContents() { return 0; }
173
174 /** @hide */
175 @SuppressWarnings({"unchecked", "RedundantCast"})
176 @DataClass.Generated.Member
177 protected SplitPermissionInfoParcelable(@NonNull Parcel in) {
178 // You can override field unparcelling by defining methods like:
179 // static FieldType unparcelFieldName(Parcel in) { ... }
180
181 String splitPermission = in.readString();
182 List<String> newPermissions = new java.util.ArrayList<>();
183 in.readStringList(newPermissions);
184 int targetSdk = in.readInt();
185
186 this.mSplitPermission = splitPermission;
187 com.android.internal.util.AnnotationValidations.validate(
188 NonNull.class, null, mSplitPermission);
189 this.mNewPermissions = newPermissions;
190 com.android.internal.util.AnnotationValidations.validate(
191 NonNull.class, null, mNewPermissions);
192 this.mTargetSdk = targetSdk;
193 com.android.internal.util.AnnotationValidations.validate(
194 IntRange.class, null, mTargetSdk,
195 "from", 0);
196
197 onConstructed();
198 }
199
200 @DataClass.Generated.Member
201 public static final @NonNull Parcelable.Creator<SplitPermissionInfoParcelable> CREATOR
202 = new Parcelable.Creator<SplitPermissionInfoParcelable>() {
203 @Override
204 public SplitPermissionInfoParcelable[] newArray(int size) {
205 return new SplitPermissionInfoParcelable[size];
206 }
207
208 @Override
209 public SplitPermissionInfoParcelable createFromParcel(@NonNull Parcel in) {
210 return new SplitPermissionInfoParcelable(in);
211 }
212 };
213
214 @DataClass.Generated(
215 time = 1604456266666L,
216 codegenVersion = "1.0.20",
217 sourceFile = "frameworks/base/core/java/android/content/pm/permission/SplitPermissionInfoParcelable.java",
218 inputSignatures = "private final @android.annotation.NonNull java.lang.String mSplitPermission\nprivate final @android.annotation.NonNull java.util.List<java.lang.String> mNewPermissions\nprivate final @android.annotation.IntRange int mTargetSdk\nprivate void onConstructed()\nclass SplitPermissionInfoParcelable extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true)")
219 @Deprecated
220 private void __metadata() {}
221
222
223 //@formatter:on
224 // End of generated code
225
226 }