Repository navigation
fix: migrate power property to Power1 - #974
deepin-bot[bot] merged 1 commit into
Conversation
Reviewer's GuideImplementationUpdate DevicePower’s D-Bus constants and property-reading helper to prefer Power1, retain the legacy fallback, and keep battery percentage conversion behavior unchanged.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="deepin-devicemanager/src/DeviceManager/DevicePower.cpp" line_range="17-19" />
<code_context>
-constexpr const char* kPowerService = "com.deepin.system.Power";
-constexpr const char* kPowerPath = "/com/deepin/system/Power";
-constexpr const char* kPowerInterface = "com.deepin.system.Power";
+constexpr const char* kPowerService = "org.deepin.dde.Power1";
+constexpr const char* kPowerPath = "/org/deepin/dde/Power1";
+constexpr const char* kPowerInterface = "org.deepin.dde.Power1";
DWIDGET_USE_NAMESPACE
</code_context>
<issue_to_address>
**Battery percentage diverges from status bar**
When device Manager runs on a supported pre-V25 release that exposes only the legacy Power service, `QDBusInterface` looks up the Power1 service, so `setInfoFromUpower` logs an error and retains UPower’s percentage instead of reading the Power daemon’s value; when those values differ, the displayed percentage diverges from the status bar.
Add a backward-compatible lookup or fallback for the legacy Power service on releases that do not expose Power1.
</issue_to_address>cb0c169 to
7307078
Compare
115f771 to
7bcb982
Compare
|
已处理 review 建议:保留 V25 的 |
1. Update the power service, object path, and interface names. 2. Keep system bus access and double property conversion. 3. Preserve the battery percentage display behavior. Log: Battery percentage now reads from org.deepin.dde.Power1. Influence: 1. Open Device Manager and check the battery percentage. 2. Verify the value updates after power state changes. 3. Verify no D-Bus errors appear in the log. fix: 迁移电源属性到 Power1 1. 更新电源服务名、对象路径和接口名。 2. 保持 system bus 和 double 类型读取方式不变。 3. 保持电池百分比显示行为不变。 Log: 电池百分比改为从 org.deepin.dde.Power1 读取。 Influence: 1. 打开设备管理器,检查电池百分比显示。 2. 验证电源状态变化后数值能够刷新。 3. 验证日志中没有相关 D-Bus 错误。 PMS: TASK-398517 Log: Migrated the battery power property to org.deepin.dde.Power1.
7bcb982 to
d618ec4
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,可读性好 ✅ 通过 潜在问题: 建议: ['建议为 readBatteryPercentage 函数添加简要注释,说明其作用(从指定 D-Bus 服务读取电池百分比)和返回值含义(成功返回 true 并设置 value)'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 建议为 readBatteryPercentage 添加注释 // 从指定的 D-Bus 电源服务读取电池百分比属性 // 成功时返回 true 并通过 value 输出百分比,失败返回 false static bool readBatteryPercentage(const char *service, const char *path,
const char *interfaceName, double &value)
{
QDBusInterface interface(service, path, interfaceName, QDBusConnection::systemBus());
if (!interface.isValid())
return false;
const QVariant percentage = interface.property("BatteryPercentage");
if (!percentage.isValid())
return false;
value = percentage.toDouble();
return true;
}本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
远程 V25 实机验证(10.8.7.203,system bus):
因此 V25 主路径读取正常;旧服务回退路径保留用于 pre-V25 环境。 |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
Summary
Migrate the Device Manager power property from
com.deepin.system.Powertoorg.deepin.dde.Power1, while keeping system bus access and double conversion unchanged.Verification
git diff --checkPMS: TASK-398517
Summary by Sourcery
Bug Fixes: