Fix: Handle Runtime error raised by uiautoamtor2

This commit is contained in:
LmeSzinc 2023-02-07 19:20:16 +08:00
parent 5f73f23293
commit 8d06ce4987
2 changed files with 19 additions and 0 deletions

View File

@ -502,6 +502,20 @@ def rgb2hsv(image):
return image
def rgb2yuv(image):
"""
Convert RGB to YUV color space.
Args:
image (np.ndarray): Shape (height, width, channel)
Returns:
np.ndarray: Shape (height, width)
"""
image = cv2.cvtColor(image, cv2.COLOR_RGB2YUV)
return image
def rgb2luma(image):
"""
Convert RGB to the Y channel (Luminance) in YUV color space.

View File

@ -142,6 +142,11 @@ def handle_adb_error(e):
# the device is still available, but it needs to be disconnected and re-connected.
logger.error(e)
return True
elif 'is offline' in text:
# RuntimeError: USB device 127.0.0.1:7555 is offline
# 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.