fix: check for root even though when not needed

This commit is contained in:
oSumAtrIX 2022-06-11 22:03:55 +02:00
parent d55ca86e5c
commit 0d7581ad75
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -10,7 +10,7 @@ internal class Adb(
private val file: File, private val file: File,
private val packageName: String, private val packageName: String,
deviceName: String, deviceName: String,
private val install: Boolean = false, private val modeInstall: Boolean = false,
private val logging: Boolean = true private val logging: Boolean = true
) { ) {
private val device: JadbDevice private val device: JadbDevice
@ -19,7 +19,7 @@ internal class Adb(
device = JadbConnection().devices.find { it.serial == deviceName } device = JadbConnection().devices.find { it.serial == deviceName }
?: throw IllegalArgumentException("No such device with name $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.") throw IllegalArgumentException("Root required on $deviceName. Deploying failed.")
} }
@ -28,7 +28,7 @@ internal class Adb(
} }
internal fun deploy() { internal fun deploy() {
if (install) { if (modeInstall) {
PackageManager(device).install(file) PackageManager(device).install(file)
} else { } else {
// push patched file // push patched file