From 71dde7182813fc2a6d0045fdfd0379105e6099fa Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Mon, 7 Oct 2019 22:11:35 +0200 Subject: [PATCH] full Android Q compat by mounting android runtime APEX --- CommonInstaller | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CommonInstaller b/CommonInstaller index a9449b6..87b2a3e 100644 --- a/CommonInstaller +++ b/CommonInstaller @@ -234,6 +234,9 @@ mount_partitions () { SYSTEM_AS_ROOT=$(getprop ro.build.system_root_image) SYSTEM_BLOCK=/dev/block/bootdevice/by-name/system + RUNTIME_APEX="" + APEX_LOOP="" + if [ "${SYSTEM_AS_ROOT}" == "true" ]; then SLOT=$(grep_cmdline androidboot.slot_suffix) if [ -n "${SLOT}" ]; then @@ -259,6 +262,23 @@ mount_partitions () { [ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)" + if [ -f /system/apex/com.android.runtime.apex ]; then + RUNTIME_APEX="/system/apex/com.android.runtime.apex" + elif [ -f /system/apex/com.android.runtime.release.apex ]; then + RUNTIME_APEX="/system/apex/com.android.runtime.release.apex" + fi + + if [ -n "${RUNTIME_APEX}" ]; then + mkdir -p /dev/tmp/apex + unzip "${RUNTIME_APEX}" -d /dev/tmp/apex + + mkdir -p /apex/com.android.runtime + + mount -oloop,ro /dev/tmp/apex/apex_payload.img /apex/com.android.runtime + + APEX_LOOP=$(mount | awk '/com.android.runtime/{print $1}') + fi + ! is_mounted /vendor && mount /vendor if [ -L /system/vendor ]; then @@ -405,6 +425,8 @@ nanodroid_finalize () { umount -l /system 2>/dev/null umount -l /vendor 2>/dev/null umount -l /dev/random 2>/dev/null + umount -l /apex/com.android.runtime 2>/dev/null + losetup -d ${APEX_LOOP} 2>/dev/null } ##########################################################################################