Repository navigation
feat: support device idle power saving flag - #227
deepin-bot[bot] merged 1 commit into
Conversation
1. Add DeviceIdlePowerSaving property backed by the power DConfig key. 2. Persist the flag and append --dev-idle when replaying the mode command. 3. Keep the last DSPC mode so toggling only adds or removes --dev-idle. 4. Load the flag at startup and apply it once via initializePowerMode. Log: Add system-side state and CLI support for device idle power saving Influence: 1. Toggle DeviceIdlePowerSaving via busctl and verify the property and DConfig value change. 2. Verify the mode command carries --dev-idle when on and omits it when off. 3. Restart Power1 and verify the flag is restored and applied only once at startup. 4. Switch power mode or trigger low battery while enabled and verify --dev-idle is kept. 5. Confirm the installed deepin-power-control version supports --dev-idle. feat: 支持设备空闲省电配置 1. 新增 DeviceIdlePowerSaving 属性,状态持久化到电源 DConfig。 2. 下发模式命令时根据开关追加或移除 --dev-idle。 3. 记录最近一次下发的 DSPC 模式,切换开关时原样重放而不重新解析。 4. 启动时加载该配置,并由 initializePowerMode 统一下发一次。 Influence: 1. 通过 busctl 切换 DeviceIdlePowerSaving,确认属性与 DConfig 值同步更新。 2. 确认开启时命令携带 --dev-idle,关闭时恢复为不带该参数。 3. 重启 Power1,确认开关状态恢复且仅在启动初始化时下发一次。 4. 开启后切换性能模式或触发低电量,确认命令仍携带 --dev-idle。 5. 确认安装的 deepin-power-control 版本支持 --dev-idle。 Log: 为设备空闲省电增加系统侧状态与命令下发支持 PMS: TASK-394399
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 52cyb 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 |
Reviewer's GuideSchema and migrationsDefine the device-idle power-saving DConfig key and its corresponding constant so the setting has a stored representation.
APIExpose DeviceIdlePowerSaving as a D-Bus property with its getter, setter, and change notification.
ImplementationTrack the most recently selected DSPC mode and append the idle flag when replaying it, including when the setting is toggled.
Load the DConfig value at startup and apply it through the power manager's configuration initialization path.
ConfigurationUpdate the Debian package configuration required by this feature.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/plugin-qt/power/system/powermanager.cpp" line_range="1109" />
<code_context>
+ if (m_deviceIdlePowerSaving == enabled)
+ return;
+
+ if (!m_loadingConfig && !authorizePowerAction())
+ return;
+
</code_context>
<issue_to_address>
**DConfig bypasses power authorization**
When an unprivileged local process writes the public, read-write `deviceIdlePowerSaving` DConfig key, the DConfig change handler calls `SetDeviceIdlePowerSaving` outside a D-Bus invocation, so `authorizePowerAction()` treats the call as authorized and the setter queues the power-control command without Polkit approval.
Restrict write access to this DConfig key or ensure external DConfig changes are authorized before applying them to the system power-control command.
Also at `src/plugin-qt/power/system/powermanager.cpp:556-557`.
</issue_to_address>
### Comment 2
<location path="src/plugin-qt/power/system/powermanager.cpp" line_range="876" />
<code_context>
+ if (m_deviceIdlePowerSaving)
+ args << QStringLiteral("--dev-idle");
+
+ enqueuePowerControl(args);
}
</code_context>
<issue_to_address>
**Hung command blocks later power changes**
When `deepin-power-control` hangs while applying the mode command, `runNextPowerControl()` waits for the process-finished signal before dequeuing another command, and there is no timeout or kill path. The queued mode update remains unapplied and later power-control commands stay blocked.
Add a bounded execution timeout that terminates the process and advances or otherwise recovers the queue.
</issue_to_address>
### Comment 3
<location path="src/plugin-qt/power/system/powermanager.cpp" line_range="876" />
<code_context>
+ if (m_deviceIdlePowerSaving)
+ args << QStringLiteral("--dev-idle");
+
+ enqueuePowerControl(args);
}
</code_context>
<issue_to_address>
**Device-idle setting stays unapplied**
When deepin-power-control fails to start or exits nonzero while replaying a device-idle toggle, `enqueueModeCommand` queues the updated command, but `runNextPowerControl` dequeues it before starting the process; on start or nonzero-exit failure, the handlers only log and advance the queue. The property and DConfig value stay updated while device-idle power saving remains unapplied.
Handle process-start and nonzero-exit failures by retrying or reverting the device-idle setting before advancing the queue.
</issue_to_address>|
/forcemerge |
|
This pr force merged! (status: unstable) |
b400856
into
linuxdeepin:develop/2500u3
Log: Add system-side state and CLI support for device idle power saving
Influence:
feat: 支持设备空闲省电配置
Log: 为设备空闲省电增加系统侧状态与命令下发支持
Influence:
PMS: TASK-394399
Backport of #218 (merged to master) to develop/2500u3. Cherry-picked commit: c45b61d "feat: support device idle power saving flag".
Summary by Sourcery
Add persistent system-side support for toggling device idle power saving and propagating it to power-control mode commands.
New Features:
Enhancements:
Build: