Add RELEASE_ACONFIG_REQUIRE_ALL_READ_ONLY build flag.
Bug: 377294922
Test: TH
Change-Id: If666691d1d3f028140d1bf7c016736e39a214a3e
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index d9a862c..9a9e568 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -15,12 +15,12 @@
package aconfig
import (
+ "android/soong/android"
"path/filepath"
"slices"
+ "strconv"
"strings"
- "android/soong/android"
-
"github.com/google/blueprint"
)
@@ -185,6 +185,13 @@
defaultPermission = confPerm
}
}
+ var allowReadWrite bool
+ if requireAllReadOnly, ok := ctx.Config().GetBuildFlag("RELEASE_ACONFIG_REQUIRE_ALL_READ_ONLY"); ok {
+ // The build flag (RELEASE_ACONFIG_REQUIRE_ALL_READ_ONLY) is the negation of the aconfig flag
+ // (allow-read-write) for historical reasons.
+ // Bool build flags are always "" for false, and generally "true" for true.
+ allowReadWrite = requireAllReadOnly == ""
+ }
inputFiles := make([]android.Path, len(declarationFiles))
copy(inputFiles, declarationFiles)
inputFiles = append(inputFiles, valuesFiles[config]...)
@@ -194,6 +201,7 @@
"declarations": android.JoinPathsWithPrefix(declarationFiles, "--declarations "),
"values": joinAndPrefix(" --values ", values[config]),
"default-permission": optionalVariable(" --default-permission ", defaultPermission),
+ "allow-read-write": optionalVariable(" --allow-read-write ", strconv.FormatBool(allowReadWrite)),
}
if len(module.properties.Container) > 0 {
args["container"] = "--container " + module.properties.Container