MCPcopy
hub / github.com/zai-org/Open-AutoGLM / long_press

Function long_press

phone_agent/hdc/device.py:130–158  ·  view source on GitHub ↗

Long press at the specified coordinates. Args: x: X coordinate. y: Y coordinate. duration_ms: Duration of press in milliseconds (note: HarmonyOS longClick may not support duration). device_id: Optional HDC device ID. delay: Delay in seconds after lon

(
    x: int,
    y: int,
    duration_ms: int = 3000,
    device_id: str | None = None,
    delay: float | None = None,
)

Source from the content-addressed store, hash-verified

128
129
130def long_press(
131 x: int,
132 y: int,
133 duration_ms: int = 3000,
134 device_id: str | None = None,
135 delay: float | None = None,
136) -> None:
137 """
138 Long press at the specified coordinates.
139
140 Args:
141 x: X coordinate.
142 y: Y coordinate.
143 duration_ms: Duration of press in milliseconds (note: HarmonyOS longClick may not support duration).
144 device_id: Optional HDC device ID.
145 delay: Delay in seconds after long press. If None, uses configured default.
146 """
147 if delay is None:
148 delay = TIMING_CONFIG.device.default_long_press_delay
149
150 hdc_prefix = _get_hdc_prefix(device_id)
151
152 # HarmonyOS uses uitest uiInput longClick
153 # Note: longClick may have a fixed duration, duration_ms parameter might not be supported
154 _run_hdc_command(
155 hdc_prefix + ["shell", "uitest", "uiInput", "longClick", str(x), str(y)],
156 capture_output=True,
157 )
158 time.sleep(delay)
159
160
161def swipe(

Callers

nothing calls this directly

Calls 2

_run_hdc_commandFunction · 0.90
_get_hdc_prefixFunction · 0.70

Tested by

no test coverage detected