Commit e645c6e4 authored by topjohnwu's avatar topjohnwu

Refactor resetprop

parent 78a3d36c
...@@ -12,9 +12,11 @@ int prop_exist(const char *name); ...@@ -12,9 +12,11 @@ int prop_exist(const char *name);
int setprop(const char *name, const char *value); int setprop(const char *name, const char *value);
int setprop2(const char *name, const char *value, const int trigger); int setprop2(const char *name, const char *value, const int trigger);
char *getprop(const char *name); char *getprop(const char *name);
int deleteprop(const char *name, const int trigger); char *getprop2(const char *name, int persist);
int deleteprop(const char *name);
int deleteprop2(const char *name, const int persist);
int read_prop_file(const char* filename, const int trigger); int read_prop_file(const char* filename, const int trigger);
void getprop_all(void (*cbk)(const char *name)); void getprop_all(void (*callback)(const char*, const char*));
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -58,9 +58,9 @@ void hide_sensitive_props() { ...@@ -58,9 +58,9 @@ void hide_sensitive_props() {
} }
} }
static void rm_magisk_prop(const char *name) { static void rm_magisk_prop(const char *name, const char *value) {
if (strstr(name, "magisk")) { if (strstr(name, "magisk")) {
deleteprop(name, 0); deleteprop2(name, 0);
} }
} }
......
...@@ -55,7 +55,7 @@ void launch_magiskhide(int client) { ...@@ -55,7 +55,7 @@ void launch_magiskhide(int client) {
hideEnabled = 1; hideEnabled = 1;
LOGI("* Starting MagiskHide\n"); LOGI("* Starting MagiskHide\n");
deleteprop(MAGISKHIDE_PROP, 1); deleteprop2(MAGISKHIDE_PROP, 1);
hide_sensitive_props(); hide_sensitive_props();
...@@ -102,7 +102,7 @@ void stop_magiskhide(int client) { ...@@ -102,7 +102,7 @@ void stop_magiskhide(int client) {
hideEnabled = 0; hideEnabled = 0;
setprop(MAGISKHIDE_PROP, "0"); setprop(MAGISKHIDE_PROP, "0");
// Remove without actually removing persist props // Remove without actually removing persist props
deleteprop(MAGISKHIDE_PROP, 0); deleteprop2(MAGISKHIDE_PROP, 0);
pthread_kill(proc_monitor_thread, SIGUSR1); pthread_kill(proc_monitor_thread, SIGUSR1);
write_int(client, DAEMON_SUCCESS); write_int(client, DAEMON_SUCCESS);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment