Root permissions
You can restart adbd with root permissions:
val stdout = adb.execute(
request = RestartAdbdRequest(RootAdbdMode),
serial = "emulator-5554"
)
println(stdout)
Or without root permissions:
val stdout = adb.execute(
request = RestartAdbdRequest(UnrootAdbdMode),
serial = "emulator-5554"
)
println(stdout)
Switching transport
You can switch your device to start listening on a TCP port instead of USB:
val stdout = adb.execute(
request = RestartAdbdRequest(TcpIpAdbdMode(8080)),
serial = "emulator-5554"
)
println(stdout)
To switch back to USB:
val stdout = adb.execute(
request = RestartAdbdRequest(UsbAdbdMode),
serial = "emulator-5554"
)
println(stdout)