am building a custom version of GrapheneOS and have been attempting to include a prebuilt APK (Mdm.apk) into the build. To achieve this, I added the APK to the 'external/MyApp' directory and then modified 'build/target/product/handheld_product.mk' to include the entry for the new package (Mdm.apk). Additionally, I created a separate prebuilt module to include a permission XML file (app.grapheneos.appstore.xml) and specified it as a required module for Mdm.apk.
The directory structure and the relevant portion of 'handheld_product.mk' look like this:
external/
|-- MyApp/
| |-- myapp.apk
|-- app.grapheneos.myapp.xml
build/
|-- target/
| |-- product/
| | |-- handheld_product.mk
However, after making these changes, the custom build no longer boots successfully. The device gets stuck or fails to proceed beyond the boot animation. I suspect there might be an issue with the way I've included the prebuilt APK and its associated permission file in the build.
Here are the relevant portions of my 'handheld_product.mk':
include $(CLEAR_VARS)
LOCAL_MODULE := app.grapheneos.myapp.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
LOCAL_PRODUCT_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/permissions
LOCAL_SRC_FILES := permissions/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := myapp.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT)/priv-app
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := myapp.apk
LOCAL_OPTIONAL_USES_LIBRARIES := androidx.window.extensions androidx.window.sidecar
LOCAL_REQUIRED_MODULES := app.grapheneos.myapp.xml
include $(BUILD_PREBUILT)