fix(haptics): 恢复按键触感并统一机身振动 - #96
Conversation
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough新增 Changes设备振动协调与调用迁移
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@entry/src/main/ets/service/input/DeviceVibrationCoordinator.ets`:
- Around line 52-112: 将 DeviceVibrationCoordinator 的触感启动流程改为与来源振动请求共享的串行队列,确保旧的
startVibration 完成或失效后才执行新的 stop/start 操作,避免旧请求覆盖触感。围绕
playTouchHaptic、startSourceVibration 和 stopSourceVibration 统一排队 stop/start
请求,并在每个请求完成前复核 touchHapticEpoch/sourceEpoch;保留现有过期回调抑制和失败处理行为。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 04fe53d6-2ca5-4fde-87e3-29370b8cba46
📒 Files selected for processing (6)
entry/src/main/ets/components/CustomKeyConstants.etsentry/src/main/ets/components/SettingSlider.etsentry/src/main/ets/components/virtual/VirtualController.etsentry/src/main/ets/components/virtual/VirtualKeyboard.etsentry/src/main/ets/service/input/DeviceVibrationCoordinator.etsentry/src/main/ets/service/input/GamepadVibrationService.ets
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@entry/src/main/ets/service/input/DeviceVibrationCoordinator.ets`:
- Around line 105-196: 为 vibrationQueue 增加 native 调用超时兜底:在
executeTouchHaptic、executeSourceVibration 和 stopLocalVibration 使用的
vibrator.startVibration()/stopVibration() Promise 外层包装超时,使 native Promise 长时间未
settle 时主动 resolve 当前队列步骤并记录超时;保持现有 epoch、active 状态判断及失败回调逻辑不变,确保后续请求不会被永久阻塞。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 771ffe0f-8f60-4ee5-8c55-7a10a8431878
📒 Files selected for processing (1)
entry/src/main/ets/service/input/DeviceVibrationCoordinator.ets
改了啥呀
id 0 + usage: touch + time语义和持续时间rumble()路径保持不变,不会被按键触感偷偷带跑呀为啥要改
多个调用点各自直写同一机身马达时,连续游戏或音频振动可能覆盖短促的按键触感。现在把这只会吞触感的杂鱼竞态收进统一协调器,按键优先级和恢复时机都有明确边界。
验证
npm run checknode hvigorw.js default@CompileArkTS --mode module -p module=entry -p product=default -p buildMode=debug --no-daemon(API 24 SDK + JDK 17)git diff --checkstartVibration/stopVibration只保留在协调器内Summary by CodeRabbit