Use Config/DeviceConfig functions to access ProductVariables
An upcoming change will stop exporting ProductVariables from Config, so
switch to using existing accessor functions, and add more when they're
missing.
Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7
diff --git a/android/config.go b/android/config.go
index db833ec..e14f42e 100644
--- a/android/config.go
+++ b/android/config.go
@@ -641,6 +641,37 @@
return Bool(c.ProductVariables.ArtUseReadBarrier)
}
+func (c *config) EnforceRROForModule(name string) bool {
+ enforceList := c.ProductVariables.EnforceRROTargets
+ if enforceList != nil {
+ if len(*enforceList) == 1 && (*enforceList)[0] == "*" {
+ return true
+ }
+ return InList(name, *enforceList)
+ }
+ return false
+}
+
+func (c *config) EnforceRROExcludedOverlay(path string) bool {
+ excluded := c.ProductVariables.EnforceRROExcludedOverlays
+ if excluded != nil {
+ for _, exclude := range *excluded {
+ if strings.HasPrefix(path, exclude) {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+func (c *config) ExportedNamespaces() []string {
+ return append([]string(nil), c.ProductVariables.NamespacesToExport...)
+}
+
+func (c *config) HostStaticBinaries() bool {
+ return Bool(c.ProductVariables.HostStaticBinaries)
+}
+
func (c *deviceConfig) Arches() []Arch {
var arches []Arch
for _, target := range c.config.Targets[Device] {