adb: Set a hostname for mDNS
am: 50b39b44ec

Change-Id: Iea8700ec13502e58774968cd7383255f769fa105
diff --git a/daemon/mdns.cpp b/daemon/mdns.cpp
index 85c5a07..a8622ae 100644
--- a/daemon/mdns.cpp
+++ b/daemon/mdns.cpp
@@ -61,9 +61,13 @@
     start_mdns();
     std::lock_guard<std::mutex> lock(mdns_lock);
 
-    auto error = DNSServiceRegister(&mdns_ref, 0, 0, nullptr, "_adb._tcp",
-                                    nullptr, nullptr, htobe16((uint16_t)port),
-                                    0, nullptr, mdns_callback, nullptr);
+    std::string hostname = "adb-";
+    hostname += android::base::GetProperty("ro.serialno", "unidentified");
+
+    auto error = DNSServiceRegister(&mdns_ref, 0, 0, hostname.c_str(),
+                                    kADBServiceType, nullptr, nullptr,
+                                    htobe16((uint16_t)port), 0, nullptr,
+                                    mdns_callback, nullptr);
 
     if (error != kDNSServiceErr_NoError) {
         LOG(ERROR) << "Could not register mDNS service (" << error << ").";