1 package com.android.bedstead.flags.annotations
2 
3 import com.android.bedstead.harrier.annotations.UsesAnnotationExecutor
4 
5 /**
6  * Indicates that a specific test or class should be run only if all of the given feature flags are
7  * enabled in the device's current state.
8  *
9  * <p>This annotation works together with [RequiresFlagsDisabled] to define the value that is
10  * required of the flag by the test for the test to run. It is an error for either a method or class
11  * to require that a particular flag be both enabled and disabled.
12  *
13  * <p>If the value of a particular flag is required (by either [RequireFlagsEnabled] or
14  * [RequiresFlagsDisabled]) by both the class and test method, then the values must be
15  * consistent.
16  *
17  * <p>If the value of a one flag is required by an annotation on the class, and the value of a
18  * different flag is required by an annotation of the method, then both requirements apply.
19  *
20  * This is a replacement for [android.platform.test.annotations.RequiresFlagsEnabled] which can be
21  * enforced by default using [DeviceState] rather than requiring a separate rule.
22  */
23 @Retention(AnnotationRetention.RUNTIME)
24 @Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS)
25 @UsesAnnotationExecutor(UsesAnnotationExecutor.FLAGS)
26 annotation class RequireFlagsEnabled(
27     /**
28      * The list of the feature flags that require to be enabled. Each item is the full flag name
29      * with the format {package_name}.{flag_name}.
30      */
31     vararg val value: String
32 )
33