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-382691
Reviewer's GuideUses of the APIMake both ShowAuth callers fire-and-forget so they do not block while LockFront reads Power1 properties.
ImplementationBlank the display before requesting the lock so LockFront cannot delay screen-off.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, 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 |
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/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>
**Machine suspends before lock is ready**
When lockFront takes longer than 500 ms to handle `ShowAuth`, `PowerController::handleSystemSuspend` starts its 500 ms pause after `asyncCall` only queues `ShowAuth`, then calls `systemSuspend` before LockFront has established the lock. The machine can resume without the intended lock screen.
Wait until LockFront has handled `ShowAuth` before allowing `systemSuspend` to proceed.
</issue_to_address>
### Comment 2
<location path="src/plugin-qt/power/session/sessiondbusproxy.cpp" line_range="347" />
<code_context>
return;
}
- if (m_screenBlackLock)
</code_context>
<issue_to_address>
**Desktop briefly exposed after resume**
When the machine resumes while the screensaver was running and `lockScreenAtAwake` is enabled, `handleWakeup` sends `ShowAuth` through `showLockAuth` and immediately deactivates the black screen without waiting for LockFront to display the lock UI. The desktop is visible and interactive during that gap, so someone at the device can view or use the session before authentication appears.
Keep the black screen active until LockFront confirms the lock UI is ready, or use another synchronization mechanism that guarantees the session remains masked until authentication is enforced.
</issue_to_address>
### Comment 3
<location path="src/plugin-qt/power/session/sessiondbusproxy.cpp" line_range="346" />
<code_context>
kLockFront, kLockFrontPath, kLockFront, QStringLiteral("ShowAuth"));
msg << autoStart;
- QDBusConnection::sessionBus().call(msg, QDBus::Block);
+ QDBusConnection::sessionBus().asyncCall(msg);
}
</code_context>
<issue_to_address>
**Suspend can overtake locking**
When a suspend request proceeds before LockFront has handled the asynchronous lock request, `showLockAuth` returns without waiting for LockFront to process `ShowAuth`, so callers that immediately proceed with a suspend request no longer have the former reply as an ordering barrier. If suspend reaches the system before the session is locked, the machine resumes without the expected lock screen.
Preserve ordering where locking is required by proceeding with suspend only after a lock-state confirmation or a bounded asynchronous completion check.
</issue_to_address>| 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); |
There was a problem hiding this comment.
🟠 High · Machine suspends before lock is ready
When lockFront takes longer than 500 ms to handle ShowAuth, PowerController::handleSystemSuspend starts its 500 ms pause after asyncCall only queues ShowAuth, then calls systemSuspend before LockFront has established the lock. The machine can resume without the intended lock screen.
Wait until LockFront has handled ShowAuth before allowing systemSuspend to proceed.
Prompt for AI agents
In `src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp` at line 280:
**Machine suspends before lock is ready**
When lockFront takes longer than 500 ms to handle `ShowAuth`, `PowerController::handleSystemSuspend` starts its 500 ms pause after `asyncCall` only queues `ShowAuth`, then calls `systemSuspend` before LockFront has established the lock. The machine can resume without the intended lock screen.
Wait until LockFront has handled `ShowAuth` before allowing `systemSuspend` to proceed.| msg << autoStart; | ||
| QDBusConnection::sessionBus().call(msg, QDBus::Block); | ||
| QDBusConnection::sessionBus().asyncCall(msg); | ||
| } |
There was a problem hiding this comment.
🟡 Medium · Desktop briefly exposed after resume
When the machine resumes while the screensaver was running and lockScreenAtAwake is enabled, handleWakeup sends ShowAuth through showLockAuth and immediately deactivates the black screen without waiting for LockFront to display the lock UI. The desktop is visible and interactive during that gap, so someone at the device can view or use the session before authentication appears.
Keep the black screen active until LockFront confirms the lock UI is ready, or use another synchronization mechanism that guarantees the session remains masked until authentication is enforced.
Prompt for AI agents
In `src/plugin-qt/power/session/sessiondbusproxy.cpp` at line 347:
**Desktop briefly exposed after resume**
When the machine resumes while the screensaver was running and `lockScreenAtAwake` is enabled, `handleWakeup` sends `ShowAuth` through `showLockAuth` and immediately deactivates the black screen without waiting for LockFront to display the lock UI. The desktop is visible and interactive during that gap, so someone at the device can view or use the session before authentication appears.
Keep the black screen active until LockFront confirms the lock UI is ready, or use another synchronization mechanism that guarantees the session remains masked until authentication is enforced.| kLockFront, kLockFrontPath, kLockFront, QStringLiteral("ShowAuth")); | ||
| msg << autoStart; | ||
| QDBusConnection::sessionBus().call(msg, QDBus::Block); | ||
| QDBusConnection::sessionBus().asyncCall(msg); |
There was a problem hiding this comment.
🟠 High · Suspend can overtake locking
When a suspend request proceeds before LockFront has handled the asynchronous lock request, showLockAuth returns without waiting for LockFront to process ShowAuth, so callers that immediately proceed with a suspend request no longer have the former reply as an ordering barrier. If suspend reaches the system before the session is locked, the machine resumes without the expected lock screen.
Preserve ordering where locking is required by proceeding with suspend only after a lock-state confirmation or a bounded asynchronous completion check.
Prompt for AI agents
In `src/plugin-qt/power/session/sessiondbusproxy.cpp` at line 346:
**Suspend can overtake locking**
When a suspend request proceeds before LockFront has handled the asynchronous lock request, `showLockAuth` returns without waiting for LockFront to process `ShowAuth`, so callers that immediately proceed with a suspend request no longer have the former reply as an ordering barrier. If suspend reaches the system before the session is locked, the machine resumes without the expected lock screen.
Preserve ordering where locking is required by proceeding with suspend only after a lock-state confirmation or a bounded asynchronous completion check.
Log: Blank the screen immediately instead of waiting for LockFront.
Influence:
fix(power): 修复锁屏回读导致关屏延迟 25 秒
Log: 立即关闭显示器,不再等待 LockFront 返回。
Influence:
PMS: BUG-382691
Summary by Sourcery
Eliminate the power-button screen-off delay by decoupling display blanking and lock-auth requests.
Bug Fixes: