Accept starting_at_board_api macro in service contexts
The macro requires the property target_board_api_level to be set.
Similary to policyConf, add a property to selinuxContext.
Bug: 367249722
Test: build with a call to starting_at_board_api in service_contexts.
Change-Id: I9b4b975a926a41f49138ca78c36b91310f57b586
diff --git a/build/soong/selinux.go b/build/soong/selinux.go
index f811231..51ff732 100644
--- a/build/soong/selinux.go
+++ b/build/soong/selinux.go
@@ -16,6 +16,7 @@
import (
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
"android/soong/android"
)
@@ -50,3 +51,12 @@
}
return flagMacros
}
+
+// boardApiLevel returns the M4 argument containing the target board API level.
+func boardApiLevelToM4Macro(ctx android.ModuleContext, apiLevel *string) string {
+ level := proptools.StringDefault(apiLevel, "current")
+ if level == "current" {
+ level = ctx.Config().VendorApiLevel()
+ }
+ return "-D target_board_api_level=" + level
+}