Redmi K80 HyperOS 2.0 问题
async def tap(self, x: int, y: int) -> None: """ Tap at screen coordinates via Portal accessibility service. Auto-selects TCP or content provider fallback. Args: x: X coordinate y: Y coordinate """ await self._ensure_connected() if self.tcp_available: await self._tap_tcp(x, y) else: await self._tap_content_provider(x, y) async def _tap_tcp(self, x: int, y: int) -> None: """Tap via TCP (Portal HTTP API).""" try: async with httpx.AsyncClient() as client: response = await self._tcp_request( client, "POST", f"{self.tcp_base_url}/tap", extra_headers={"Content-Type": "application/json"}, json={"x": x, "y": y}, timeout=10, ) if response.status_code == 200: logger.debug(f"TCP tap successful at ({x}, {y})") else: logger.debug( f"TCP tap failed ({response.status_code}), using fallback" ) await self._tap_content_provider(x, y) except Exception as e: logger.debug(f"TCP tap error: {e}, using fallback") await self._tap_content_provider(x, y) async def _tap_content_provider(self, x: int, y: int) -> None: """Tap via adb shell input (fallback).""" await self.device.shell(f"input tap {x} {y}") async def swipe( self, x1: int, y1: int, x2: int, y2: int, duration_ms: int = 1000, ) -> None: """ Swipe via Portal accessibility service. Auto-selects TCP or content provider fallback. Args: x1, y1: Start coordinates x2, y2: End coordinates …
内容来源: droidrun/mobilerun