| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
!9801 merge fix/smart-key-user-active into master fix: 智控键新增NotifyInputActive接口支持插件主动通知用户活跃 Created-by: athends Commit-by: athends Merged-by: openharmony_ci Description: ### 相关的Issue Fixes #7652 ### 原因(目的、解决的问题等) 智控键事件在 INPUT_AFTER_NORMALIZED_LIBINPUT 阶段被插件拦截后直接通过 DispatchEvent(NetPacket, pid) 发送给客户端,返回 UseNoNeedReissue 导致 EventNormalizeHandler::HandleEvent 提前返回,整个 handler 职责链被跳过。InputActiveSubscriberHandler(用户活跃订阅 handler)位于职责链中归一化后的第一个环节,负责通过 ON_SUBSCRIBE_INPUT_ACTIVE 消息通知订阅者(如电源管理服务)刷新用户活跃状态。由于智控键绕过了职责链,订阅者收不到通知,导致屏幕过早熄灭。 ### 描述(做了什么,变更了什么) 1. 在 InputActiveSubscriberHandler 中新增 public 方法 NotifyInputActive(KeyEvent/PointerEvent),调用 OnSubscribeInputActive 通知订阅者,不调用 nextHandler_,避免事件被重复分发。 2. 在 IPluginContext(plugin_stage.h)中新增 NotifyInputActive 纯虚函数接口,暴露给插件调用。 3. 在 InputPlugin(multimodal_input_plugin_manager.cpp)中实现 NotifyInputActive,通过 InputHandler->GetInputActiveSubscriberHandler() 获取 handler 并调用。 4. 新增代码中的 CHKPV 宏展开为显式 if 语句,确保分支覆盖率工具正确统计。 5. 更新 mock 文件(subscriber_mock、MockInputPluginContext),新增 10 个 UT 用例覆盖所有 if 分支(null/valid 事件 × KeyEvent/PointerEvent × null/valid handler)。 ### 验证结果(新增、改动、可能影响的功能) - 新增 10 个单元测试用例,覆盖所有 if 分支 - 智控键插件侧需配合调用 ctx->NotifyInputActive(keyEvent),后续与插件团队对齐 - 不影响正常事件分发流程(NotifyInputActive 不走 nextHandler_ 链) ### 多模输入上库必备 checklist: - [x] 【线程安全】本次新增代码不引入新的共享可变状态,NotifyInputActive 复用 OnSubscribeInputActive 的已有访问路径 - [x] 【内存泄漏】无新增裸指针分配,shared_ptr 管理生命周期完整 - [x] 【性能】NotifyInputActive 在插件事件路径调用,非高频路径,无阻塞操作 - [x] 【避免深拷贝】参数使用 std::shared_ptr 值传递,与现有 HandleEvent 接口风格一致 - [x] 【依赖】无新增外部依赖 - [x] 【重用】复用 OnSubscribeInputActive、InputHandler->GetInputActiveSubscriberHandler() 等现有机制 - [x] 【返回值】void 函数的 null 检查均展开为显式 if + return ### 日志规范自检: - [x] 【规则】高频代码的正常流程中禁止打印日志 - [x] 【规则】代码中绝不应该执行到的位置必须打印日志 - [x] 【规则】事件日志: 谁做了什么, 主语+谓语+宾语 - [x] 【规则】状态变化: state_name:s1->s2, reason:msg - [x] 【规则】打印参数: name1=value1, name2=value2… - [x] 【规则】成功日志: xxx successful - [x] 【规则】失败日志: xxx failed, please xxx ### 安全编码自检: - [x] 【指针】使用前确保非空,已展开 CHKPV 为显式 if 判空 - [x] 【临时变量】声明即初始化,无未初始化变量 - [x] 【数组下标】本次改动不涉及数组访问 - [x] 【内存管理-申请大小校验】本次改动不涉及动态内存申请 - [x] 【内存管理-释放后置空】本次改动不涉及内存释放 - [x] 【内存管理-分配后校验】本次改动不涉及内存分配 - [x] 【内存管理-释放前校验】本次改动不涉及内存释放 - [x] 【整数运算-溢出/反转/除零】本次改动不涉及整数运算 - [x] 【整数运算-禁位操作符操作有符号整数】本次改动不涉及位操作 - [x] 【循环变量-无符号死循环】本次改动不涉及循环 - [x] 【循环变量-外部可控循环】本次改动不涉及循环 - [x] 【安全函数-返回值校验】本次改动不涉及安全函数调用 - [x] 【安全函数-buffer大小一致】本次改动不涉及 buffer 操作 - [x] 【外部输入校验-buffer边界】本次改动不涉及外部输入 buffer - [x] 【外部输入校验-MDEG审查+Fuzz/UT覆盖】已新增 10 个 UT 用例覆盖所有分支 - [x] 【常见问题-新增分支错误路径资源清理】void 函数 null 分支直接 return,无需清理 - [x] 【常见问题-宏资源泄漏】本次改动不涉及宏资源 - [x] 【常见问题-返回值类型匹配】void 函数无返回值 - [x] 【常见问题-格式符匹配】MMI_HILOGE 使用纯字符串,无格式符 - [x] 【常见问题-枚举值范围校验】本次改动不涉及枚举校验 ### 是否已执行mini system用例 - [ ] 已验证 - [x] 不涉及。如不涉及,请写明理由:本次修改为新增 NotifyInputActive 接口及单元测试补充,已完成本地编译验证;智控键插件侧调用需后续与插件团队对齐,板侧验证待插件联调后补充。 See merge request: openharmony/multimodalinput_input!9801 | 4 天前 | |
feat: add inputDevice.bindToDisplay API for binding input devices to displays Add the bindToDisplay API that allows system applications to bind external input devices (USB/Bluetooth) to specific displays. The bound device's events (key and pointer) are routed to the target display. Also improve error codes for SetDisplayBind to return specific codes for display-not-found, device-not-found, and unsupported-device scenarios. The displayId parameter uses int (i32) to match the underlying IPC type. Event dispatch binding is applied via a common ApplyBoundDisplayId function called at each device entry point (mouse/touchpad/joystick/keyboard) before displayId is used for business logic, associating events with the display group of the bound display. Co-Authored-By: Agent 🤖 AI[14%] 🔧 Human Fixed[0%] 🧑 Human[86%] 👌 AI Adopted[100%] Change-Id: I65239653d5a4611fd949587f60b58d3e48f13cc7 Signed-off-by: xueyuanzhao <zhaoxueyuan@huawei.com> Signed-off-by: zhaoxueyuan <zhaoxueyuan@huawei.com> | 13 小时前 | |
refactor: reuse native touch controller in static API Signed-off-by: hellohyh001 <huiyuehong@huawei.com> Change-Id: I3ec2ae48bcbfd2cbebdcaf5863304d050d95bbd8 | 3 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 4 天前 | ||
| 13 小时前 | ||
| 3 个月前 |