Merge "Send TLS Server port to framework over adb_auth" into main
diff --git a/adb_wifi.h b/adb_wifi.h
index 8ad3050..bc19d36 100644
--- a/adb_wifi.h
+++ b/adb_wifi.h
@@ -33,5 +33,6 @@
void adbd_wifi_init(AdbdAuthContext* ctx);
void adbd_wifi_secure_connect(atransport* t);
+void adbd_send_tls_server_port(uint16_t port);
#endif
diff --git a/daemon/adb_wifi.cpp b/daemon/adb_wifi.cpp
index a62db3a..ea6f6c1 100644
--- a/daemon/adb_wifi.cpp
+++ b/daemon/adb_wifi.cpp
@@ -146,7 +146,6 @@
}
TlsServer* sTlsServer = nullptr;
-const char kWifiPortProp[] = "service.adb.tls.port";
const char kWifiEnabledProp[] = "persist.adb.tls_server.enable";
@@ -167,7 +166,7 @@
// Start mdns connect service for discovery
register_adb_secure_connect_service(sTlsServer->port());
LOG(INFO) << "adb wifi started on port " << sTlsServer->port();
- SetProperty(kWifiPortProp, std::to_string(sTlsServer->port()));
+ adbd_send_tls_server_port(sTlsServer->port());
}
static void disable_wifi_debugging() {
@@ -180,7 +179,7 @@
}
kick_all_tcp_tls_transports();
LOG(INFO) << "adb wifi stopped";
- SetProperty(kWifiPortProp, "");
+ adbd_send_tls_server_port(0);
}
// Watches for the #kWifiEnabledProp property to toggle the TlsServer
@@ -222,3 +221,11 @@
t->auth_id = adbd_auth_tls_device_connected(auth_ctx, kAdbTransportTypeWifi, t->auth_key.data(),
t->auth_key.size());
}
+
+void adbd_send_tls_server_port(uint16_t port) {
+ if (__builtin_available(android 37, *)) {
+ adbd_auth_send_tls_server_port(auth_ctx, port);
+ } else {
+ LOG(WARNING) << "Unable to advertise TLS port, API unavailable";
+ }
+}
\ No newline at end of file