Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
fix: check for root even though when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 11, 2022
1 parent d55ca86 commit 0d7581a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/app/revanced/utils/adb/Adb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.")
}

Expand All @@ -28,7 +28,7 @@ internal class Adb(
}

internal fun deploy() {
if (install) {
if (modeInstall) {
PackageManager(device).install(file)
} else {
// push patched file
Expand Down

0 comments on commit 0d7581a

Please sign in to comment.