aconfig: modify and filter flags before passing into java codegen
Before this change java codegen filter flags for exported mode in the template. This change move the filter process to commands as other codegen. Thus the codegen code will only generate code based on the passed in flags. Bug: 311152507 Test: atest aconfig.test aconfig.test.java AconfigJavaHostTest Change-Id: I74045709cde19e6c687c3eb0d94050ea40cf5042
This commit is contained in:
@@ -12,23 +12,11 @@ public class FakeFeatureFlagsImpl implements FeatureFlags \{
|
||||
}
|
||||
|
||||
{{ for item in flag_elements}}
|
||||
{{ if library_exported }}
|
||||
|
||||
{{ if item.exported }}
|
||||
@Override
|
||||
@UnsupportedAppUsage
|
||||
public boolean {item.method_name}() \{
|
||||
return getValue(Flags.FLAG_{item.flag_name_constant_suffix});
|
||||
}
|
||||
{{ endif }}
|
||||
|
||||
{{ else }}
|
||||
@Override
|
||||
@UnsupportedAppUsage
|
||||
public boolean {item.method_name}() \{
|
||||
return getValue(Flags.FLAG_{item.flag_name_constant_suffix});
|
||||
}
|
||||
{{ endif }}
|
||||
{{ endfor}}
|
||||
public void setFlag(String flagName, boolean value) \{
|
||||
if (!this.mFlagMap.containsKey(flagName)) \{
|
||||
@@ -52,20 +40,11 @@ public class FakeFeatureFlagsImpl implements FeatureFlags \{
|
||||
}
|
||||
|
||||
private Map<String, Boolean> mFlagMap = new HashMap<>(
|
||||
{{ if library_exported }}
|
||||
Map.ofEntries(
|
||||
{{-for item in exported_flag_elements}}
|
||||
Map.entry(Flags.FLAG_{item.flag_name_constant_suffix}, false)
|
||||
{{ -if not @last }},{{ endif }}
|
||||
{{ -endfor }}
|
||||
)
|
||||
{{ else }}
|
||||
Map.ofEntries(
|
||||
{{-for item in flag_elements}}
|
||||
Map.entry(Flags.FLAG_{item.flag_name_constant_suffix}, false)
|
||||
{{ -if not @last }},{{ endif }}
|
||||
{{ -endfor }}
|
||||
)
|
||||
{{ endif }}
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user