feat(android): add native controls and continuous multi-touch

This commit is contained in:
chenmingxuan committed 2026-11-02 21:33:45 +08:00
1 parent 3dd96078db
commit 4b12ae7728
70 files changed
+13105 -179

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
"""Completion windows shared by the native executor and one-shot transport.
NativeControls waits up to four seconds; touch frames last at most ten seconds.
The grace also covers callback/release and transport cleanup. Search deadlines
stop new input, while already-dispatched input retains its resource until quiet.
"""
from typing import Any
CONTROL_COMPLETION_SECONDS = 5.0
TOUCH_COMPLETION_GRACE_SECONDS = 5.0
def input_completion_seconds(command: str, args: dict[str, Any]) -> float:
if command == "control_action":
return CONTROL_COMPLETION_SECONDS
if command != "touch_gesture":
return 0.0
frames = args.get("frames")
last = (
frames[-1].get("at_ms")
if isinstance(frames, list) and frames and isinstance(frames[-1], dict)
else None
)
# A malformed raw call still gets the conservative maximum drain window.
duration = min(max(last, 0), 10000) if type(last) is int else 10000
return duration / 1000 + TOUCH_COMPLETION_GRACE_SECONDS