[adbwifi] Handle tls port changes.

Events such as adbd restarts can change the connection port. We need
to update the UI accordingly.

Bug: 158219145

Test: Manual.
1) Enable wireless debugging in Settings and validate port in UI via
> adb shell su 0 netstat -plnt | grep LISTEN
2) Restart adbd: > adb root
3) validate port again (may have changed)

Change-Id: I93339a6a258fbf69fa3f45186863a01126d279ce
This commit is contained in:
Joshua Duong
2020-06-10 16:49:30 -07:00
parent 03b20f864a
commit 76d2afb832

View File

@@ -113,11 +113,9 @@ public class WirelessDebuggingFragment extends DashboardFragment
} else if (AdbManager.WIRELESS_DEBUG_STATE_CHANGED_ACTION.equals(action)) {
int status = intent.getIntExtra(AdbManager.WIRELESS_STATUS_EXTRA,
AdbManager.WIRELESS_STATUS_DISCONNECTED);
if (status == AdbManager.WIRELESS_STATUS_CONNECTED) {
int port = intent.getIntExtra(AdbManager.WIRELESS_DEBUG_PORT_EXTRA, 0);
Log.i(TAG, "Got adbwifi port=" + port);
} else {
Log.i(TAG, "adbwifi server disconnected");
if (status == AdbManager.WIRELESS_STATUS_CONNECTED
|| status == AdbManager.WIRELESS_STATUS_DISCONNECTED) {
sAdbIpAddressPreferenceController.updateState(mIpAddrPreference);
}
} else if (AdbManager.WIRELESS_DEBUG_PAIRING_RESULT_ACTION.equals(action)) {
Integer res = intent.getIntExtra(