From c3e045e367b839912857aa575f0e66ec14e4090f Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 18 May 2020 05:21:47 -0700 Subject: [PATCH] Use daemon state to determine late prop hiding --- native/jni/core/bootstages.cpp | 2 +- native/jni/core/daemon.cpp | 8 ++++---- native/jni/include/daemon.hpp | 6 +++--- native/jni/magiskhide/hide_utils.cpp | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/native/jni/core/bootstages.cpp b/native/jni/core/bootstages.cpp index e90451724..1c732bd0d 100644 --- a/native/jni/core/bootstages.cpp +++ b/native/jni/core/bootstages.cpp @@ -19,7 +19,7 @@ using namespace std; -bool pfs_done = false; +static bool pfs_done = false; static bool no_secure_dir = false; static bool safe_mode = false; diff --git a/native/jni/core/daemon.cpp b/native/jni/core/daemon.cpp index b6eb48c06..0e04e6244 100644 --- a/native/jni/core/daemon.cpp +++ b/native/jni/core/daemon.cpp @@ -20,7 +20,7 @@ using namespace std; int SDK_INT = -1; bool RECOVERY_MODE = false; string MAGISKTMP; -int daemon_state = STATE_UNKNOWN; +int DAEMON_STATE = STATE_UNKNOWN; static struct stat self_st; @@ -98,13 +98,13 @@ static void handle_request(int client) { switch (req_code) { // In case of init trigger launches, set the corresponding states case POST_FS_DATA: - daemon_state = STATE_POST_FS_DATA; + DAEMON_STATE = STATE_POST_FS_DATA; break; case LATE_START: - daemon_state = STATE_LATE_START; + DAEMON_STATE = STATE_LATE_START; break; case BOOT_COMPLETE: - daemon_state = STATE_BOOT_COMPLETE; + DAEMON_STATE = STATE_BOOT_COMPLETE; break; // Simple requests to query daemon info diff --git a/native/jni/include/daemon.hpp b/native/jni/include/daemon.hpp index 6c29f8629..8ab65d143 100644 --- a/native/jni/include/daemon.hpp +++ b/native/jni/include/daemon.hpp @@ -39,11 +39,11 @@ enum { extern int SDK_INT; extern bool RECOVERY_MODE; -extern int daemon_state; -extern bool pfs_done; -extern std::vector module_list; +extern int DAEMON_STATE; #define APP_DATA_DIR (SDK_INT >= 24 ? "/data/user_de" : "/data/user") +extern std::vector module_list; + // Daemon handlers void post_fs_data(int client); void late_start(int client); diff --git a/native/jni/magiskhide/hide_utils.cpp b/native/jni/magiskhide/hide_utils.cpp index fa33e65e7..bf11bfde1 100644 --- a/native/jni/magiskhide/hide_utils.cpp +++ b/native/jni/magiskhide/hide_utils.cpp @@ -247,7 +247,7 @@ int launch_magiskhide() { return DAEMON_ERROR; hide_sensitive_props(); - if (pfs_done) + if (DAEMON_STATE >= STATE_BOOT_COMPLETE) hide_late_sensitive_props(); // Initialize the mutex lock