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.annotation; 18 19 import static java.lang.annotation.ElementType.METHOD; 20 import static java.lang.annotation.RetentionPolicy.CLASS; 21 22 import java.lang.annotation.Retention; 23 import java.lang.annotation.Target; 24 25 /** 26 * Documents that the subject method's job is to look 27 * up whether the provided or calling uid/pid has the requested permission. 28 * 29 * <p>Methods should either return `void`, but potentially throw {@link SecurityException}, 30 * or return {@link android.content.pm.PackageManager.PermissionResult} `int`. 31 * 32 * @hide 33 */ 34 @Retention(CLASS) 35 @Target({METHOD}) 36 public @interface PermissionMethod { 37 /** 38 * Hard-coded list of permissions checked by this method 39 */ value()40 @PermissionName String[] value() default {}; 41 /** 42 * If true, the check passes if the caller 43 * has any ONE of the supplied permissions 44 */ anyOf()45 boolean anyOf() default false; 46 /** 47 * Signifies that the permission check passes if 48 * the calling process OR the current process has 49 * the permission 50 */ orSelf()51 boolean orSelf() default false; 52 } 53