Merge "adb: fix track-devices-l."

This commit is contained in:
Treehugger Robot 2019-08-01 01:09:42 +00:00 committed by Gerrit Code Review
commit 6bac7cd942
2 changed files with 6 additions and 7 deletions

View file

@ -1890,7 +1890,10 @@ int adb_commandline(int argc, const char** argv) {
} else if (!strcmp(argv[0], "track-jdwp")) {
return adb_connect_command("track-jdwp");
} else if (!strcmp(argv[0], "track-devices")) {
return adb_connect_command("host:track-devices");
if (argc > 2 || (argc == 2 && strcmp(argv[1], "-l"))) {
error_exit("usage: adb track-devices [-l]");
}
return adb_connect_command(argc == 2 ? "host:track-devices-l" : "host:track-devices");
} else if (!strcmp(argv[0], "raw")) {
if (argc != 2) {
error_exit("usage: adb raw SERVICE");

View file

@ -542,9 +542,7 @@ static void device_tracker_ready(asocket* socket) {
// for the first time, even if no update occurred.
if (tracker->update_needed) {
tracker->update_needed = false;
std::string transports = list_transports(tracker->long_output);
device_tracker_send(tracker, transports);
device_tracker_send(tracker, list_transports(tracker->long_output));
}
}
@ -587,13 +585,11 @@ void update_transports() {
update_transport_status();
// Notify `adb track-devices` clients.
std::string transports = list_transports(false);
device_tracker* tracker = device_tracker_list;
while (tracker != nullptr) {
device_tracker* next = tracker->next;
// This may destroy the tracker if the connection is closed.
device_tracker_send(tracker, transports);
device_tracker_send(tracker, list_transports(tracker->long_output));
tracker = next;
}
}