Create a singleton all_apex_contributions module type
This will be a container for the the apex_contributions
selected using build flags. This module will be used to query the state of
selected apex contributions instead of a global that can be mutated by
anyone.
It will set a provider containing metadata for source vs prebuilts
selection. To reduce the overhead of a new mutator, this will be done in
the existing `prebuilt_select` mutator.
It will validate that there are no dups (`foo` and `prebuilt_foo` cannot
be both selected)
Bug: 308174923
Test: go test ./android
Change-Id: Ie42999a71f35d70e0e977f5ab07ce451608d9f35
diff --git a/android/config.go b/android/config.go
index 4c31bb0..696632a 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2129,3 +2129,41 @@
val, ok := c.productVariables.BuildFlags[name]
return val, ok
}
+
+var (
+ mainlineApexContributionBuildFlags = []string{
+ "RELEASE_APEX_CONTRIBUTIONS_ADSERVICES",
+ "RELEASE_APEX_CONTRIBUTIONS_APPSEARCH",
+ "RELEASE_APEX_CONTRIBUTIONS_ART",
+ "RELEASE_APEX_CONTRIBUTIONS_BLUETOOTH",
+ "RELEASE_APEX_CONTRIBUTIONS_CONFIGINFRASTRUCTURE",
+ "RELEASE_APEX_CONTRIBUTIONS_CONNECTIVITY",
+ "RELEASE_APEX_CONTRIBUTIONS_CONSCRYPT",
+ "RELEASE_APEX_CONTRIBUTIONS_CRASHRECOVERY",
+ "RELEASE_APEX_CONTRIBUTIONS_DEVICELOCK",
+ "RELEASE_APEX_CONTRIBUTIONS_HEALTHFITNESS",
+ "RELEASE_APEX_CONTRIBUTIONS_IPSEC",
+ "RELEASE_APEX_CONTRIBUTIONS_MEDIA",
+ "RELEASE_APEX_CONTRIBUTIONS_MEDIAPROVIDER",
+ "RELEASE_APEX_CONTRIBUTIONS_ONDEVICEPERSONALIZATION",
+ "RELEASE_APEX_CONTRIBUTIONS_PERMISSION",
+ "RELEASE_APEX_CONTRIBUTIONS_REMOTEKEYPROVISIONING",
+ "RELEASE_APEX_CONTRIBUTIONS_SCHEDULING",
+ "RELEASE_APEX_CONTRIBUTIONS_SDKEXTENSIONS",
+ "RELEASE_APEX_CONTRIBUTIONS_STATSD",
+ "RELEASE_APEX_CONTRIBUTIONS_UWB",
+ "RELEASE_APEX_CONTRIBUTIONS_WIFI",
+ }
+)
+
+// Returns the list of _selected_ apex_contributions
+// Each mainline module will have one entry in the list
+func (c *config) AllApexContributions() []string {
+ ret := []string{}
+ for _, f := range mainlineApexContributionBuildFlags {
+ if val, exists := c.GetBuildFlag(f); exists && val != "" {
+ ret = append(ret, val)
+ }
+ }
+ return ret
+}