Skip to content

fix(input): 分离逻辑 contact 与 Android pointerId - #40

Open
syoius wants to merge 1 commit into
Aliothmoon:mainfrom
syoius:fix/stable-preview-pointer-ids
Open

syoius wants to merge 1 commit into
Aliothmoon:mainfrom
syoius:fix/stable-preview-pointer-ids

Conversation

@syoius

@syoius syoius commented Sep 17, 2026

Copy link
Copy Markdown

手动控制虚拟屏时,某些游戏在启动过渡页面可以点击,进入游戏主界面后却不再响应;同一游戏仍可响应自动任务的点击。在 vivo V2419A / Android 16 上遇到了这一现象,用户已确认包含本修复的 Maa鸢预览版恢复了手动触控。

预览侧从 15 向下分配逻辑 contact,用于避开自动任务通常使用的 0;当前输入层把该编号直接写入 MotionEvent.PointerProperties.id。本改动保留原有 contact 隔离,为 Android 事件独立分配最低空闲 pointerId:首指从 0 开始,移动、抬起以及其他手指离开时保持已分配编号稳定,重复按下触发 CANCEL 后重新从 0 开始。

高编号 pointerId 本身是合法的;此处改善应用兼容性,不将它描述成 Android 禁止的输入。实机反馈来自包含此映射修复的预览构建,未做仅切换 pointerId 的游戏内 A/B 对照。

验证:

  • :app:testDebugUnitTest:458 通过、3 跳过、0 失败。
  • 新增 4 项单元测试,覆盖高逻辑编号映射、手动/自动两种按下顺序、抬指后的编号稳定性及重复按下重置。
  • :app:assembleDebugAndroidTest:通过;新增实际 MotionEvent 字段检查,设备自动化测试本轮未执行。
  • git diff --check:通过。

改动基于 70cd377。输入失败日志由现有 #25 另行处理,本 PR 只调整触点编号及相关测试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant