feat: move tray plugin loading to systemd-managed tray loader services - #1750
deepin-bot[bot] merged 1 commit into
Conversation
Reviewer's GuideThe dock now exposes its D-Bus object immediately but acquires org.deepin.dde.Dock1 only after DockCompositor readiness, allowing systemd-ordered tray loader services to start at the correct point. The in-process tray loader is removed, while notification lock-state initialization becomes asynchronous with signal precedence and retry handling. Sequence diagram for systemd-managed tray loading after dock readinesssequenceDiagram
participant DockPanel
participant DockCompositor
participant SessionBus
participant Systemd
participant TrayLoader
DockPanel->>DockCompositor: create
DockCompositor-->>DockPanel: compositorReadyChanged(true)
DockPanel->>SessionBus: registerService(org.deepin.dde.Dock1)
SessionBus-->>Systemd: BusName acquired
Systemd->>TrayLoader: start dde-tray-loader service
TrayLoader->>DockCompositor: connect to dockplugin Wayland socket
Sequence diagram for asynchronous lock-screen state initializationsequenceDiagram
participant NotificationManager
participant LockFront
participant SessionBus
NotificationManager->>SessionBus: connect Visible signal
NotificationManager->>SessionBus: async Get Visible
alt Visible signal arrives first
LockFront-->>NotificationManager: Visible(bool)
NotificationManager->>NotificationManager: onScreenLockedChanged(bool)
else Get reply arrives first
LockFront-->>NotificationManager: QDBusPendingReply<QDBusVariant>
NotificationManager->>NotificationManager: onScreenLockedChanged(bool)
else Get fails
LockFront-->>NotificationManager: error
NotificationManager->>NotificationManager: queryScreenLockedState()
end
File-Level Changes
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="panels/dock/dockpanel.cpp" line_range="56" />
<code_context>
connect(this, &DockPanel::compositorReadyChanged, this, [this] {
if (!m_compositorReady) return;
- m_loadTrayPlugins->loadDockPlugins();
+ if (!QDBusConnection::sessionBus().registerService("org.deepin.dde.Dock1")) {
+ qCWarning(dockLog) << "Failed to register org.deepin.dde.Dock1 after compositor ready";
+ }
});
}
</code_context>
<issue_to_address>
**issue (bug_risk):** If registering `org.deepin.dde.Dock1` fails after the compositor becomes ready, the code only logs a warning and never retries or reports startup failure. The Type=dbus unit therefore never reaches its active state, so tray-loader services ordered after it do not start.
**Triggers:** When the session bus registration temporarily fails or the bus name is already owned.
**Suggested fix:** Retry registration until it succeeds, or terminate/escalate the startup failure so systemd can restart the dock.
```suggestion
qFatal("Failed to register org.deepin.dde.Dock1 after compositor ready");
```
</issue_to_address>
### Comment 2
<location path="panels/notification/server/notificationmanager.cpp" line_range="723" />
<code_context>
+ m_screenLocked = true;
</code_context>
<issue_to_address>
**issue (bug_risk):** When the asynchronous `Get(Visible)` call keeps failing, `m_screenLocked` remains true forever while `queryScreenLockedState()` retries once per second. Notifications are consequently treated as locked and suppressed indefinitely instead of falling back to the unlocked state used by the previous implementation.
**Triggers:** When LockFront is absent or remains unavailable after notification manager startup.
**Suggested fix:** Choose an explicit fallback after the service is unavailable, such as setting `m_screenLocked` to false, while continuing to listen for a later lock-state signal.
```suggestion
qWarning(notifyLog) << "Failed to get the lock visible property:" << reply.error().message();
m_screenLocked = false;
```
</issue_to_address>| if (!m_compositorReady) return; | ||
| m_loadTrayPlugins->loadDockPlugins(); | ||
| if (!QDBusConnection::sessionBus().registerService("org.deepin.dde.Dock1")) { | ||
| qCWarning(dockLog) << "Failed to register org.deepin.dde.Dock1 after compositor ready"; |
There was a problem hiding this comment.
issue (bug_risk): If registering org.deepin.dde.Dock1 fails after the compositor becomes ready, the code only logs a warning and never retries or reports startup failure. The Type=dbus unit therefore never reaches its active state, so tray-loader services ordered after it do not start.
Triggers: When the session bus registration temporarily fails or the bus name is already owned.
Suggested fix: Retry registration until it succeeds, or terminate/escalate the startup failure so systemd can restart the dock.
| qCWarning(dockLog) << "Failed to register org.deepin.dde.Dock1 after compositor ready"; | |
| qFatal("Failed to register org.deepin.dde.Dock1 after compositor ready"); |
1bbdf21 to
3220869
Compare
Register org.deepin.dde.Dock1 only after the QML DockCompositor is ready so Type=dbus reflects compositor readiness. Replace the in-process LoadTrayPlugins supervisor with dde-tray-loader systemd services. Query LockFront asynchronously at startup and on service owner changes without D-Bus auto-activation, and follow Visible signals. Discard stale replies and rely on service events to recover from errors without polling. Use the desktop notification policy until a state arrives, then preserve the latest state when queries fail or the service exits. dock 仅在 QML DockCompositor 就绪后才注册 org.deepin.dde.Dock1,使 Type=dbus 单元能反映合成器就绪状态;移除进程内的 LoadTrayPlugins 管理器, 改用 dde-tray-loader 的 systemd 服务。 启动时和服务 owner 变化后异步查询 LockFront,并监听 Visible 信号; 查询禁止 D-Bus 自动激活,以保留会话启动顺序。丢弃过期回复,查询失败后 等待服务事件恢复,不再轮询。首次获取状态前使用桌面通知策略,后续查询 失败或服务退出时保留最近一次状态。 Log: move tray plugin loading to systemd-managed tray loader services Pms: TASK-395865
3220869 to
49f4994
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 分析建议:
2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 分析建议:
3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 分析建议:
4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
漏洞对比统计: 新增漏洞 0 个,减少漏洞 0 个,持平 0 个 安全漏洞详情: 分析建议:
📋 审查信息
本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy, yixinshark 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: blocked) |
Pms: TASK-395865
Summary
Test plan
Summary by Sourcery
Move tray plugin startup to systemd-managed services and make dock readiness and notification lock-screen state handling reliable.
Bug Fixes:
Enhancements:
Build:
Bug Fixes:
Enhancements:
Chores: