feat: use separate command to uninstall

This commit is contained in:
oSumAtrIX
2023-08-22 23:35:02 +02:00
parent b74213f66e
commit c0cc909626
4 changed files with 74 additions and 31 deletions

View File

@@ -27,7 +27,7 @@ import java.io.File
*/
internal sealed class AdbManager(deviceSerial: String? = null, protected val logger: CliLogger? = null) : Closeable {
protected val device = JadbConnection().devices.find { device -> device.serial == deviceSerial }
?: throw IllegalArgumentException("The device with the serial $deviceSerial can not be found.")
?: throw DeviceNotFoundException(deviceSerial)
init {
logger?.trace("Established connection to $deviceSerial")
@@ -127,4 +127,9 @@ internal sealed class AdbManager(deviceSerial: String? = null, protected val log
* @param file The [Apk] file.
*/
internal class Apk(val file: File, val packageName: String? = null)
internal class DeviceNotFoundException(deviceSerial: String?) :
Exception(deviceSerial?.let {
"The device with the ADB device serial \"$deviceSerial\" can not be found"
} ?: "No ADB device found")
}