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).
This commit is contained in:
Wang Han
2024-12-14 00:32:58 +08:00
committed by John Wu
parent 005560a4c5
commit 704541aef2
2 changed files with 3 additions and 1 deletions

View File

@@ -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";
}