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.flag.junit;
18 
19 import android.platform.test.flag.util.FlagReadException;
20 
21 /** Common interface to get flag values. */
22 public interface IFlagsValueProvider {
isBooleanValue(String value)23     static boolean isBooleanValue(String value) {
24         return "true".equals(value) || "false".equals(value);
25     }
26     /**
27      * Sets up this provider before providing the flag values. Such as acquiring some permissions on
28      * the device.
29      */
setUp()30     default void setUp() throws FlagReadException {}
31     ;
32 
33     /** Gets the boolean value of a flag. */
getBoolean(String flag)34     boolean getBoolean(String flag) throws FlagReadException;
35 
36     /** Tears down operations before calling the actual test run. */
tearDownBeforeTest()37     default void tearDownBeforeTest() {}
38     ;
39 }
40