Repository navigation
Conversation
1. TurnOffScreen waited for LockFront ShowAuth while dde-lock read Power1 SleepLock back, so both sides stalled until the 25s D-Bus timeout and the display stayed lit the whole time. 2. SessionDBusProxy::showLockAuth fire-and-forgets ShowAuth now, and the X11 turn-off path blanks the screen before requesting the lock. 3. dde-shortcut-tool's power controller uses the same async ShowAuth call, so the power-button shortcut no longer blocks its key handler. Log: Blank the screen immediately instead of waiting for LockFront. Influence: 1. Press the power button: the display blanks immediately; journalctl shows no 25s gap between "Locking session" and "Setting DPMS mode to off". 2. Lock/unlock, suspend/resume, hibernate and shutdown still work. 3. Repeat screen-off after a suspend/resume cycle and confirm the display still blanks immediately. fix(power): 修复锁屏回读导致关屏延迟 25 秒 1. TurnOffScreen 同步等待 LockFront ShowAuth,而 dde-lock 在 ShowAuth 中回读 Power1 SleepLock,双方互等到 25 秒 D-Bus 超时,期间屏幕 一直亮着。 2. SessionDBusProxy::showLockAuth 改为异步发送 ShowAuth 后立即返回, X11 关屏路径先关闭显示器再请求锁屏。 3. dde-shortcut-tool 的电源控制器同样改为异步调用 ShowAuth,按电源键 不再阻塞快捷键处理。 Log: 立即关闭显示器,不再等待 LockFront 返回。 Influence: 1. 按电源键后显示器立即熄灭;journalctl 中 "Locking session" 到 "Setting DPMS mode to off" 不再有 25 秒间隔。 2. 锁屏/解锁、待机/唤醒、休眠、关机功能正常。 3. 待机/唤醒后再按一次电源键,确认显示器仍立即关闭。 PMS: BUG-383573 (cherry picked from commit 7391dcb)
|
[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 GuideUses of the APISend LockFront ShowAuth requests asynchronously so callers do not block while LockFront reads Power1 properties.
ImplementationBlank the display before requesting the screen lock so a delayed lock operation cannot keep the display lit.
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/session/sessiondbusproxy.cpp" line_range="343" />
<code_context>
+ // LockFront's handler reads Power1 properties (SleepLock) synchronously. A
+ // blocking call here parks the Power1 main thread until the 25s D-Bus
+ // timeout, which in turn delays whatever triggered the lock (screen-off).
+ m_lockFrontInter->asyncCall("ShowAuth", autoStart);
}
</code_context>
<issue_to_address>
**Desktop exposed after resume**
When wake-time locking is enabled and the black screen is deactivated before LockFront handles the queued request, the async `doLock(true)` returns before LockFront processes `ShowAuth`, and the wakeup callback immediately calls `setBlackScreenActive(false)`; the display therefore becomes visible before the lock UI is ready, exposing the unlocked session after resume.
Keep the black screen active until LockFront confirms the session is locked or the lock UI is ready.
</issue_to_address>
### Comment 2
<location path="src/plugin-qt/power/session/sessiondbusproxy.cpp" line_range="343" />
<code_context>
+ // LockFront's handler reads Power1 properties (SleepLock) synchronously. A
+ // blocking call here parks the Power1 main thread until the 25s D-Bus
+ // timeout, which in turn delays whatever triggered the lock (screen-off).
+ m_lockFrontInter->asyncCall("ShowAuth", autoStart);
}
</code_context>
<issue_to_address>
**Suspend can race the lock**
When the suspend or hibernate path requests a lock and proceeds to sleep before LockFront processes the asynchronous request, `PowerManager::doSuspend()` and `doHibernate()` also call `doLock()` before starting sleep; `asyncCall()` returns without waiting for LockFront to finish handling `ShowAuth`, so the machine can suspend before the lock is active and resume to an unlocked session.
Ensure suspend and hibernate wait until the lock is active before entering sleep, while keeping screen-off requests non-blocking.
</issue_to_address>
### Comment 3
<location path="src/plugin-qt/power/session/sessiondbusproxy.cpp" line_range="343" />
<code_context>
+ // LockFront's handler reads Power1 properties (SleepLock) synchronously. A
+ // blocking call here parks the Power1 main thread until the 25s D-Bus
+ // timeout, which in turn delays whatever triggered the lock (screen-off).
+ m_lockFrontInter->asyncCall("ShowAuth", autoStart);
}
</code_context>
<issue_to_address>
**Overlapping lock prompts**
When two lock triggers arrive before LockFront has processed the first `ShowAuth` request and updated the locked state, each asynchronous request returns before LockFront updates the session’s locked state, so another lock trigger can pass `PowerManager::doLock`’s `sessionLocked()` check and enqueue a second `ShowAuth`; LockFront receives duplicate requests and can present redundant authentication UI.
Track a pending lock request or otherwise coalesce concurrent `ShowAuth` calls until LockFront confirms the lock state.
Also at `src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp:280`.
</issue_to_address>| // LockFront's handler reads Power1 properties (SleepLock) synchronously. A | ||
| // blocking call here parks the Power1 main thread until the 25s D-Bus | ||
| // timeout, which in turn delays whatever triggered the lock (screen-off). | ||
| m_lockFrontInter->asyncCall("ShowAuth", autoStart); |
There was a problem hiding this comment.
🟠 High · Desktop exposed after resume
When wake-time locking is enabled and the black screen is deactivated before LockFront handles the queued request, the async doLock(true) returns before LockFront processes ShowAuth, and the wakeup callback immediately calls setBlackScreenActive(false); the display therefore becomes visible before the lock UI is ready, exposing the unlocked session after resume.
Keep the black screen active until LockFront confirms the session is locked or the lock UI is ready.
Prompt for AI agents
In `src/plugin-qt/power/session/sessiondbusproxy.cpp` at line 343:
**Desktop exposed after resume**
When wake-time locking is enabled and the black screen is deactivated before LockFront handles the queued request, the async `doLock(true)` returns before LockFront processes `ShowAuth`, and the wakeup callback immediately calls `setBlackScreenActive(false)`; the display therefore becomes visible before the lock UI is ready, exposing the unlocked session after resume.
Keep the black screen active until LockFront confirms the session is locked or the lock UI is ready.| // LockFront's handler reads Power1 properties (SleepLock) synchronously. A | ||
| // blocking call here parks the Power1 main thread until the 25s D-Bus | ||
| // timeout, which in turn delays whatever triggered the lock (screen-off). | ||
| m_lockFrontInter->asyncCall("ShowAuth", autoStart); |
There was a problem hiding this comment.
🟠 High · Suspend can race the lock
When the suspend or hibernate path requests a lock and proceeds to sleep before LockFront processes the asynchronous request, PowerManager::doSuspend() and doHibernate() also call doLock() before starting sleep; asyncCall() returns without waiting for LockFront to finish handling ShowAuth, so the machine can suspend before the lock is active and resume to an unlocked session.
Ensure suspend and hibernate wait until the lock is active before entering sleep, while keeping screen-off requests non-blocking.
Prompt for AI agents
In `src/plugin-qt/power/session/sessiondbusproxy.cpp` at line 343:
**Suspend can race the lock**
When the suspend or hibernate path requests a lock and proceeds to sleep before LockFront processes the asynchronous request, `PowerManager::doSuspend()` and `doHibernate()` also call `doLock()` before starting sleep; `asyncCall()` returns without waiting for LockFront to finish handling `ShowAuth`, so the machine can suspend before the lock is active and resume to an unlocked session.
Ensure suspend and hibernate wait until the lock is active before entering sleep, while keeping screen-off requests non-blocking.| // LockFront's handler reads Power1 properties (SleepLock) synchronously. A | ||
| // blocking call here parks the Power1 main thread until the 25s D-Bus | ||
| // timeout, which in turn delays whatever triggered the lock (screen-off). | ||
| m_lockFrontInter->asyncCall("ShowAuth", autoStart); |
There was a problem hiding this comment.
🟡 Medium · Overlapping lock prompts
When two lock triggers arrive before LockFront has processed the first ShowAuth request and updated the locked state, each asynchronous request returns before LockFront updates the session’s locked state, so another lock trigger can pass PowerManager::doLock’s sessionLocked() check and enqueue a second ShowAuth; LockFront receives duplicate requests and can present redundant authentication UI.
Track a pending lock request or otherwise coalesce concurrent ShowAuth calls until LockFront confirms the lock state.
Also at src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp:280.
Prompt for AI agents
In `src/plugin-qt/power/session/sessiondbusproxy.cpp` at line 343:
**Overlapping lock prompts**
When two lock triggers arrive before LockFront has processed the first `ShowAuth` request and updated the locked state, each asynchronous request returns before LockFront updates the session’s locked state, so another lock trigger can pass `PowerManager::doLock`’s `sessionLocked()` check and enqueue a second `ShowAuth`; LockFront receives duplicate requests and can present redundant authentication UI.
Track a pending lock request or otherwise coalesce concurrent `ShowAuth` calls until LockFront confirms the lock state.
Also at `src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp:280`.
Bug: https://pms.uniontech.com/bug-view-383573.html
Backport of #217 to release/2500u2-pajil.
fix(power): avoid 25s stall when blanking the screen
SleepLock back, so both sides stalled until the 25s D-Bus timeout and
the display stayed lit the whole time.
X11 turn-off path blanks the screen before requesting the lock.
so the power-button shortcut no longer blocks its key handler.
Log: Blank the screen immediately instead of waiting for LockFront.
Influence:
no 25s gap between "Locking session" and "Setting DPMS mode to off".
still blanks immediately.
fix(power): 修复锁屏回读导致关屏延迟 25 秒
中回读 Power1 SleepLock,双方互等到 25 秒 D-Bus 超时,期间屏幕
一直亮着。
X11 关屏路径先关闭显示器再请求锁屏。
不再阻塞快捷键处理。
Log: 立即关闭显示器,不再等待 LockFront 返回。
Influence:
"Setting DPMS mode to off" 不再有 25 秒间隔。
PMS: BUG-383573
Summary by Sourcery
Eliminate the power-button screen-off stall by blanking the display first and making lock-authentication requests asynchronous.
Bug Fixes:
Enhancements: