adb: relax serial matching rules.
Currently targeting a device by serial requires matching the serial
number exactly. This CL relaxes the matching rules for local transports
to ignore protocol prefixes and make the port optional:
[tcp:|udp:]<hostname>[:port]
The purpose of this is to allow a user to set ANDROID_SERIAL to
something like "tcp:100.100.100.100" and have it work for both fastboot
and adb (assuming the device comes up at 100.100.100.100 in both
modes).
This CL also adds some unit tests for the modified functions to make
sure they work as expected.
Bug: 27340240
Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
diff --git a/socket.h b/socket.h
index 4083036..9eb1b19 100644
--- a/socket.h
+++ b/socket.h
@@ -114,4 +114,13 @@
void connect_to_remote(asocket *s, const char *destination);
void connect_to_smartsocket(asocket *s);
+// Internal functions that are only made available here for testing purposes.
+namespace internal {
+
+#if ADB_HOST
+char* skip_host_serial(const char* service);
+#endif
+
+} // namespace internal
+
#endif // __ADB_SOCKET_H