aconfig: Add exported mode to aconfig Java library generation.

This commit adds a third codegen mode, _exported_, in addition to
the existing modes, production and test.

When codegen mode is _exported_, getters are generated _only_ for
flags marked as exported as well. Also the getters always look
up DeviceConfig values at runtime, and have a default value of
false.

This only implements exported mode for Java codegen, follow-up CLs
will support Rust and C++.

Test: atest aconfig.test
Bug: 311152507
Change-Id: Ie39379b40de072180e05d84c76361b24cc0e0d83
This commit is contained in:
Ted Bauer
2023-11-29 15:44:24 +00:00
parent 53084d3f91
commit 4a6af78b69
11 changed files with 478 additions and 12 deletions

View File

@@ -12,11 +12,23 @@ 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)) \{