diff --git a/native/jni/core/db.cpp b/native/jni/core/db.cpp index 976e870b3..9c3a0df37 100644 --- a/native/jni/core/db.cpp +++ b/native/jni/core/db.cpp @@ -254,12 +254,11 @@ int validate_manager(string &alt_pkg, int userid, struct stat *st) { st = &tmp_st; // Prefer DE storage - const char *base = access("/data/user_de", F_OK) == 0 ? "/data/user_de" : "/data/user"; char app_path[128]; - sprintf(app_path, "%s/%d/%s", base, userid, alt_pkg.empty() ? "xxx" : alt_pkg.data()); + sprintf(app_path, "%s/%d/%s", APP_DATA_DIR, userid, alt_pkg.empty() ? "xxx" : alt_pkg.data()); if (stat(app_path, st)) { // Check the official package name - sprintf(app_path, "%s/%d/" JAVA_PACKAGE_NAME, base, userid); + sprintf(app_path, "%s/%d/" JAVA_PACKAGE_NAME, APP_DATA_DIR, userid); if (stat(app_path, st)) { LOGE("su: cannot find manager"); memset(st, 0, sizeof(*st)); diff --git a/native/jni/include/daemon.h b/native/jni/include/daemon.h index bfc45041c..98751c91f 100644 --- a/native/jni/include/daemon.h +++ b/native/jni/include/daemon.h @@ -87,3 +87,5 @@ void broadcast_test(); extern int SDK_INT; extern bool RECOVERY_MODE; extern bool CONNECT_BROADCAST; + +#define APP_DATA_DIR (SDK_INT >= 24 ? "/data/user_de" : "/data/user") diff --git a/native/jni/magiskhide/proc_monitor.cpp b/native/jni/magiskhide/proc_monitor.cpp index f68f93960..18d587b28 100644 --- a/native/jni/magiskhide/proc_monitor.cpp +++ b/native/jni/magiskhide/proc_monitor.cpp @@ -76,50 +76,20 @@ static inline long xptrace(int request, pid_t pid, void *addr = nullptr, intptr_ return xptrace(request, pid, addr, reinterpret_cast(data)); } -static bool parse_packages_xml(string_view s) { - if (!str_starts(s, " */ - char *start = (char *) s.data(); - start[s.length() - 1] = '\0'; /* Remove trailing '>' */ - start += 9; /* Skip '