Before FeatureFlagsImpl will be used as a fake for testing. This change adds new class FakeFeatureFlagsImpl. The FeatureFlagsImpl will keep the same as production. FakeFeatureFlagsImpl can be used as fake for testing. FakeFeatureFlagsImpl, and FeatureFlagsImpl will be generated in both test and prod mode. In test mode FeatureFlagsImpl will just be a stub, and in prod mode FakeFeatureFlagsImpl will just be a stub. Bug: 280833463 Test: atest aconfig.test Change-Id: I11c1e716a9ea00d55600e5e9d5fb6442420762e6
24 lines
708 B
Plaintext
24 lines
708 B
Plaintext
package {package_name};
|
|
|
|
public final class Flags \{
|
|
{{- for item in class_elements}}
|
|
public static final String FLAG_{item.flag_name_constant_suffix} = "{item.device_config_flag}";
|
|
{{- endfor }}
|
|
{{ for item in class_elements}}
|
|
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- }};
|
|
|
|
}
|