From 9d948f2c2ba418453be0113f7ef0e899b2889022 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 24 Oct 2019 12:23:03 -0400 Subject: [PATCH] Temporary disable verification when hiding app For some reason, Google Play Protect randomly blocks our self-signed repackaged Magisk Manager APKs. Since we are root, the sky is our limit, so yeah, disable package verification temporarily when installing patched APKs, LOLz Close #1979 --- .../main/java/com/topjohnwu/magisk/utils/PatchAPK.kt | 2 +- app/src/main/res/raw/utils.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.kt b/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.kt index 3c82b4642..16ae948db 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.kt +++ b/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.kt @@ -103,7 +103,7 @@ object PatchAPK { // Install the application repack.setReadable(true, false) - if (!Shell.su("pm install $repack").exec().isSuccess) + if (!Shell.su("force_pm_install $repack").exec().isSuccess) return false Config.suManager = pkg diff --git a/app/src/main/res/raw/utils.sh b/app/src/main/res/raw/utils.sh index 136b6adf3..17603ea66 100644 --- a/app/src/main/res/raw/utils.sh +++ b/app/src/main/res/raw/utils.sh @@ -109,3 +109,13 @@ EOF touch hosts/auto_mount cd / } + +force_pm_install() { + local APK=$1 + local VERIFY=`settings get global package_verifier_enable` + [ "$VERIFY" -eq 1 ] && settings set global package_verifier_enable 0 + pm install -r $APK + local res=$? + [ "$VERIFY" -eq 1 ] && settings set global package_verifier_enable 1 + return $res +}