1 /* 2 * Copyright (C) 2023 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.platform.test.annotations; 18 19 import java.lang.annotation.ElementType; 20 import java.lang.annotation.Retention; 21 import java.lang.annotation.RetentionPolicy; 22 import java.lang.annotation.Target; 23 24 /** 25 * Indicates that {@code SetFlagsRule} should disable all the given feature flags before running the 26 * annotated test or class. 27 * 28 * <p>This annotation works together with {@link EnableFlags} to define the value of the flag that 29 * needs to be set for the test to run. It is an error for either a method or class to declare that 30 * a flag is set to be both enabled and disabled. 31 * 32 * <p>If the value for a particular flag is defined (by either {@code EnableFlags} or {@code 33 * DisableFlags}) by both the class and test method, then the values must be consistent. 34 * 35 * <p>If the value of a one flag is required by an annotation on the class, and the value of a 36 * different flag is required by an annotation of the method, then both requirements apply. 37 * 38 * <p>With {@code SetFlagsRule}, the flag will be disabled within the test process for the duration 39 * of the test(s). When being run with {@code FlagsParameterization} that enables the flag, then the 40 * test will be skipped with 'assumption failed'. 41 * 42 * <p>Both {@code SetFlagsRule} and {@code CheckFlagsRule} will fail the test if a particular flag 43 * is both set (with {@code EnableFlags} or {@code DisableFlags}) and required (with {@code 44 * RequiresFlagsEnabled} or {@code RequiresFlagsDisabled}). 45 */ 46 @Retention(RetentionPolicy.RUNTIME) 47 @Target({ElementType.METHOD, ElementType.TYPE}) 48 public @interface DisableFlags { 49 /** 50 * The list of the feature flags to be disabled. Each item is the full flag name with the format 51 * {package_name}.{flag_name}. 52 */ value()53 String[] value(); 54 } 55