feat: add handle AdbError: unknown host service

This commit is contained in:
2026-07-06 22:40:36 +08:00
parent 63d238171f
commit 430d69695c
11 changed files with 104 additions and 26 deletions
+19 -6
View File
@@ -238,12 +238,6 @@ def handle_adb_error(e):
# Raised by uiautomator2 when current adb service is killed by another version of adb service.
logger.error(e)
return True
elif 'unknown host service' in text:
# AdbError(unknown host service)
# Another version of ADB service started, current ADB service has been killed.
# Usually because user opened a Chinese emulator, which uses ADB from the Stone Age.
logger.error(e)
return True
else:
# AdbError()
logger.exception(e)
@@ -255,6 +249,25 @@ def handle_adb_error(e):
return False
def handle_unknown_host_service(e):
"""
Args:
e (Exception):
Returns:
bool: If should retry
"""
text = str(e)
if 'unknown host service' in text:
# AdbError(unknown host service)
# Another version of ADB service started, current ADB service has been killed.
# Usually because user opened a Chinese emulator, which uses ADB from the Stone Age.
logger.error(e)
return True
else:
return False
def get_serial_pair(serial):
"""
Args: