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.flags;
18 
19 import android.annotation.NonNull;
20 
21 /**
22  * A flag representing a true or false value.
23  *
24  * The value will always be the same during the lifetime of the process it is read in.
25  *
26  * @hide
27  */
28 public class BooleanFlag extends BooleanFlagBase {
29     private final boolean mDefault;
30 
31     /**
32      * @param namespace A namespace for this flag. See {@link android.provider.DeviceConfig}.
33      * @param name A name for this flag.
34      * @param defaultValue The value of this flag if no other override is present.
35      */
BooleanFlag(String namespace, String name, boolean defaultValue)36     BooleanFlag(String namespace, String name, boolean defaultValue) {
37         super(namespace, name);
38         mDefault = defaultValue;
39     }
40 
41     @Override
42     @NonNull
getDefault()43     public Boolean getDefault() {
44         return mDefault;
45     }
46 
47     @Override
defineMetaData(String label, String description, String categoryName)48     public BooleanFlag defineMetaData(String label, String description, String categoryName) {
49         super.defineMetaData(label, description, categoryName);
50         return this;
51     }
52 }
53