mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-26 07:07:25 +00:00
Expose persist prop API
This commit is contained in:
parent
1eb7d7b7a8
commit
a7824af5a8
@ -16,7 +16,7 @@ char *getprop2(const char *name, int persist);
|
|||||||
int deleteprop(const char *name);
|
int deleteprop(const char *name);
|
||||||
int deleteprop2(const char *name, const int persist);
|
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 (*callback)(const char *, const char *, void *), void *cookie);
|
void getprop_all(void (*callback)(const char *, const char *, void *), void *cookie, int persist);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -133,11 +133,10 @@ static void kill_process(const char *name) {
|
|||||||
|
|
||||||
void clean_magisk_props() {
|
void clean_magisk_props() {
|
||||||
LOGD("hide_utils: Cleaning magisk props\n");
|
LOGD("hide_utils: Cleaning magisk props\n");
|
||||||
getprop_all([] (const char *name, auto, auto) -> void
|
getprop_all([](const char *name, auto, auto) -> void {
|
||||||
{
|
|
||||||
if (strstr(name, "magisk"))
|
if (strstr(name, "magisk"))
|
||||||
deleteprop2(name, 0);
|
deleteprop2(name, 0);
|
||||||
}, nullptr);
|
}, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_list(sqlite3 *db, char *proc) {
|
static int add_list(sqlite3 *db, char *proc) {
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
/* resetprop.cpp - Manipulate any system props
|
|
||||||
*
|
|
||||||
* Copyright 2016 nkk71 <nkk71x@gmail.com>
|
|
||||||
* Copyright 2016 topjohnwu <topjohnwu@gmail.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -120,11 +114,7 @@ static int init_resetprop() {
|
|||||||
|
|
||||||
static void print_props(int persist) {
|
static void print_props(int persist) {
|
||||||
auto prop_list = Array<prop_t>();
|
auto prop_list = Array<prop_t>();
|
||||||
getprop_all(collect_props, &prop_list);
|
getprop_all(collect_props, &prop_list, persist);
|
||||||
if (persist) {
|
|
||||||
read_cb_t read_cb(collect_unique_props, &prop_list);
|
|
||||||
persist_getprop_all(&read_cb);
|
|
||||||
}
|
|
||||||
prop_list.sort();
|
prop_list.sort();
|
||||||
for (auto &prop : prop_list)
|
for (auto &prop : prop_list)
|
||||||
printf("[%s]: [%s]\n", prop.name, prop.value);
|
printf("[%s]: [%s]\n", prop.name, prop.value);
|
||||||
@ -167,10 +157,14 @@ char *getprop2(const char *name, int persist) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getprop_all(void (*callback)(const char *, const char *, void *), void *cookie) {
|
void getprop_all(void (*callback)(const char *, const char *, void *), void *cookie, int persist) {
|
||||||
if (init_resetprop()) return;
|
if (init_resetprop()) return;
|
||||||
read_cb_t read_cb(callback, cookie);
|
read_cb_t read_cb(callback, cookie);
|
||||||
__system_property_foreach(read_props, &read_cb);
|
__system_property_foreach(read_props, &read_cb);
|
||||||
|
if (persist) {
|
||||||
|
read_cb.cb = collect_unique_props;
|
||||||
|
persist_getprop_all(&read_cb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int setprop(const char *name, const char *value) {
|
int setprop(const char *name, const char *value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user