Repository navigation
fix(power): activate Power1 via dsm and fix lock stall - #230
deepin-bot[bot] merged 1 commit into
Conversation
Reviewer's GuideImplementationMake front-end D-Bus calls nonblocking to avoid synchronous introspection and lock-auth readback stalls, and blank the display before requesting the lock.
Remove the D-Bus interface members replaced by raw asynchronous calls.
ConfigurationUpdate Power1 D-Bus service activation to use the shared service-manager plugin template and remove the unused dedicated service unit.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/plugin-qt/power/session/sessiondbusproxy.cpp" line_range="346" />
<code_context>
+ QDBusMessage msg = QDBusMessage::createMethodCall(
+ kLockFront, kLockFrontPath, kLockFront, QStringLiteral("ShowAuth"));
+ msg << autoStart;
+ QDBusConnection::sessionBus().asyncCall(msg);
}
</code_context>
<issue_to_address>
**Actions proceed before locking completes**
When lockFront takes longer than the shortcut's 500 ms delay to process `ShowAuth`, `asyncCall` returns without waiting for LockFront to handle `ShowAuth`. In the shortcut suspend path, `handleSystemSuspend` then proceeds to suspend after a fixed 500 ms without checking lock state; a slow LockFront can leave the session unlocked when the machine suspends and resumes.
Before suspending, wait for confirmation that the session is locked, with a bounded timeout and a safe failure behavior.
Also at `src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp:280`.
</issue_to_address>
### Comment 2
<location path="src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp" line_range="280" />
<code_context>
- lockFront.call("ShowAuth", autoStartAuth);
+ // Fire and forget: LockFront reads Power1 back, so waiting for its reply
+ // from a key handler only risks the 25s D-Bus timeout.
+ lockFront.asyncCall("ShowAuth", autoStartAuth);
}
</code_context>
<issue_to_address>
**Suspend can outrun locking**
When lockFront takes longer than 500 ms to handle the request, for example while busy starting or displaying the lock UI, `handleSystemSuspend()` waits a fixed 500 ms after `doLock(true)` and then suspends, but the async call provides no indication that LockFront handled `ShowAuth` or displayed the lock UI. A delayed request can therefore leave the session unlocked when the machine suspends.
Keep the suspend request gated on LockFront handling the lock request, or otherwise confirm the session is locked before suspending.
</issue_to_address>1. The session D-Bus service file declared SystemdService=org.deepin.dde.Power1.service, but dde-services never shipped that unit, so journald showed "Unit ... not found" and dde-lock logged "read SleepLock property failed". 2. dde-lock's synchronous SleepLock read started a dedicated dsm instance whose power plugin synchronously introspected LockFront1/ShutdownFront1 exported by dde-lock, causing a 25s mutual wait. 3. Activate Power1 through deepin-service-manager's shared plugin template, drop the unused dedicated unit, and replace the front DDBusInterface proxies with raw QDBusMessage calls so plugin startup no longer introspects dde-lock services. 4. TurnOffScreen blanked the screen only after doLock(true); it now calls setDPMSModeOff() first, and showLockAuth plus PowerController::doLock fire-and-forget ShowAuth so neither path blocks on LockFront's Power1 readback. Influence: 1. Reboot and check `journalctl -fp err`: no "Unit org.deepin.dde.Power1.service not found" and no "read SleepLock property failed". 2. Auto-login shows the lock screen immediately instead of the desktop for about 20s; pressing the power button blanks the display immediately with no 25s gap before "Setting DPMS mode to off". 3. Lock/unlock, suspend/resume, hibernate and shutdown still work; repeat screen-off after a resume and confirm it still blanks immediately. 4. `systemctl --user list-units | grep Power1` shows deepin-service-plugin@org.deepin.dde.Power1.service. fix(power): 修正 Power1 激活方式并修复锁屏死锁 1. session 的 D-Bus 文件声明 SystemdService=org.deepin.dde.Power1.service,但 dde-services 从未 安装该 unit,journal 中出现 "Unit ... not found" 以及 dde-lock 的 "read SleepLock property failed"。 2. dde-lock 同步读取 SleepLock 会拉起独立 dsm 实例,其 power 插件初始化 时同步 introspect dde-lock 导出的 LockFront1/ShutdownFront1,双方互等 25 秒。 3. 改用 deepin-service-manager 的共享插件模板激活 Power1,删除未使用的 专用 unit,并把前端 DDBusInterface 改为原生 QDBusMessage 调用,启动时 不再 introspect dde-lock 服务。 4. TurnOffScreen 原先在 doLock(true) 之后才关屏,现改为先 setDPMSModeOff();showLockAuth 与 PowerController::doLock 均改为异步 发送 ShowAuth,不再阻塞等待 LockFront 回读 Power1。 Influence: 1. 重启后检查 `journalctl -fp err`,不再出现 "Unit org.deepin.dde.Power1.service not found" 和 "read SleepLock property failed"。 2. 自动登录后锁屏立即出现,不再先显示桌面约 20 秒;按电源键显示器立即 熄灭,"Setting DPMS mode to off" 前没有 25 秒间隔。 3. 锁屏/解锁、待机/唤醒、休眠、关机均正常;待机唤醒后再关屏仍立即熄灭。 4. `systemctl --user list-units | grep Power1` 显示 deepin-service-plugin@org.deepin.dde.Power1.service。 Log: 修复 Power1 激活方式与锁屏死锁,并立即关闭显示器。 PMS: BUG-383573
3710e40 to
92b1466
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 52cyb, mhduiy 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 |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
218fa56
into
linuxdeepin:release/2500u2-pajil
Bug: https://pms.uniontech.com/bug-view-383573.html
Backport of
25bc9eb+7391dcbto release/2500u2-pajil, squashed into onecommit.
SystemdService=org.deepin.dde.Power1.service, but dde-services nevershipped that unit, so journald showed
Unit ... not foundand dde-locklogged
read SleepLock property failed.SleepLockread started a dedicated dsm instancewhose power plugin synchronously introspected
LockFront1/ShutdownFront1exported by dde-lock, causing a 25s mutual wait.
drop the unused dedicated unit, and replace the front
DDBusInterfaceproxies with raw
QDBusMessagecalls so plugin startup no longerintrospects dde-lock services.
TurnOffScreenblanked the screen only afterdoLock(true); it now callssetDPMSModeOff()first, andshowLockAuthplusPowerController::doLockfire-and-forget
ShowAuthso neither path blocks on LockFront's Power1readback.
Log: 修复 Power1 激活方式与锁屏死锁,并立即关闭显示器。
PMS: BUG-383573