diff options
| author | Daniel Bright <dbright@google.com> | 2020-11-19 15:14:56 -0800 |
|---|---|---|
| committer | Daniel Bright <dbright@google.com> | 2020-11-19 16:01:04 -0800 |
| commit | 5bfa4239c164d87bdbd5b12dc42af48680b44293 (patch) | |
| tree | cc00a570661b2776474cfae0c47b94092bc58a40 /core/java/android/annotation/RequiresFeature.java | |
| parent | e1fee3b46ae3751568a194e57da721f247ab7ab5 (diff) | |
Add enforcement parameter to RequiresFeature
* Allows for a broader range of enforcement checks
* Designed to match androix so that it can be easily slotted into
Android Studio lint checks
Test: Built
Bug: 173735303
Change-Id: Ia4cc8be8fdccbdeeecee956e4ccf02bda6d91845
Diffstat (limited to 'core/java/android/annotation/RequiresFeature.java')
| -rw-r--r-- | core/java/android/annotation/RequiresFeature.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/java/android/annotation/RequiresFeature.java b/core/java/android/annotation/RequiresFeature.java index fc93f03d76cf..08861d42be39 100644 --- a/core/java/android/annotation/RequiresFeature.java +++ b/core/java/android/annotation/RequiresFeature.java @@ -30,7 +30,6 @@ import java.lang.annotation.Target; * Denotes that the annotated element requires one or more device features. This * is used to auto-generate documentation. * - * @see PackageManager#hasSystemFeature(String) * @hide */ @Retention(SOURCE) @@ -38,8 +37,16 @@ import java.lang.annotation.Target; public @interface RequiresFeature { /** * The name of the device feature that is required. - * - * @see PackageManager#hasSystemFeature(String) */ String value(); + + /** + * Defines the name of the method that should be called to check whether the feature is + * available, using the same signature format as javadoc. The feature checking method can have + * multiple parameters, but the feature name parameter must be of type String and must also be + * the first String-type parameter. + * <p> + * By default, the enforcement is {@link PackageManager#hasSystemFeature(String)}. + */ + String enforcement() default("android.content.pm.PackageManager#hasSystemFeature"); } |
