apex: Do not compress EROFS APEX
EROFS filesystem already compresses its contents. Hence no need to
compress the APEX.
Bug: 380786910
Test: m --no-skip-soong-tests
Change-Id: I25d44cbf98efc6b84db172fa2120e080344d9ddc
diff --git a/apex/apex.go b/apex/apex.go
index 0b56bf8..be14a17 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1737,7 +1737,13 @@
}
func (a *apexBundle) isCompressable() bool {
- return proptools.BoolDefault(a.overridableProperties.Compressible, false) && !a.testApex
+ if a.testApex {
+ return false
+ }
+ if a.payloadFsType == erofs {
+ return false
+ }
+ return proptools.Bool(a.overridableProperties.Compressible)
}
func (a *apexBundle) commonBuildActions(ctx android.ModuleContext) bool {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 5b5fe5f..5a51734 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -9049,6 +9049,33 @@
ensureContains(t, androidMk, "LOCAL_MODULE_STEM := myapex.capex\n")
}
+func TestCompressedApexIsDisabledWhenUsingErofs(t *testing.T) {
+ t.Parallel()
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ compressible: true,
+ updatable: false,
+ payload_fs_type: "erofs",
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.CompressedApex = proptools.BoolPtr(true)
+ }),
+ )
+
+ compressRule := ctx.ModuleForTests("myapex", "android_common_myapex").MaybeRule("compressRule")
+ if compressRule.Rule != nil {
+ t.Error("erofs apex should not be compressed")
+ }
+}
+
func TestApexSet_ShouldRespectCompressedApexFlag(t *testing.T) {
t.Parallel()
for _, compressionEnabled := range []bool{true, false} {