Add flag-guarding also to compat modules
Bug: 353121021
Test: m selinux_policy
Change-Id: I88db84063966fd4fe3d4d11b0be5ea1822d57a0d
diff --git a/build/soong/policy.go b/build/soong/policy.go
index 7b2122c..5611ed0 100644
--- a/build/soong/policy.go
+++ b/build/soong/policy.go
@@ -90,8 +90,9 @@
// Desired number of MLS categories. Defaults to 1024
Mls_cats *int64
- // Whether to turn on board_api_level guard or not. Defaults to false
- Board_api_level_guard *bool
+ // Board api level of policy files. Set "vendor" for RELEASE_BOARD_API_LEVEL, "system" for
+ // turning off the guard, or a direct version string (e.g. "202404"). Defaults to "system"
+ Board_api_level *string
}
type policyConf struct {
@@ -223,11 +224,17 @@
}
func (c *policyConf) boardApiLevel(ctx android.ModuleContext) string {
- if proptools.Bool(c.properties.Board_api_level_guard) {
+ level := proptools.StringDefault(c.properties.Board_api_level, "system")
+
+ if level == "system" {
+ // aribtrary value greater than any other vendor API levels
+ return "1000000"
+ } else if level == "vendor" {
return ctx.Config().VendorApiLevel()
+ } else {
+ return level
}
- // aribtrary value greater than any other vendor API levels
- return "1000000"
+
}
func findPolicyConfOrder(name string) int {