|
|
|
@ -30,8 +30,8 @@ class SwipeService: |
|
|
|
try: |
|
|
|
# 使用auto_discovery_adb_service获取屏幕尺寸 |
|
|
|
result = await self.auto_discovery_adb_service.execute_shell_command(device_id, "wm size") |
|
|
|
if result.get("success"): |
|
|
|
output = result.get("output", "") |
|
|
|
if result.success: |
|
|
|
output = result.output |
|
|
|
m = re.search(r"(\d+)\s*x\s*(\d+)", output) |
|
|
|
if m: |
|
|
|
w, h = int(m.group(1)), int(m.group(2)) |
|
|
|
@ -39,8 +39,8 @@ class SwipeService: |
|
|
|
|
|
|
|
# 备用方案:dumpsys display |
|
|
|
result = await self.auto_discovery_adb_service.execute_shell_command(device_id, "dumpsys display") |
|
|
|
if result.get("success"): |
|
|
|
output = result.get("output", "") |
|
|
|
if result.success: |
|
|
|
output = result.output |
|
|
|
m = re.search(r"(\d+)\s*x\s*(\d+)", output) |
|
|
|
if m: |
|
|
|
w, h = int(m.group(1)), int(m.group(2)) |
|
|
|
@ -145,8 +145,8 @@ class SwipeService: |
|
|
|
# 使用auto_discovery_adb_service执行命令 |
|
|
|
result = await self.auto_discovery_adb_service.execute_shell_command(device_id, swipe_command) |
|
|
|
|
|
|
|
if not result.get("success"): |
|
|
|
error_msg = result.get("error", "Unknown error") |
|
|
|
if not result.success: |
|
|
|
error_msg = result.error or "Unknown error" |
|
|
|
logger.error(f"ADB滑动命令执行失败: {error_msg}") |
|
|
|
return { |
|
|
|
"success": False, |
|
|
|
|