From 04c53c3578cd78dce8790b1598abe4a9e822c9f5 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 15 Jan 2021 02:44:40 -0800 Subject: [PATCH] Legacy SAR: use a simpler method to detect is_two_stage --- native/jni/init/mount.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/native/jni/init/mount.cpp b/native/jni/init/mount.cpp index a4d020087..6d5fc4c95 100644 --- a/native/jni/init/mount.cpp +++ b/native/jni/init/mount.cpp @@ -345,10 +345,8 @@ void SARInit::early_mount() { mount_system_root(); switch_root("/system_root"); - { - auto init = mmap_data::ro("/init"); - is_two_stage = init.contains("selinux_setup"); - } + // Use the apex folder to determine whether 2SI (Android 10+) + is_two_stage = access("/apex", F_OK) == 0; LOGD("is_two_stage: [%d]\n", is_two_stage); if (!is_two_stage) {