aboutsummaryrefslogtreecommitdiff
path: root/tools/aconfig/aconfig/templates/Flags.java.template
blob: e105991369f667d7a7f9ee6274d556622f9276c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package {package_name};
{{ if not library_exported- }}
// TODO(b/303773055): Remove the annotation after access issue is resolved.
import android.compat.annotation.UnsupportedAppUsage;
{{ -endif }}
/** @hide */
public final class Flags \{
{{ -for item in flag_elements}}
    /** @hide */
    public static final String FLAG_{item.flag_name_constant_suffix} = "{item.device_config_flag}";
{{- endfor }}
{{ -for item in flag_elements}}
{{ -if not item.is_read_write }}
{{ -if item.default_value }}
    @com.android.aconfig.annotations.AssumeTrueForR8
{{ -else }}
    @com.android.aconfig.annotations.AssumeFalseForR8
{{ -endif }}
{{ -endif }}
{{ -if not library_exported }}
    @UnsupportedAppUsage
{{ -endif }}
    public static boolean {item.method_name}() \{
        return FEATURE_FLAGS.{item.method_name}();
    }
{{ -endfor }}
{{ -if is_test_mode }}
    public static void setFeatureFlags(FeatureFlags featureFlags) \{
        Flags.FEATURE_FLAGS = featureFlags;
    }

    public static void unsetFeatureFlags() \{
        Flags.FEATURE_FLAGS = null;
    }
{{ -endif }}

    private static FeatureFlags FEATURE_FLAGS{{ -if not is_test_mode }} = new FeatureFlagsImpl(){{ -endif- }};

}