From 1486c1178204145754de54c457fccbaaad948220 Mon Sep 17 00:00:00 2001 From: Fox2Code Date: Wed, 9 Feb 2022 02:11:55 +0100 Subject: [PATCH] Prevent module install script from permanently disabling hidden APIs. --- app/src/main/assets/module_installer_compat.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/assets/module_installer_compat.sh b/app/src/main/assets/module_installer_compat.sh index 7a49a26..4a21aeb 100644 --- a/app/src/main/assets/module_installer_compat.sh +++ b/app/src/main/assets/module_installer_compat.sh @@ -42,6 +42,17 @@ grep_get_prop() { } fi +# prevent old modules from disabling hidden_apis, please use LSPosed library instead. +# See: https://github.com/LSPosed/AndroidHiddenApiBypass +settings() { + if [ "$1" == "put" ] && [ "$2" == "global" ] && ([ "$3" == "hidden_api_policy" ] || \ + [ "$3" == "hidden_api_policy_p_apps" ] || [ "$3" == "hidden_api_policy_pre_p_apps" ]); then + true + else + "$(which settings)" "$@" + fi +} + if [ $MAGISK_VER_CODE -ge 20400 ]; then # New Magisk have complete installation logic within util_functions.sh install_module