Merge "aconfig: flag java lib enable optimization" into main
This commit is contained in:
@@ -119,9 +119,12 @@ mod tests {
|
||||
const EXPECTED_FEATUREFLAGS_COMMON_CONTENT: &str = r#"
|
||||
package com.android.aconfig.test;
|
||||
public interface FeatureFlags {
|
||||
@com.android.aconfig.annotations.AssumeFalseForR8
|
||||
boolean disabledRo();
|
||||
boolean disabledRw();
|
||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||
boolean enabledFixedRo();
|
||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||
boolean enabledRo();
|
||||
boolean enabledRw();
|
||||
}
|
||||
@@ -136,15 +139,18 @@ mod tests {
|
||||
public static final String FLAG_ENABLED_RO = "com.android.aconfig.test.enabled_ro";
|
||||
public static final String FLAG_ENABLED_RW = "com.android.aconfig.test.enabled_rw";
|
||||
|
||||
@com.android.aconfig.annotations.AssumeFalseForR8
|
||||
public static boolean disabledRo() {
|
||||
return FEATURE_FLAGS.disabledRo();
|
||||
}
|
||||
public static boolean disabledRw() {
|
||||
return FEATURE_FLAGS.disabledRw();
|
||||
}
|
||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||
public static boolean enabledFixedRo() {
|
||||
return FEATURE_FLAGS.enabledFixedRo();
|
||||
}
|
||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||
public static boolean enabledRo() {
|
||||
return FEATURE_FLAGS.enabledRo();
|
||||
}
|
||||
|
@@ -2,6 +2,13 @@ package {package_name};
|
||||
|
||||
public interface FeatureFlags \{
|
||||
{{ for item in class_elements}}
|
||||
{{ -if not item.is_read_write }}
|
||||
{{ -if item.default_value }}
|
||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||
{{ -else }}
|
||||
@com.android.aconfig.annotations.AssumeFalseForR8
|
||||
{{ -endif- }}
|
||||
{{ endif }}
|
||||
boolean {item.method_name}();
|
||||
{{ endfor }}
|
||||
}
|
||||
|
@@ -5,6 +5,13 @@ public final class Flags \{
|
||||
public static final String FLAG_{item.flag_name_constant_suffix} = "{item.device_config_flag}";
|
||||
{{- endfor }}
|
||||
{{ for item in class_elements}}
|
||||
{{ -if not item.is_read_write }}
|
||||
{{ -if item.default_value }}
|
||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||
{{ -else }}
|
||||
@com.android.aconfig.annotations.AssumeFalseForR8
|
||||
{{ -endif- }}
|
||||
{{ endif }}
|
||||
public static boolean {item.method_name}() \{
|
||||
return FEATURE_FLAGS.{item.method_name}();
|
||||
}
|
||||
@@ -17,7 +24,7 @@ public final class Flags \{
|
||||
public static void unsetFeatureFlags() \{
|
||||
Flags.FEATURE_FLAGS = null;
|
||||
}
|
||||
{{ endif}}
|
||||
{{ endif }}
|
||||
private static FeatureFlags FEATURE_FLAGS{{ -if not is_test_mode }} = new FeatureFlagsImpl(){{ -endif- }};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user