From 704541aef27a5003245776ca683c95ba619b54df Mon Sep 17 00:00:00 2001 From: Wang Han <416810799@qq.com> Date: Sat, 14 Dec 2024 00:32:58 +0800 Subject: [PATCH] Use /metadata/watchdog as preinit dir if exists Since Android 15, all domains are allowed to search /metadata so preinit dir will be exposed. Use /metadata/watchdog when /metadata is chosen as preinit device, and the dir is available (since Android 11). --- native/src/base/files.cpp | 2 ++ scripts/uninstaller.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/native/src/base/files.cpp b/native/src/base/files.cpp index eacd780e7..aa019578a 100644 --- a/native/src/base/files.cpp +++ b/native/src/base/files.cpp @@ -144,6 +144,8 @@ string resolve_preinit_dir(const char *base_dir) { dir += "/unencrypted/magisk"; } else if (access((dir + "/adb").data(), F_OK) == 0) { dir += "/adb/modules"; + } else if (access((dir + "/watchdog").data(), F_OK) == 0) { + dir += "/watchdog/magisk"; } else { dir += "/magisk"; } diff --git a/scripts/uninstaller.sh b/scripts/uninstaller.sh index 6be8173ac..5142ae4a7 100644 --- a/scripts/uninstaller.sh +++ b/scripts/uninstaller.sh @@ -151,7 +151,7 @@ rm -rf \ /cache/*magisk* /cache/unblock /data/*magisk* /data/cache/*magisk* /data/property/*magisk* \ /data/Magisk.apk /data/busybox /data/custom_ramdisk_patch.sh /data/adb/*magisk* \ /data/adb/post-fs-data.d /data/adb/service.d /data/adb/modules* \ -/data/unencrypted/magisk /metadata/magisk /persist/magisk /mnt/vendor/persist/magisk +/data/unencrypted/magisk /metadata/magisk /metadata/watchdog/magisk /persist/magisk /mnt/vendor/persist/magisk ADDOND=/system/addon.d/99-magisk.sh if [ -f $ADDOND ]; then