Legacy SAR: use a simpler method to detect is_two_stage

This commit is contained in:
topjohnwu 2021-01-15 02:44:40 -08:00
parent 51bc27a869
commit 04c53c3578

View File

@ -345,10 +345,8 @@ void SARInit::early_mount() {
mount_system_root(); mount_system_root();
switch_root("/system_root"); switch_root("/system_root");
{ // Use the apex folder to determine whether 2SI (Android 10+)
auto init = mmap_data::ro("/init"); is_two_stage = access("/apex", F_OK) == 0;
is_two_stage = init.contains("selinux_setup");
}
LOGD("is_two_stage: [%d]\n", is_two_stage); LOGD("is_two_stage: [%d]\n", is_two_stage);
if (!is_two_stage) { if (!is_two_stage) {