From 0d7581ad750525e59bd6c019d987c640588ead62 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sat, 11 Jun 2022 22:03:55 +0200 Subject: [PATCH] fix: check for root even though when not needed --- src/main/kotlin/app/revanced/utils/adb/Adb.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/utils/adb/Adb.kt b/src/main/kotlin/app/revanced/utils/adb/Adb.kt index 5097956d..95339943 100644 --- a/src/main/kotlin/app/revanced/utils/adb/Adb.kt +++ b/src/main/kotlin/app/revanced/utils/adb/Adb.kt @@ -10,7 +10,7 @@ internal class Adb( private val file: File, private val packageName: String, deviceName: String, - private val install: Boolean = false, + private val modeInstall: Boolean = false, private val logging: Boolean = true ) { private val device: JadbDevice @@ -19,7 +19,7 @@ internal class Adb( device = JadbConnection().devices.find { it.serial == deviceName } ?: throw IllegalArgumentException("No such device with name $deviceName") - if (device.run("su -h", false) != 0) + if (!modeInstall && device.run("su -h", false) != 0) throw IllegalArgumentException("Root required on $deviceName. Deploying failed.") } @@ -28,7 +28,7 @@ internal class Adb( } internal fun deploy() { - if (install) { + if (modeInstall) { PackageManager(device).install(file) } else { // push patched file