adb: allow wait-for-disconnect to match offline for TCP devices.
This fixes a bug in adb root/unroot where we always fail because we're waiting for a TCP device to disappear. Test: test_device.py over TCP Change-Id: I7e4b6fdaa1070cee1f9b471de46ae00bf89b3089
This commit is contained in:
parent
03bee48659
commit
e3c62cc549
|
@ -202,11 +202,22 @@ static void wait_service(unique_fd fd, std::string serial, TransportId transport
|
|||
transport_id, &is_ambiguous, &error);
|
||||
|
||||
for (const auto& state : states) {
|
||||
// wait-for-disconnect uses kCsOffline, we don't actually want to wait for 'offline'.
|
||||
if ((t == nullptr && state == kCsOffline) || (t != nullptr && state == kCsAny) ||
|
||||
(t != nullptr && state == t->GetConnectionState())) {
|
||||
SendOkay(fd);
|
||||
return;
|
||||
if (state == kCsOffline) {
|
||||
// Special case for wait-for-disconnect:
|
||||
// We want to wait for USB devices to completely disappear, but TCP devices can
|
||||
// go into the offline state, since we automatically reconnect.
|
||||
if (!t) {
|
||||
SendOkay(fd);
|
||||
return;
|
||||
} else if (!t->GetUsbHandle()) {
|
||||
SendOkay(fd);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (t && (state == kCsAny || state == t->GetConnectionState())) {
|
||||
SendOkay(fd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue