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 +}