Skip to content

Commit

Permalink
fix: Execute ADB commands sequentially to fix mounting issues (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricnava00 authored Oct 9, 2023
1 parent d2e367e commit fda3eca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/app/revanced/library/adb/AdbManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ sealed class AdbManager private constructor(deviceSerial: String? = null) {

device.push(apk.file, TMP_PATH)

device.run("$CREATE_DIR $INSTALLATION_PATH")
device.run(INSTALL_PATCHED_APK, packageName)
device.run("$CREATE_DIR $INSTALLATION_PATH").waitFor()
device.run(INSTALL_PATCHED_APK, packageName).waitFor()

device.createFile(TMP_PATH, MOUNT_SCRIPT.applyReplacement(packageName))

device.run(INSTALL_MOUNT, packageName)
device.run(UMOUNT, packageName) // Sanity check.
device.run(MOUNT_PATH, packageName)
device.run(INSTALL_MOUNT, packageName).waitFor()
device.run(UMOUNT, packageName).waitFor() // Sanity check.
device.run(MOUNT_PATH, packageName).waitFor()
device.run(RESTART, packageName)
device.run(DELETE, TMP_PATH)

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/app/revanced/library/adb/Commands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal fun JadbDevice.run(command: String, su: Boolean = true): ShellProcess {
}

internal fun JadbDevice.hasSu() =
this.startCommand("su -h", false).waitFor() == 0
this.startCommand("which su", false).waitFor() == 0

internal fun JadbDevice.push(file: File, targetFilePath: String) =
push(file, RemoteFile(targetFilePath))
Expand Down

0 comments on commit fda3eca

Please sign in to comment.