blob: f1ce6b1b360f2c6fb727908e2718725f9cd1d22e [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 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
17package android.content.pm;
18
Makoto Onuki700feef2018-02-15 10:59:41 -080019import android.annotation.IntDef;
Svet Ganov2a1376d2016-02-22 17:20:35 -080020import android.annotation.SystemApi;
Jiyong Park2f24f032017-12-08 12:25:25 +090021import android.annotation.TestApi;
Mathew Inwood1c77a112018-08-14 14:06:26 +010022import android.annotation.UnsupportedAppUsage;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.os.Parcel;
24import android.os.Parcelable;
25import android.text.TextUtils;
26
Makoto Onuki700feef2018-02-15 10:59:41 -080027import java.lang.annotation.Retention;
28import java.lang.annotation.RetentionPolicy;
29
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030/**
31 * Information you can retrieve about a particular security permission
32 * known to the system. This corresponds to information collected from the
33 * AndroidManifest.xml's <permission> tags.
34 */
35public class PermissionInfo extends PackageItemInfo implements Parcelable {
36 /**
37 * A normal application value for {@link #protectionLevel}, corresponding
38 * to the <code>normal</code> value of
39 * {@link android.R.attr#protectionLevel}.
40 */
41 public static final int PROTECTION_NORMAL = 0;
42
43 /**
44 * Dangerous value for {@link #protectionLevel}, corresponding
45 * to the <code>dangerous</code> value of
46 * {@link android.R.attr#protectionLevel}.
47 */
48 public static final int PROTECTION_DANGEROUS = 1;
49
50 /**
51 * System-level value for {@link #protectionLevel}, corresponding
52 * to the <code>signature</code> value of
53 * {@link android.R.attr#protectionLevel}.
54 */
55 public static final int PROTECTION_SIGNATURE = 2;
56
57 /**
Dianne Hackborna90c8de2015-07-07 17:25:25 -070058 * @deprecated Use {@link #PROTECTION_SIGNATURE}|{@link #PROTECTION_FLAG_PRIVILEGED}
59 * instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 */
Dianne Hackborna90c8de2015-07-07 17:25:25 -070061 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062 public static final int PROTECTION_SIGNATURE_OR_SYSTEM = 3;
63
Makoto Onuki700feef2018-02-15 10:59:41 -080064 /** @hide */
65 @IntDef(flag = false, prefix = { "PROTECTION_" }, value = {
66 PROTECTION_NORMAL,
67 PROTECTION_DANGEROUS,
68 PROTECTION_SIGNATURE,
69 PROTECTION_SIGNATURE_OR_SYSTEM,
70 })
71 @Retention(RetentionPolicy.SOURCE)
72 public @interface Protection {}
73
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 /**
Dianne Hackborne639da72012-02-21 15:11:13 -080075 * Additional flag for {@link #protectionLevel}, corresponding
Dianne Hackborna90c8de2015-07-07 17:25:25 -070076 * to the <code>privileged</code> value of
Dianne Hackborne639da72012-02-21 15:11:13 -080077 * {@link android.R.attr#protectionLevel}.
78 */
Dianne Hackborna90c8de2015-07-07 17:25:25 -070079 public static final int PROTECTION_FLAG_PRIVILEGED = 0x10;
80
81 /**
82 * @deprecated Old name for {@link #PROTECTION_FLAG_PRIVILEGED}, which
83 * is now very confusing because it only applies to privileged apps, not all
84 * apps on the system image.
85 */
86 @Deprecated
Dianne Hackborne639da72012-02-21 15:11:13 -080087 public static final int PROTECTION_FLAG_SYSTEM = 0x10;
88
89 /**
90 * Additional flag for {@link #protectionLevel}, corresponding
91 * to the <code>development</code> value of
92 * {@link android.R.attr#protectionLevel}.
93 */
94 public static final int PROTECTION_FLAG_DEVELOPMENT = 0x20;
95
96 /**
Dianne Hackborn33f5ddd2014-07-21 15:35:45 -070097 * Additional flag for {@link #protectionLevel}, corresponding
Jeff Sharkeye9b78fd2014-08-13 14:16:50 -070098 * to the <code>appop</code> value of
Dianne Hackborn33f5ddd2014-07-21 15:35:45 -070099 * {@link android.R.attr#protectionLevel}.
100 */
101 public static final int PROTECTION_FLAG_APPOP = 0x40;
102
103 /**
Dianne Hackbornde15eda2015-07-01 12:30:54 -0700104 * Additional flag for {@link #protectionLevel}, corresponding
105 * to the <code>pre23</code> value of
106 * {@link android.R.attr#protectionLevel}.
107 */
108 public static final int PROTECTION_FLAG_PRE23 = 0x80;
109
110 /**
Svetoslav3e7d9772015-07-06 18:31:23 -0700111 * Additional flag for {@link #protectionLevel}, corresponding
112 * to the <code>installer</code> value of
113 * {@link android.R.attr#protectionLevel}.
114 */
115 public static final int PROTECTION_FLAG_INSTALLER = 0x100;
116
117 /**
118 * Additional flag for {@link #protectionLevel}, corresponding
119 * to the <code>verifier</code> value of
120 * {@link android.R.attr#protectionLevel}.
121 */
122 public static final int PROTECTION_FLAG_VERIFIER = 0x200;
123
124 /**
Dianne Hackborna90c8de2015-07-07 17:25:25 -0700125 * Additional flag for {@link #protectionLevel}, corresponding
126 * to the <code>preinstalled</code> value of
127 * {@link android.R.attr#protectionLevel}.
128 */
129 public static final int PROTECTION_FLAG_PREINSTALLED = 0x400;
130
131 /**
Russell Brennerb2334662016-03-23 10:16:39 -0700132 * Additional flag for {@link #protectionLevel}, corresponding
133 * to the <code>setup</code> value of
134 * {@link android.R.attr#protectionLevel}.
135 */
136 public static final int PROTECTION_FLAG_SETUP = 0x800;
137
Chad Brubakerc19706a2016-10-13 15:44:59 -0700138 /**
139 * Additional flag for {@link #protectionLevel}, corresponding
Todd Kennedyc247fa12017-06-02 10:29:22 -0700140 * to the <code>instant</code> value of
Chad Brubakerc19706a2016-10-13 15:44:59 -0700141 * {@link android.R.attr#protectionLevel}.
Chad Brubakerc19706a2016-10-13 15:44:59 -0700142 */
Todd Kennedyc247fa12017-06-02 10:29:22 -0700143 public static final int PROTECTION_FLAG_INSTANT = 0x1000;
Chad Brubakerc19706a2016-10-13 15:44:59 -0700144
Russell Brennerb2334662016-03-23 10:16:39 -0700145 /**
Chad Brubakera5d70a12017-03-23 11:04:50 -0700146 * Additional flag for {@link #protectionLevel}, corresponding
147 * to the <code>runtime</code> value of
148 * {@link android.R.attr#protectionLevel}.
149 */
150 public static final int PROTECTION_FLAG_RUNTIME_ONLY = 0x2000;
151
152 /**
Svet Ganov087dce22017-09-07 15:42:16 -0700153 * Additional flag for {@link #protectionLevel}, corresponding
154 * to the <code>oem</code> value of
155 * {@link android.R.attr#protectionLevel}.
156 *
157 * @hide
158 */
159 @SystemApi
160 public static final int PROTECTION_FLAG_OEM = 0x4000;
161
162 /**
Jiyong Park002fdbd2017-02-13 20:50:31 +0900163 * Additional flag for {${link #protectionLevel}, corresponding
164 * to the <code>vendorPrivileged</code> value of
165 * {@link android.R.attr#protectionLevel}.
166 *
167 * @hide
168 */
Jiyong Park2f24f032017-12-08 12:25:25 +0900169 @TestApi
Jiyong Park002fdbd2017-02-13 20:50:31 +0900170 public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 0x8000;
171
172 /**
Makoto Onuki700feef2018-02-15 10:59:41 -0800173 * Additional flag for {@link #protectionLevel}, corresponding
174 * to the <code>text_classifier</code> value of
175 * {@link android.R.attr#protectionLevel}.
176 *
177 * @hide
Dianne Hackborne639da72012-02-21 15:11:13 -0800178 */
Makoto Onuki700feef2018-02-15 10:59:41 -0800179 @SystemApi
180 @TestApi
181 public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 0x10000;
182
183 /** @hide */
184 @IntDef(flag = true, prefix = { "PROTECTION_FLAG_" }, value = {
185 PROTECTION_FLAG_PRIVILEGED,
186 PROTECTION_FLAG_SYSTEM,
187 PROTECTION_FLAG_DEVELOPMENT,
188 PROTECTION_FLAG_APPOP,
189 PROTECTION_FLAG_PRE23,
190 PROTECTION_FLAG_INSTALLER,
191 PROTECTION_FLAG_VERIFIER,
192 PROTECTION_FLAG_PREINSTALLED,
193 PROTECTION_FLAG_SETUP,
194 PROTECTION_FLAG_INSTANT,
195 PROTECTION_FLAG_RUNTIME_ONLY,
196 PROTECTION_FLAG_OEM,
197 PROTECTION_FLAG_VENDOR_PRIVILEGED,
198 PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER,
199 })
200 @Retention(RetentionPolicy.SOURCE)
201 public @interface ProtectionFlags {}
202
203 /**
204 * Mask for {@link #protectionLevel}: the basic protection type.
205 *
206 * @deprecated Use #getProtection() instead.
207 */
208 @Deprecated
Dianne Hackborne639da72012-02-21 15:11:13 -0800209 public static final int PROTECTION_MASK_BASE = 0xf;
210
211 /**
212 * Mask for {@link #protectionLevel}: additional flag bits.
Makoto Onuki700feef2018-02-15 10:59:41 -0800213 *
214 * @deprecated Use #getProtectionFlags() instead.
Dianne Hackborne639da72012-02-21 15:11:13 -0800215 */
Makoto Onuki700feef2018-02-15 10:59:41 -0800216 @Deprecated
Chad Brubakerc19706a2016-10-13 15:44:59 -0700217 public static final int PROTECTION_MASK_FLAGS = 0xfff0;
Dianne Hackborne639da72012-02-21 15:11:13 -0800218
219 /**
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700220 * The level of access this permission is protecting, as per
Peter Visontay51fbad52017-11-15 12:38:14 +0000221 * {@link android.R.attr#protectionLevel}. Consists of
Makoto Onuki700feef2018-02-15 10:59:41 -0800222 * a base permission type and zero or more flags. Use the following functions
223 * to extract them.
Peter Visontay51fbad52017-11-15 12:38:14 +0000224 *
225 * <pre>
Makoto Onuki700feef2018-02-15 10:59:41 -0800226 * int basePermissionType = permissionInfo.getProtection();
227 * int permissionFlags = permissionInfo.getProtectionFlags();
Peter Visontay51fbad52017-11-15 12:38:14 +0000228 * </pre>
229 *
230 * <p></p>Base permission types are {@link #PROTECTION_NORMAL},
231 * {@link #PROTECTION_DANGEROUS}, {@link #PROTECTION_SIGNATURE}
232 * and the deprecated {@link #PROTECTION_SIGNATURE_OR_SYSTEM}.
233 * Flags are listed under {@link android.R.attr#protectionLevel}.
Makoto Onuki700feef2018-02-15 10:59:41 -0800234 *
235 * @deprecated Use #getProtection() and #getProtectionFlags() instead.
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700236 */
Makoto Onuki700feef2018-02-15 10:59:41 -0800237 @Deprecated
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700238 public int protectionLevel;
239
240 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241 * The group this permission is a part of, as per
242 * {@link android.R.attr#permissionGroup}.
243 */
244 public String group;
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700245
246 /**
247 * Flag for {@link #flags}, corresponding to <code>costsMoney</code>
248 * value of {@link android.R.attr#permissionFlags}.
249 */
250 public static final int FLAG_COSTS_MONEY = 1<<0;
251
252 /**
Svet Ganov2a1376d2016-02-22 17:20:35 -0800253 * Flag for {@link #flags}, corresponding to <code>removed</code>
Svet Ganov3e0be742015-08-07 23:06:00 -0700254 * value of {@link android.R.attr#permissionFlags}.
255 * @hide
256 */
Svet Ganov2a1376d2016-02-22 17:20:35 -0800257 @SystemApi
258 public static final int FLAG_REMOVED = 1<<1;
Svet Ganov3e0be742015-08-07 23:06:00 -0700259
260 /**
Dianne Hackborncfbfafe2015-07-21 16:57:51 -0700261 * Flag for {@link #flags}, indicating that this permission has been
262 * installed into the system's globally defined permissions.
Svetoslav Ganov6d2c0e52015-06-23 16:33:36 +0000263 */
Dianne Hackborncfbfafe2015-07-21 16:57:51 -0700264 public static final int FLAG_INSTALLED = 1<<30;
Svetoslav Ganov6d2c0e52015-06-23 16:33:36 +0000265
266 /**
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700267 * Additional flags about this permission as given by
268 * {@link android.R.attr#permissionFlags}.
269 */
270 public int flags;
271
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800272 /**
273 * A string resource identifier (in the package's resources) of this
274 * permission's description. From the "description" attribute or,
275 * if not set, 0.
276 */
277 public int descriptionRes;
278
279 /**
Philip P. Moltmann27ffeb32017-07-06 13:54:46 -0700280 * A string resource identifier (in the package's resources) used to request the permissions.
281 * From the "request" attribute or, if not set, 0.
282 *
283 * @hide
284 */
285 @SystemApi
286 public int requestRes;
287
288 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289 * The description string provided in the AndroidManifest file, if any. You
290 * probably don't want to use this, since it will be null if the description
291 * is in a resource. You probably want
292 * {@link PermissionInfo#loadDescription} instead.
293 */
294 public CharSequence nonLocalizedDescription;
295
Dianne Hackborne639da72012-02-21 15:11:13 -0800296 /** @hide */
297 public static int fixProtectionLevel(int level) {
298 if (level == PROTECTION_SIGNATURE_OR_SYSTEM) {
Dianne Hackborna90c8de2015-07-07 17:25:25 -0700299 level = PROTECTION_SIGNATURE | PROTECTION_FLAG_PRIVILEGED;
Dianne Hackborne639da72012-02-21 15:11:13 -0800300 }
Jiyong Park002fdbd2017-02-13 20:50:31 +0900301 if ((level & PROTECTION_FLAG_VENDOR_PRIVILEGED) != 0
302 && (level & PROTECTION_FLAG_PRIVILEGED) == 0) {
303 // 'vendorPrivileged' must be 'privileged'. If not,
304 // drop the vendorPrivileged.
305 level = level & ~PROTECTION_FLAG_VENDOR_PRIVILEGED;
306 }
Dianne Hackborne639da72012-02-21 15:11:13 -0800307 return level;
308 }
309
310 /** @hide */
Mathew Inwood1c77a112018-08-14 14:06:26 +0100311 @UnsupportedAppUsage
Dianne Hackborne639da72012-02-21 15:11:13 -0800312 public static String protectionToString(int level) {
313 String protLevel = "????";
Svet Ganov087dce22017-09-07 15:42:16 -0700314 switch (level & PROTECTION_MASK_BASE) {
Dianne Hackborne639da72012-02-21 15:11:13 -0800315 case PermissionInfo.PROTECTION_DANGEROUS:
316 protLevel = "dangerous";
317 break;
318 case PermissionInfo.PROTECTION_NORMAL:
319 protLevel = "normal";
320 break;
321 case PermissionInfo.PROTECTION_SIGNATURE:
322 protLevel = "signature";
323 break;
324 case PermissionInfo.PROTECTION_SIGNATURE_OR_SYSTEM:
325 protLevel = "signatureOrSystem";
326 break;
327 }
Svet Ganov087dce22017-09-07 15:42:16 -0700328 if ((level & PermissionInfo.PROTECTION_FLAG_PRIVILEGED) != 0) {
Dianne Hackborna90c8de2015-07-07 17:25:25 -0700329 protLevel += "|privileged";
Dianne Hackborne639da72012-02-21 15:11:13 -0800330 }
Svet Ganov087dce22017-09-07 15:42:16 -0700331 if ((level & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
Dianne Hackborne639da72012-02-21 15:11:13 -0800332 protLevel += "|development";
333 }
Svet Ganov087dce22017-09-07 15:42:16 -0700334 if ((level & PermissionInfo.PROTECTION_FLAG_APPOP) != 0) {
Dianne Hackborn33f5ddd2014-07-21 15:35:45 -0700335 protLevel += "|appop";
336 }
Svet Ganov087dce22017-09-07 15:42:16 -0700337 if ((level & PermissionInfo.PROTECTION_FLAG_PRE23) != 0) {
Dianne Hackbornde15eda2015-07-01 12:30:54 -0700338 protLevel += "|pre23";
339 }
Svet Ganov087dce22017-09-07 15:42:16 -0700340 if ((level & PermissionInfo.PROTECTION_FLAG_INSTALLER) != 0) {
Dianne Hackborncfbfafe2015-07-21 16:57:51 -0700341 protLevel += "|installer";
342 }
Svet Ganov087dce22017-09-07 15:42:16 -0700343 if ((level & PermissionInfo.PROTECTION_FLAG_VERIFIER) != 0) {
Dianne Hackborncfbfafe2015-07-21 16:57:51 -0700344 protLevel += "|verifier";
345 }
Svet Ganov087dce22017-09-07 15:42:16 -0700346 if ((level & PermissionInfo.PROTECTION_FLAG_PREINSTALLED) != 0) {
Dianne Hackborncfbfafe2015-07-21 16:57:51 -0700347 protLevel += "|preinstalled";
348 }
Svet Ganov087dce22017-09-07 15:42:16 -0700349 if ((level & PermissionInfo.PROTECTION_FLAG_SETUP) != 0) {
Russell Brennerb2334662016-03-23 10:16:39 -0700350 protLevel += "|setup";
351 }
Svet Ganov087dce22017-09-07 15:42:16 -0700352 if ((level & PermissionInfo.PROTECTION_FLAG_INSTANT) != 0) {
Todd Kennedyc247fa12017-06-02 10:29:22 -0700353 protLevel += "|instant";
Chad Brubakerc19706a2016-10-13 15:44:59 -0700354 }
Svet Ganov087dce22017-09-07 15:42:16 -0700355 if ((level & PermissionInfo.PROTECTION_FLAG_RUNTIME_ONLY) != 0) {
Chad Brubakera5d70a12017-03-23 11:04:50 -0700356 protLevel += "|runtime";
357 }
Svet Ganov087dce22017-09-07 15:42:16 -0700358 if ((level & PermissionInfo.PROTECTION_FLAG_OEM) != 0) {
359 protLevel += "|oem";
360 }
Jiyong Park002fdbd2017-02-13 20:50:31 +0900361 if ((level & PermissionInfo.PROTECTION_FLAG_VENDOR_PRIVILEGED) != 0) {
362 protLevel += "|vendorPrivileged";
363 }
Makoto Onuki700feef2018-02-15 10:59:41 -0800364 if ((level & PermissionInfo.PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER) != 0) {
365 protLevel += "|textClassifier";
366 }
Dianne Hackborne639da72012-02-21 15:11:13 -0800367 return protLevel;
368 }
369
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 public PermissionInfo() {
371 }
372
373 public PermissionInfo(PermissionInfo orig) {
374 super(orig);
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700375 protectionLevel = orig.protectionLevel;
376 flags = orig.flags;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377 group = orig.group;
378 descriptionRes = orig.descriptionRes;
Philip P. Moltmann27ffeb32017-07-06 13:54:46 -0700379 requestRes = orig.requestRes;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 nonLocalizedDescription = orig.nonLocalizedDescription;
381 }
382
383 /**
384 * Retrieve the textual description of this permission. This
385 * will call back on the given PackageManager to load the description from
386 * the application.
387 *
388 * @param pm A PackageManager from which the label can be loaded; usually
389 * the PackageManager from which you originally retrieved this item.
390 *
391 * @return Returns a CharSequence containing the permission's description.
392 * If there is no description, null is returned.
393 */
394 public CharSequence loadDescription(PackageManager pm) {
395 if (nonLocalizedDescription != null) {
396 return nonLocalizedDescription;
397 }
398 if (descriptionRes != 0) {
399 CharSequence label = pm.getText(packageName, descriptionRes, null);
400 if (label != null) {
401 return label;
402 }
403 }
404 return null;
405 }
406
Makoto Onuki700feef2018-02-15 10:59:41 -0800407 /**
408 * Return the base permission type.
409 */
410 @Protection
411 public int getProtection() {
412 return protectionLevel & PROTECTION_MASK_BASE;
413 }
414
415 /**
416 * Return the additional flags in {@link #protectionLevel}.
417 */
418 @ProtectionFlags
419 public int getProtectionFlags() {
420 return protectionLevel & ~PROTECTION_MASK_BASE;
421 }
422
Todd Kennedy91a39d12017-09-27 12:37:04 -0700423 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 public String toString() {
425 return "PermissionInfo{"
426 + Integer.toHexString(System.identityHashCode(this))
427 + " " + name + "}";
428 }
429
Todd Kennedy91a39d12017-09-27 12:37:04 -0700430 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 public int describeContents() {
432 return 0;
433 }
434
Todd Kennedy91a39d12017-09-27 12:37:04 -0700435 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 public void writeToParcel(Parcel dest, int parcelableFlags) {
437 super.writeToParcel(dest, parcelableFlags);
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700438 dest.writeInt(protectionLevel);
439 dest.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 dest.writeString(group);
441 dest.writeInt(descriptionRes);
Philip P. Moltmann27ffeb32017-07-06 13:54:46 -0700442 dest.writeInt(requestRes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 TextUtils.writeToParcel(nonLocalizedDescription, dest, parcelableFlags);
444 }
445
Todd Kennedy91a39d12017-09-27 12:37:04 -0700446 /** @hide */
447 public int calculateFootprint() {
448 int size = name.length();
449 if (nonLocalizedLabel != null) {
450 size += nonLocalizedLabel.length();
451 }
452 if (nonLocalizedDescription != null) {
453 size += nonLocalizedDescription.length();
454 }
455 return size;
456 }
457
Todd Kennedyc8423932017-10-05 08:58:36 -0700458 /** @hide */
459 public boolean isAppOp() {
460 return (protectionLevel & PermissionInfo.PROTECTION_FLAG_APPOP) != 0;
461 }
462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800463 public static final Creator<PermissionInfo> CREATOR =
464 new Creator<PermissionInfo>() {
Todd Kennedy91a39d12017-09-27 12:37:04 -0700465 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800466 public PermissionInfo createFromParcel(Parcel source) {
467 return new PermissionInfo(source);
468 }
Todd Kennedy91a39d12017-09-27 12:37:04 -0700469 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 public PermissionInfo[] newArray(int size) {
471 return new PermissionInfo[size];
472 }
473 };
474
475 private PermissionInfo(Parcel source) {
476 super(source);
Dianne Hackborn2ca2c872012-09-16 16:03:36 -0700477 protectionLevel = source.readInt();
478 flags = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 group = source.readString();
480 descriptionRes = source.readInt();
Philip P. Moltmann27ffeb32017-07-06 13:54:46 -0700481 requestRes = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800482 nonLocalizedDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
483 }
484}