基于TalkBack Pipeline架构的高性能读屏服务
本项目完整抄写了Google TalkBack的Pipeline流水线架构,这是TalkBack的核心设计:
AccessibilityEvent
↓
Monitors(监控阶段)
↓
Interpreters(13个解释器)★ 核心精华
↓
Mappers(映射阶段)
↓
Actors(执行阶段)
↓
Feedback(带failover的反馈系统)
- InputFocusInterpreter - 输入焦点监控
- AccessibilityFocusInterpreter - 无障碍焦点解释器
- TouchExplorationInterpreter - 触摸探索解释器
- ScrollEventInterpreter - 滚动事件解释器
- DirectionNavigationInterpreter - 方向导航解释器
- SelectionEventInterpreter - 选择事件解释器
- StateChangeEventInterpreter - 状态变化解释器
- SubtreeChangeEventInterpreter - 子树变化解释器
- ContinuousReadInterpreter - 连续阅读解释器
- HintEventInterpreter - 提示事件解释器
- AutoScrollInterpreter - 自动滚动解释器
- IdleInterpreter - 空闲检测解释器
- UiChangeEventInterpreter - UI变化解释器
- 事件过滤 - 避免重复事件进入Pipeline
- 延迟处理 - 对特殊情况使用延迟处理避免事件冲突
- 缓存机制 - 滚动位置缓存、焦点状态缓存
- 快速分发 - 基于事件类型的switch快速分发
- 窗口稳定性检查 - 避免在窗口不稳定时处理焦点
- SpeechActor - 语音朗读执行器(TTS)
- VibrationActor - 震动反馈执行器
- SoundActor - 音效反馈执行器
- FocusActor - 焦点控制执行器
SimpleScreenReaderV2/
├── app/src/main/java/com/example/simplereader/
│ ├── SimpleScreenReaderService.java # 主服务类
│ ├── MainActivity.java # 设置界面
│ └── pipeline/
│ ├── Pipeline.java # 流水线核心
│ ├── Interpretation.java # 12种解释类型
│ ├── Feedback.java # 反馈系统
│ ├── FeedbackController.java # 反馈控制器
│ ├── Performance.java # 性能监控
│ ├── actors/ # 执行器
│ │ ├── SpeechActor.java
│ │ ├── VibrationActor.java
│ │ ├── SoundActor.java
│ │ └── FocusActor.java
│ └── interpreters/ # 13个解释器
│ ├── AccessibilityEventInterpreter.java
│ ├── InputFocusInterpreter.java
│ ├── AccessibilityFocusInterpreter.java
│ └── ...
└── build.gradle
- 语言: Java
- 最低SDK: Android 5.0 (API 21)
- 目标SDK: Android 14 (API 34)
- 架构: Pipeline流水线(参考TalkBack)
./gradlew assembleDebug- ✅ 屏幕内容朗读
- ✅ 触摸探索
- ✅ 焦点管理
- ✅ 滚动导航
- ✅ 震动反馈
- ✅ 音效反馈
- ✅ 可配置设置界面
Apache License 2.0