969 Commits

Author SHA1 Message Date
openharmony_ci 26627440a4 !813 merge pr_802 into master
fix: rsc opt

Created-by: hxf233333
Commit-by: hxf233333
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**


**【修改描述】**


**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!813
2026-05-27 16:00:05 +08:00
hxf233333 65cda24bb2 fix: rsc opt
Signed-off-by: hxf233333 <huxiaofei11@huawei.com>

Co-Authored-By: Agent
2026-05-26 16:47:45 +08:00
openharmony_ci b35c87810c !814 merge feat/add-media-foundation-dep into master
feat(charging): add media_foundation dependency for charging sound

Created-by: cjw123qq
Commit-by: cjw123qq
Merged-by: openharmony_ci
Description: ## Summary

Add media_foundation dependency to bundle.json and services/BUILD.gn to support media foundation functionality in charging sound service.

## Related Issue

Closes #669

Co-Authored-By: Agent

See merge request: openharmony/powermgr_battery_manager!814
2026-05-22 10:01:39 +08:00
cjw123qq 7b1e26e676 feat(charging): add media_foundation dependency for charging sound
Add media_foundation dependency to bundle.json and services/BUILD.gn
to support media foundation functionality in charging sound service.

Issue: #669

Co-Authored-By: Agent
Change-Id: Ibc547c49edc15587fc3bd2228a712b2d3d47deb3
Signed-off-by: cjw123qq <chenjunwu4@huawei.com>
2026-05-21 21:58:20 +08:00
openharmony_ci 0127ceed18 !810 merge master into master
feat: do shutdown or hibernate for hibernate enable parameter

Created-by: guochengying
Commit-by: guochengying
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/653

**【修改描述】**
根据系统参数决定低电量下走S5关机而不是S4

**【验证结果】**
PASS


See merge request: openharmony/powermgr_battery_manager!810
2026-05-12 16:23:06 +08:00
guochengying 9a1cae475d feat: do shutdown or hibernate for hibernate enable parameter
Signed-off-by: guochengying <346447065@qq.com>
2026-05-09 16:18:12 +08:00
openharmony_ci 1b5aa22554 !811 merge feat/add-battery-cli-tool into master
fix: unify all error output to OutputError JSON format

Created-by: wangyantian0
Commit-by: wangyantian
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/654

**【修改描述】**


**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!811
OpenHarmony-v7.0-Beta1
2026-05-07 20:23:05 +08:00
wangyantian df5041b022 fix: unify all error output to OutputError JSON format
- Add OutputFallbackError for cJSON alloc failure (no cJSON dependency)
- Replace PrintUsage + CLI_ERROR with OutputError in HandleCommand
- Replace CLI_ERROR with OutputError in PrintSubcommandHelp for unknown cmd
- Remove CLI_ERROR calls before OutputError in Cmd functions (dedup)
- Remove unused PrintUsage function and CLI_ERROR macro

Co-Authored-By: Agent
Change-Id: Ia2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-05-07 18:08:28 +08:00
openharmony_ci 66a55f28c0 !809 merge feat/add-battery-cli-tool into master
fix: change error status from "error" to "failed" to match spec

Created-by: wangyantian0
Commit-by: wangyantian
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/652

**【修改描述】**


**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!809
2026-05-06 18:59:34 +08:00
wangyantian ffc0a45aa0 fix: change error status from "error" to "failed" to match spec
- Update cli_handler.cpp OutputError status value
- Update ohos-batteryManager.json enum definition in all 3 subcommands
- Update docs/README.md error handling examples

Co-Authored-By: Agent
Change-Id: Ia1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-05-06 15:56:53 +08:00
openharmony_ci 89ce197983 !808 merge feat/add-battery-cli-tool into master
refactor: replace nlohmann_json with cJSON and refactor CLI handler

Created-by: wangyantian0
Commit-by: wangyantian
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/651

**【修改描述】**


**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!808
2026-05-05 20:22:13 +08:00
wangyantian 611bb36cc4 feat: use ohos_cli_executable build template
Co-Authored-By: Agent
Signed-off-by: wangyantian <wangyantian@huawei.com>
Change-Id: I92f23466084d23e5243aae28cc71fea26fd2974e
2026-05-05 17:33:12 +08:00
wangyantian aa1133fa04 refactor: rename config.json and optimize OutputSuccess ownership transfer
- Rename config.json to ohos-batteryManager.json to match CLI binary name
- Replace cJSON_Duplicate with data.release() to transfer ownership and avoid NULL risk
- Remove CJSON_DEEP_COPY magic number constant
- Add ownership transfer comment on OutputSuccess
- Add subcommand --help examples in README.md
- Update report.md references to match renamed config file

Co-Authored-By: Agent
Change-Id: Ic3b4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-05-05 16:40:51 +08:00
wangyantian e9bc5e652d refactor: replace nlohmann_json with cJSON and refactor CLI handler
- Replace nlohmann::json with cJSON for JSON output (remove heavy dependency)
- Split CmdHelp into PrintFullHelp + PrintSubcommandHelp (reduce cyclomatic complexity 12→3/4)
- Extract HasHelpFlag helper from HandleCommand (reduce cyclomatic complexity 6→5)
- Fix bug: PrintSubcommandHelp return value now propagated (unknown-cmd --help returns 1)
- Rename global variables to g_camelCase convention (g_commands, g_programName, etc.)
- Replace magic number with CJSON_DEEP_COPY constant
- Add test cases 031-032 for PrintSubcommandHelp failure path and top-level --help priority
- Remove nlohmann_json_static from both BUILD.gn files

Co-Authored-By: Agent
Change-Id: Ie3a7c1b2d4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-05-01 00:11:13 +08:00
wangyantian d39f970e37 refactor: align CLI tool with oh-cli-creator spec and config validation rules
- Rename ohos-battery-manager to ohos-batteryManager (camelCase)
- Remove help subcommand, add --help flag per spec
- Update config.json with standard fields (executablePath, inputSchema/outputSchema)
- Add standard envelope outputSchema (type/status/data/errCode/errMsg/suggestion)
- Change error status from "failed" to "error" to match spec enum definition
- Remove deprecated config fields ($schema/timeout/events/argumentMapping)
- Update BUILD.gn: add nlohmann_json_static dep
- Update bundle.json: add json component
- Update tests and docs to reflect all changes

Co-Authored-By: Agent
Change-Id: Idb1ee3c09a3b6bfc7f624ec5552358c2e243e7e4
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-04-30 18:41:25 +08:00
wangyantian 7016afb550 test: enhance test coverage and refactor CLI to meet oh-cli-creator requirements
- Replace custom json_builder with nlohmann::json for better JSON handling
- Update JSON output format to standard structure (status/data/error_code/error_msg)
- Implement subcommand help feature (e.g., 'ohos-battery-manager help capacity')
- Update config.json description to follow three-segment format
- Add cJSON:cjson dependency to BUILD.gn files
- Enhance test cases from 12 to 24 to cover all code branches and edge cases:
  * Test help command with valid subcommand that has usage
  * Test help command with valid subcommand that has no usage
  * Test help command with unknown subcommand
  * Test help command with extra arguments
  * Test boundary values (0, 100) for capacity
  * Test negative values
  * Test sequential command execution
  * Test zero values for energy queries
  * Test help with total-energy and remain-energy subcommands

Co-Authored-By: Agent
Change-Id: I3e8f7a2d1c9b4e5f6a7b8c9d0e1f2a3b4c5d6e7f
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-04-29 20:07:22 +08:00
openharmony_ci 443b2a9f83 !807 merge feat/add-battery-cli-tool into master
docs: merge USAGE.md into README.md

Created-by: wangyantian0
Commit-by: wangyantian
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/650

**【修改描述】**
调整文档描述

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!807
2026-04-29 15:17:51 +08:00
wangyantian d93c299242 docs: merge USAGE.md into README.md
Consolidate documentation into a single README.md with commands,
usage examples, error handling, and build instructions.

Co-Authored-By: Agent
Change-Id: I22bbcad5db8189338df3b1d7982f9860868aaa7b
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-04-28 19:17:25 +08:00
openharmony_ci 4eece921e0 !806 merge feat/add-battery-cli-tool into master
feat: add ohos-battery-manager CLI tool for battery capacity and energy queries

Created-by: wangyantian0
Commit-by: wangyantian
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/648

**【修改描述】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/648

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!806
2026-04-27 17:43:04 +08:00
wangyantian 56ee1320da feat: add ohos-battery-manager CLI tool for battery capacity and energy queries
Add a new CLI tool under tools/ohos-battery-manager/ that wraps
BatterySrvClient inner API to provide battery information queries
via command line interface.

Commands:
- capacity: query battery level percentage (0-100%)
- total-energy: query battery total energy (mAh)
- remain-energy: query battery remaining energy (mAh)

The tool uses static command table dispatch (std::unordered_map),
outputs JSON to stdout, logs to stderr, and is configured with
CFI sanitize per battery_manager component requirements.

Feature gate: battery_manager_feature_support_battery_cli (default: false)

Co-Authored-By: Agent
Change-Id: I11bbcad5db8189338df3b1d7982f9860868aaa7a
Signed-off-by: wangyantian <wangyantian@huawei.com>
2026-04-27 10:10:58 +08:00
openharmony_ci dd12f89375 !805 merge master into master
fix: 修复测试用例内存泄漏

Created-by: PipixiaSummer
Commit-by: xiatian
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/649

**【修改描述】**
修复测试用例内存泄漏问题

**【验证结果】**
NA


See merge request: openharmony/powermgr_battery_manager!805
2026-04-25 11:45:26 +08:00
xiatian 272770a0c6 test: fix memory leak in testcase
Signed-off-by: xiatian <xiatian44@huawei.com>
Change-Id: I316bab70c922e5dd3edf0567c9c98bf38bcc0407
2026-04-24 17:11:17 +08:00
openharmony_ci aef96c7fbc !804 merge master into master
fix: Avoid indirect dependence

Created-by: cjw123qq
Commit-by: cjw123qq
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/647

**【修改描述】**
修改间接依赖

**【验证结果】**
ok


See merge request: openharmony/powermgr_battery_manager!804
2026-04-21 17:15:08 +08:00
cjw123qq 257975df93 fix: Avoid indirect dependence
Signed-off-by: cjw123qq <chenjunwu4@huawei.com>
2026-04-14 17:42:22 +08:00
openharmony_ci e54eabc310 !799 merge add_unit_tests into master
add unit tests

Created-by: callesp
Commit-by: xiapan
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**


**【修改描述】**


**【验证结果】**
![image.png](https://raw.gitcode.com/user-images/assets/4423059/c46629a4-dc41-4385-901a-2cff53778ff3/image.png 'image.png')



See merge request: openharmony/powermgr_battery_manager!799
2026-03-04 16:50:31 +08:00
xiapan fc06399687 add unit tests
Signed-off-by: xiapan <xiapan050@chinasoftinc.com>
2026-03-04 11:12:20 +08:00
openharmony_ci 216adeb25d !798 merge master into master
fix: alarm

Created-by: Hellen_666
Commit-by: Hellen_666
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/638

**【修改描述】**
程序整改

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!798
2026-02-26 20:30:02 +08:00
Hellen_666 c88d58f04f fix: alarm
Signed-off-by: Hellen_666 <yanxuejun@h-partners.com>
2026-02-25 16:46:41 +08:00
openharmony_ci eff6898a88 !794 merge br_0131tz into master
fix: notification opt

Created-by: hxf233333
Commit-by: hxf233333
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**


**【修改描述】**
通知优化,支持一键删除与滑动删除

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!794
2026-02-24 11:06:11 +08:00
hxf233333 f35af84b87 fix: notification opt
Signed-off-by: hxf233333 <huxiaofei11@huawei.com>
2026-02-09 20:44:15 +08:00
openharmony_ci ef9412a17b !792 merge master into master
电源需求补充11种语言

Created-by: Fan-jixiang
Commit-by: Fan-jixiang
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/635

**【修改描述】**
电源需求补充11种语言

**【验证结果】**
不涉及


See merge request: openharmony/powermgr_battery_manager!792
2026-02-05 10:37:36 +08:00
Fan-jixiang aee3e40de9 1.补充11种语言
2.反向充电功率显示

Signed-off-by: Fan-jixiang <15529414087@163.com>
2026-02-03 09:56:26 +08:00
openharmony_ci b25cfa08ae !791 merge master into master
fix: repair testcase

Created-by: kong-wei-111
Commit-by: yanghang
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/633

**【修改描述】**
修复失败用例

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!791
OpenHarmony-v6.1-Release
2025-12-25 20:57:13 +08:00
yanghang afe3c93a04 fix: repair testcase
Signed-off-by: yanghang <kongwei13@h-partners.com>
2025-12-25 15:38:27 +08:00
openharmony_ci 4ee2c62049 !790 merge master into master
fix: add dynamic interface BatteryCapacityLevel.LEVEL_NONE

Created-by: cjw123qq
Commit-by: cjw123qq
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/632

**【修改描述】**
新增js默认值枚举值

**【验证结果】**
ok


See merge request: openharmony/powermgr_battery_manager!790
2025-12-25 10:28:26 +08:00
cjw123qq 8a209ee2be fix: add dynamic interface BatteryCapacityLevel.LEVEL_NONE
Signed-off-by: cjw123qq <chenjunwu4@huawei.com>
2025-12-24 15:27:59 +08:00
openharmony_ci 31a1ad1af7 !787 merge master into master
fix: abandon syscap

Created-by: kong-wei-111
Commit-by: yanghang
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/620

**【修改描述】**
废弃冗余syscap

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!787
2025-12-09 15:52:10 +08:00
yanghang 772c0e3d46 fix: abandon syscap
Signed-off-by: yanghang <kongwei13@h-partners.com>
2025-12-09 09:36:31 +08:00
openharmony_ci 508b08fa4f !785 merge master into master
feat: compatible component

Created-by: Hellen_666
Commit-by: Hellen_666
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_thermal_manager/issues/542

**【修改描述】**
组件兼容

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!785
2025-11-26 18:13:12 +08:00
openharmony_ci ecbba21486 !782 merge master into master
fix: rectification domain id

Created-by: kong-wei-111
Commit-by: yanghang
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_thermal_manager/issues/538

**【修改描述】**
整改domain id

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!782
2025-11-24 13:02:27 +08:00
openharmony_ci 733f96eb61 !784 merge master into master
fix: penglai takeover low-capacity shutdown

Created-by: cjw123qq
Commit-by: cjw123qq
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/613

**【修改描述】**
蓬莱模式接管低电量关机

**【验证结果】**
ok
![image.png](https://raw.gitcode.com/user-images/assets/4423059/d56f7c22-a6f4-4808-9ffb-92dab51d81f4/image.png 'image.png')
![image.png](https://raw.gitcode.com/user-images/assets/4423059/3b80aa00-443b-4085-9058-7dd55113129f/image.png 'image.png')

See merge request: openharmony/powermgr_battery_manager!784
2025-11-18 19:59:00 +08:00
cjw123qq 3e9a7468f2 fix: penglai takeover low-capacity shutdown
Signed-off-by: cjw123qq <chenjunwu4@huawei.com>
2025-11-18 15:43:21 +08:00
Hellen_666 105b95c1fb feat: compatible component
Signed-off-by: Hellen_666 <yanxuejun@h-partners.com>
2025-11-17 13:56:07 +08:00
yanghang 336108d350 fix: rectification domain id
Signed-off-by: yanghang <kongwei13@h-partners.com>
2025-11-14 16:37:44 +08:00
openharmony_ci 453c1d39ee !781 merge master into master
fix: async work add function name

Created-by: cjw123qq
Commit-by: cjw123qq
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_display_manager/issues/371

**【修改描述】**
napi_send_event新增参数传入函数名,增强维测

**【验证结果】**
ok


See merge request: openharmony/powermgr_battery_manager!781
2025-11-05 16:29:45 +08:00
cjw123qq 5f917a47b1 fix: async work add function name
Signed-off-by: cjw123qq <chenjunwu4@huawei.com>
2025-11-01 15:35:40 +08:00
openharmony_ci ebbc129ea7 !779 merge br_1017notify into master
feat: add controlFlags

Created-by: hxf233333
Commit-by: hxf233333
Merged-by: openharmony_ci
Description: > 请检查PR是否满足[《代码合入流程指导和规范》](https://gitee.com/openharmony/powermgr_power_manager/wikis/issue-commit-pr-standard) , 否则将不会审查通过。

**【关联Issue】**
https://gitcode.com/openharmony/powermgr_battery_manager/issues/610

**【修改描述】**
添加横幅控制

**【验证结果】**



See merge request: openharmony/powermgr_battery_manager!779
2025-10-23 10:10:19 +08:00
hxf233333 f7c541e5b9 faet: add controlFlags
Signed-off-by: hxf233333 <huxiaofei11@huawei.com>
2025-10-22 14:30:44 +08:00
hxf233333 dbf788c84d feat: add controlFlags
Signed-off-by: hxf233333 <huxiaofei11@huawei.com>
2025-10-22 14:26:13 +08:00
hxf233333 635f437894 feat: add controlFlags
Signed-off-by: hxf233333 <huxiaofei11@huawei.com>
2025-10-22 14:20:13 +08:00