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

@@ -5,6 +5,15 @@ import android.compat.annotation.UnsupportedAppUsage;
/** @hide */
public interface FeatureFlags \{
{{ for item in flag_elements }}
{{ if library_exported }}
{{ if item.exported }}
@UnsupportedAppUsage
boolean {item.method_name}();
{{ endif }}
{{ else }}
{{ -if not item.is_read_write }}
{{ -if item.default_value }}
@com.android.aconfig.annotations.AssumeTrueForR8
@@ -14,5 +23,7 @@ public interface FeatureFlags \{
{{ endif }}
@UnsupportedAppUsage
boolean {item.method_name}();
{{ endif }}
{{ endfor }}
}