Skip to content

feat: add InputFilter fix, swipe/tap actions, and throttle setting#1

Open
susll wants to merge 4 commits into
NextAlone:mainfrom
susll:main
Open

feat: add InputFilter fix, swipe/tap actions, and throttle setting#1
susll wants to merge 4 commits into
NextAlone:mainfrom
susll:main

Conversation

@susll

@susll susll commented Apr 29, 2026

Copy link
Copy Markdown

Summary

  • fix: register pass-through InputFilter - 修复 filterInputEvent 不被调用的根本原因,注册透传 InputFilter 使硬件事件能被拦截
  • feat: add swipe/tap actions - 新增屏幕滑动(4方向可调距离)和点击坐标功能
  • feat: add throttle setting - 新增触发频率限制(50-1000ms 可调),防止误触

Changes

Bug Fix

  • InputInterceptorHook: 注册 IInputFilter 动态代理,启用 native InputDispatcher 回调,带延迟重试逻辑

New Actions

  • SwipeAction: 支持上/下/左/右四个方向,距离可配置(默认 800px)
  • TapCoordinateAction: 点击指定屏幕坐标,X/Y 可配置

Settings

  • ConfigManager: 新增 throttleMs 属性(默认 200ms)
  • HomeScreen: 新增触发频率滑块(50-1000ms)

UI

  • GestureConfigScreen: 新增滑动配置弹窗(方向下拉框 + 距离输入)和坐标配置弹窗(X/Y 输入框)

Test Plan

  1. 安装模块,重启手机
  2. 检查 logcat 确认 Registered pass-through InputFilter 出现
  3. 转动对焦环,确认 ZoomRing: 日志出现
  4. 配置"屏幕滑动"动作,测试四个方向
  5. 配置"点击屏幕坐标"动作,测试点击
  6. 调整触发频率滑块,确认间隔生效

susll added 4 commits April 28, 2026 20:45
…ception

Without an InputFilter registered, InputDispatcher (native) never calls
back into InputManagerService.filterInputEvent for real hardware events.
By registering a pass-through filter via dynamic proxy, all hardware
events flow through filterInputEvent where the hook can intercept them.

- Add registerPassThroughFilter() with retry logic (30 retries, 2s delay)
- Use java.lang.reflect.Proxy to create IInputFilter implementation
- Pass all non-zoom-ring events through to foreground windows normally
- SwipeAction: 4-direction swipe with configurable distance
- TapCoordinateAction: tap at specific screen coordinates
- Register both in ActionRegistry
- Add throttleMs property to ConfigManager (default 200ms, range 50-1000ms)
- Add throttle slider in HomeScreen
- Add SwipeConfigDialog with direction dropdown and distance input
- Add TapConfigDialog with X/Y coordinate inputs
- Apply throttle check before action execution
- Use parseConfig() for action config parsing
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