From dbdb0a2560ef99d883a3f9e5a94c6b1398ea35d4 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 18 May 2020 03:51:41 -0700 Subject: [PATCH] Move late props to boot complete --- native/jni/core/bootstages.cpp | 4 +--- native/jni/magiskhide/hide_policy.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/native/jni/core/bootstages.cpp b/native/jni/core/bootstages.cpp index 47930f955..3b8552129 100644 --- a/native/jni/core/bootstages.cpp +++ b/native/jni/core/bootstages.cpp @@ -271,8 +271,8 @@ void post_fs_data(int client) { } else { LOGI("* Running post-fs-data.d scripts\n"); exec_common_script("post-fs-data"); - handle_modules(); auto_start_magiskhide(); + handle_modules(); } // We still want to do magic mount because root itself might need it @@ -300,8 +300,6 @@ void late_start(int client) { if (!pfs_done || safe_mode) return; - auto_start_magiskhide(); - LOGI("* Running service.d scripts\n"); exec_common_script("service"); diff --git a/native/jni/magiskhide/hide_policy.cpp b/native/jni/magiskhide/hide_policy.cpp index 20a865bac..8c7338766 100644 --- a/native/jni/magiskhide/hide_policy.cpp +++ b/native/jni/magiskhide/hide_policy.cpp @@ -12,20 +12,20 @@ using namespace std; static const char *prop_key[] = { "ro.boot.vbmeta.device_state", "ro.boot.verifiedbootstate", "ro.boot.flash.locked", "ro.boot.veritymode", "ro.boot.warranty_bit", "ro.warranty_bit", "ro.debuggable", - "ro.secure", "ro.build.type", "ro.build.tags", + "ro.secure", "ro.build.type", "ro.build.tags", "vendor.boot.vbmeta.device_state", "ro.vendor.boot.warranty_bit", "ro.vendor.warranty_bit", nullptr }; static const char *prop_val[] = { "locked", "green", "1", "enforcing", "0", "0", "0", - "1", "user", "release-keys", + "1", "user", "release-keys", "locked", "0", "0", nullptr }; static const char *late_prop_key[] = - { "vendor.boot.vbmeta.device_state", "vendor.boot.verifiedbootstate", nullptr }; + { "vendor.boot.verifiedbootstate", nullptr }; static const char *late_prop_val[] = - { "locked", "green", nullptr }; + { "green", nullptr }; void hide_sensitive_props() { LOGI("hide_policy: Hiding sensitive props\n"); @@ -43,6 +43,9 @@ void hide_sensitive_props() { bootmode = getprop("ro.boot.mode"); if (!bootmode.empty() && str_contains(bootmode, "recovery")) setprop("ro.boot.mode", "unknown", false); + bootmode = getprop("vendor.boot.mode"); + if (!bootmode.empty() && str_contains(bootmode, "recovery")) + setprop("vendor.boot.mode", "unknown", false); // Xiaomi cross region flash auto hwc = getprop("ro.boot.hwc"); @@ -65,10 +68,6 @@ void hide_late_sensitive_props() { if (!value.empty() && value != late_prop_val[i]) setprop(prop_key[i], late_prop_val[i], false); } - - auto bootmode = getprop("vendor.boot.mode"); - if (!bootmode.empty() && str_contains(bootmode, "recovery")) - setprop("vendor.boot.mode", "unknown", false); } static void lazy_unmount(const char* mountpoint) {