Correctly install APK-in-APEX
APK in a flattened APEX is installed as 'ETC' class module, instead of
the 'APP' class. This is to prevent Make from doing app-specific
amendments (e.g. such as adding module name after my_module_path)
to the paths and filenames which are all correctly set in the Soong
side.
Test: add `installable:true` to development/samples/Snake/Android.mk
and add 'Snake' to the `apps` property of an APEX. The build is
successful.
Test: build the APEX on a device with TARGET_FLATTEN_APEX=true
The APK is at system/apex/<apexname>/app/Snake/Snake.apk
Bug: 142537672
Change-Id: I314bf1ab7abd4d4a4e9fa210442c004f54d8ccca
diff --git a/apex/apex.go b/apex/apex.go
index bb90cb9..dce9bea 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -558,7 +558,14 @@
case nativeTest:
return "NATIVE_TESTS"
case app:
- return "APPS"
+ // b/142537672 Why isn't this APP? We want to have full control over
+ // the paths and file names of the apk file under the flattend APEX.
+ // If this is set to APP, then the paths and file names are modified
+ // by the Make build system. For example, it is installed to
+ // /system/apex/<apexname>/app/<Appname>/<apexname>.<Appname>/ instead of
+ // /system/apex/<apexname>/app/<Appname> because the build system automatically
+ // appends module name (which is <apexname>.<Appname> to the path.
+ return "ETC"
default:
panic(fmt.Errorf("unknown class %d", class))
}