limit wifi adb reconnect to lightweight ports

This commit is contained in:
Your Name committed 2026-06-05 15:45:37 +08:00
1 parent e3bf99149d
commit cd7615db3c
6 files changed
+229 -31

No files matched your search

+9 -9
View File
@@ -462,7 +462,7 @@ class TestDiscoverAdbDevices:
assert devs[0].model == "Xiaomi 14"
assert devs[0].adb_state == "connected"
def test_last_port_hint_added_to_base_scan_ports(self):
def test_last_port_hint_added_to_lightweight_scan_ports(self):
captured_ports = []
def fake_scan_ports(ips, **kwargs):
@@ -478,12 +478,12 @@ class TestDiscoverAdbDevices:
assert captured_ports
assert captured_ports[0][0] == 37697
assert captured_ports[0][1] == 5555
assert 5555 in captured_ports[0]
assert 44219 in captured_ports[0]
assert len(captured_ports[0]) == 65535
assert len(captured_ports[0]) <= 8
assert captured_ports[1] == [5555]
def test_auto_mode_full_port_scan_before_base_5555(self):
def test_auto_mode_lightweight_port_scan_before_base_5555(self):
calls = []
def fake_scan_ports(ips, **kwargs):
@@ -506,7 +506,7 @@ class TestDiscoverAdbDevices:
assert calls[0][0] == ["192.168.10.55"]
assert calls[0][1][0] == scan.DEFAULT_ADB_PORT
assert 44219 in calls[0][1]
assert len(calls[0][1]) == 65535
assert len(calls[0][1]) <= 8
assert calls[1][1] == [5555]
def test_hi_port_fallback_still_runs_when_last_port_hint_added(self):
@@ -532,12 +532,12 @@ class TestDiscoverAdbDevices:
assert calls[0][0] == ["192.168.10.2", "192.168.10.55"]
assert calls[0][1][0] == 37697
assert 44219 in calls[0][1]
assert len(calls[0][1]) == 65535
assert len(calls[0][1]) <= 8
assert calls[1][1] == [5555]
def test_full_port_scan_covers_44219(self):
ports = scan._build_full_port_range()
def test_lightweight_port_scan_covers_common_wifi_adb_ports(self):
ports = scan._build_quick_port_candidates()
assert len(ports) == 65535
assert ports[0] == scan.DEFAULT_ADB_PORT
assert 44219 in ports
assert len(ports) <= 8