adb: add reconnect command.
Add reconnect command for debugging. `reconnect` kicks a transport
from the host side, `reconnect device` kicks a transport from
the device side. They can be used to produce transport errors.
Bug: 25935458
Change-Id: I47daa338796b561941e7aba44a51a6dd117d1e98
(cherry picked from commit 1f4ec19e499ba981e4117f647d191603c2713e79)
diff --git a/adb/adb_client.cpp b/adb/adb_client.cpp
index db9b710..7412587 100644
--- a/adb/adb_client.cpp
+++ b/adb/adb_client.cpp
@@ -149,7 +149,8 @@
}
}
- if (memcmp(&service[0],"host",4) != 0 && switch_socket_transport(fd, error)) {
+ if ((memcmp(&service[0],"host",4) != 0 || service == "host:reconnect") &&
+ switch_socket_transport(fd, error)) {
return -1;
}
@@ -159,9 +160,11 @@
return -1;
}
- if (!adb_status(fd, error)) {
- adb_close(fd);
- return -1;
+ if (service != "reconnect") {
+ if (!adb_status(fd, error)) {
+ adb_close(fd);
+ return -1;
+ }
}
D("_adb_connect: return fd %d", fd);