Use PRODUCT variable for default payload fs type
ext4 was hard-coded, but now it can be configured with
{OVERRIDE_}PRODUCT_DEFAULT_APEX_PAYLOAD_TYPE variables.
Previously, it was hard-coded as 'ext4', which makes it difficult to use a different filesystem for apex payload: for example, erofs.
Using erofs for apex payload can help to make apexes smaller on read-only partitions. (When testing with the cuttlefish, it was ~40% smaller for all apexes) This is more important for those devices using erofs on their read-only partitions (like system) because it's recommend to use "not compress .apex files" for erofs partitions (to open apex files with Direct-IO enabled).
Besides, we want to make erofs as a default filesystem for apex payload. (and hopefully deprecate .capex) However, we will need to support ext4 apexes for those older devices especially for mainline modules. Hence, we need a way to switch the default filesystem type for apex payload.
Bug: 377388109
Test: OVERRIDE_PRODUCT_DEFAULT_APEX_PAYLOAD_TYPE=erofs \
m com.android.runtime # The runtime APEX has erofs payload.
Change-Id: Ia42ad913cdaeb52b5617f71017aca3b051a61508
diff --git a/apex/apex.go b/apex/apex.go
index dc24df3..91d01b0 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1752,7 +1752,8 @@
}
func (a *apexBundle) setPayloadFsType(ctx android.ModuleContext) {
- switch proptools.StringDefault(a.properties.Payload_fs_type, ext4FsType) {
+ defaultFsType := ctx.Config().DefaultApexPayloadType()
+ switch proptools.StringDefault(a.properties.Payload_fs_type, defaultFsType) {
case ext4FsType:
a.payloadFsType = ext4
case f2fsFsType: