Use daemon state to determine late prop hiding

This commit is contained in:
topjohnwu 2020-05-18 05:21:47 -07:00
parent 501d3e6c32
commit c3e045e367
4 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,7 @@
using namespace std; using namespace std;
bool pfs_done = false; static bool pfs_done = false;
static bool no_secure_dir = false; static bool no_secure_dir = false;
static bool safe_mode = false; static bool safe_mode = false;

View File

@ -20,7 +20,7 @@ using namespace std;
int SDK_INT = -1; int SDK_INT = -1;
bool RECOVERY_MODE = false; bool RECOVERY_MODE = false;
string MAGISKTMP; string MAGISKTMP;
int daemon_state = STATE_UNKNOWN; int DAEMON_STATE = STATE_UNKNOWN;
static struct stat self_st; static struct stat self_st;
@ -98,13 +98,13 @@ static void handle_request(int client) {
switch (req_code) { switch (req_code) {
// In case of init trigger launches, set the corresponding states // In case of init trigger launches, set the corresponding states
case POST_FS_DATA: case POST_FS_DATA:
daemon_state = STATE_POST_FS_DATA; DAEMON_STATE = STATE_POST_FS_DATA;
break; break;
case LATE_START: case LATE_START:
daemon_state = STATE_LATE_START; DAEMON_STATE = STATE_LATE_START;
break; break;
case BOOT_COMPLETE: case BOOT_COMPLETE:
daemon_state = STATE_BOOT_COMPLETE; DAEMON_STATE = STATE_BOOT_COMPLETE;
break; break;
// Simple requests to query daemon info // Simple requests to query daemon info

View File

@ -39,11 +39,11 @@ enum {
extern int SDK_INT; extern int SDK_INT;
extern bool RECOVERY_MODE; extern bool RECOVERY_MODE;
extern int daemon_state; extern int DAEMON_STATE;
extern bool pfs_done;
extern std::vector<std::string> module_list;
#define APP_DATA_DIR (SDK_INT >= 24 ? "/data/user_de" : "/data/user") #define APP_DATA_DIR (SDK_INT >= 24 ? "/data/user_de" : "/data/user")
extern std::vector<std::string> module_list;
// Daemon handlers // Daemon handlers
void post_fs_data(int client); void post_fs_data(int client);
void late_start(int client); void late_start(int client);

View File

@ -247,7 +247,7 @@ int launch_magiskhide() {
return DAEMON_ERROR; return DAEMON_ERROR;
hide_sensitive_props(); hide_sensitive_props();
if (pfs_done) if (DAEMON_STATE >= STATE_BOOT_COMPLETE)
hide_late_sensitive_props(); hide_late_sensitive_props();
// Initialize the mutex lock // Initialize the mutex lock