Skip to content

Commit 09dd4a3

Browse files
committed
feat: adapt restart calls for Wayland via dde-session
Switched reboot, update-and-reboot, and update-and-shutdown operations to use the SessionManager1 D-Bus interface under Wayland, while keeping the existing ShutdownFront1 path for X11. This is needed because the old shutdown frontend does not work correctly on Wayland compositors, where session management must go through dde-session's dedicated API. Log: Changed restart and shutdown methods to use SessionManager1 D-Bus interface on Wayland Influence: 1. Test system restart on X11 (verify Restart is called via ShutdownFront1) 2. Test system restart on Wayland (verify RequestReboot is called via SessionManager1) 3. Test Update & Reboot on both platforms 4. Test Update & Shutdown on both platforms 5. Verify no regression for existing X11 shutdown frontend flows 6. Check error handling when SessionManager1 service is unavailable feat: 在Wayland下重启服务改为调用dde-session接口 将重启、更新并重启、更新并关机等操作在Wayland环境下切换为使用 SessionManager1 D-Bus接口,X11下保持原有的ShutdownFront1调用。原因是旧的 关机前端在Wayland合成器上无法正常工作,需要通过dde-session的专用API进行 会话管理。 Log: 在Wayland环境下将重启和关机方法切换为使用SessionManager1 D-Bus接口 Influence: 1. 在X11下测试系统重启(验证通过ShutdownFront1调用Restart) 2. 在Wayland下测试系统重启(验证通过SessionManager1调用RequestReboot) 3. 在两个平台下测试“更新并重启”功能 4. 在两个平台下测试“更新并关机”功能 5. 验证现有X11关机前端流程无回归 6. 测试SessionManager1服务不可用时的错误处理 PMS: BUG-345663 Change-Id: I73c8449b6a96bdf00dc36510ceb8ecd7ffabb04f
1 parent 4bc6a55 commit 09dd4a3

4 files changed

Lines changed: 42 additions & 12 deletions

File tree

src/common/commondefine.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -41,5 +41,10 @@ const static QString ShutdownFront1Service = QStringLiteral("org.deepin.dde.Shut
4141
const static QString ShutdownFront1Path = QStringLiteral("/org/deepin/dde/ShutdownFront1");
4242
const static QString ShutdownFront1Interface = QStringLiteral("org.deepin.dde.ShutdownFront1");
4343

44+
// SessionManager1
45+
const static QString SessionManager1Service = QStringLiteral("org.deepin.dde.SessionManager1");
46+
const static QString SessionManager1Path = QStringLiteral("/org/deepin/dde/SessionManager1");
47+
const static QString SessionManager1Interface = QStringLiteral("org.deepin.dde.SessionManager1");
48+
4449
const static QString PropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties");
4550
const static QString PropertiesChanged = QStringLiteral("PropertiesChanged");

src/common/dbus/updatedbusproxy.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <QDBusReply>
1111
#include <QDBusUnixFileDescriptor>
1212
#include <QLoggingCategory>
13+
#include <DGuiApplicationHelper>
1314

1415
#include "common/commondefine.h"
1516

@@ -39,6 +40,8 @@ UpdateDBusProxy::UpdateDBusProxy(QObject *parent)
3940
LockService, LockPath, LockInterface, QDBusConnection::systemBus(), this))
4041
, m_shutdownFrontInter(new DDBusInterface(
4142
ShutdownFront1Service, ShutdownFront1Path, ShutdownFront1Interface, QDBusConnection::sessionBus(), this))
43+
, m_sessionManagerInter(new DDBusInterface(
44+
SessionManager1Service, SessionManager1Path, SessionManager1Interface, QDBusConnection::sessionBus(), this))
4245
, m_interWatcher(new QDBusServiceWatcher(UpdaterService, QDBusConnection::systemBus()))
4346

4447
{
@@ -553,15 +556,27 @@ QString UpdateDBusProxy::CurrentUser()
553556
void UpdateDBusProxy::Restart()
554557
{
555558
qCInfo(logCommon) << "Calling system restart";
556-
m_shutdownFrontInter->asyncCall(QStringLiteral("Restart"));
559+
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
560+
m_sessionManagerInter->asyncCall(QStringLiteral("RequestReboot"));
561+
} else {
562+
m_shutdownFrontInter->asyncCall(QStringLiteral("Restart"));
563+
}
557564
}
558565
void UpdateDBusProxy::UpdateAndReboot()
559566
{
560567
qCInfo(logCommon) << "Calling update and reboot";
561-
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndReboot"));
568+
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
569+
m_sessionManagerInter->asyncCall(QStringLiteral("RequestReboot"));
570+
} else {
571+
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndReboot"));
572+
}
562573
}
563574
void UpdateDBusProxy::UpdateAndShutdown()
564575
{
565576
qCInfo(logCommon) << "Calling update and shutdown";
566-
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndShutdown"));
567-
}
577+
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
578+
m_sessionManagerInter->asyncCall(QStringLiteral("RequestShutdown"));
579+
} else {
580+
m_shutdownFrontInter->asyncCall(QStringLiteral("UpdateAndShutdown"));
581+
}
582+
}

src/common/dbus/updatedbusproxy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class UpdateDBusProxy : public QObject
188188
DDBusInterface *m_login1Inter;
189189
DDBusInterface *m_lockServiceInter;
190190
DDBusInterface *m_shutdownFrontInter;
191+
DDBusInterface *m_sessionManagerInter;
191192

192193
QDBusServiceWatcher *m_interWatcher;
193194
};

src/dock-update-plugin/pluginupdateplugin.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2025-2026 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -189,12 +189,21 @@ void PluginUpdatePlugin::invokedMenuItem(const QString &itemKey, const QString &
189189
.call();
190190
} else if (menuId == MENU_RESTART) {
191191
// 重启系统
192-
DDBusSender()
193-
.service("org.deepin.dde.ShutdownFront1")
194-
.interface("org.deepin.dde.ShutdownFront1")
195-
.path("/org/deepin/dde/ShutdownFront1")
196-
.method("Restart")
197-
.call();
192+
if (Dtk::Gui::DGuiApplicationHelper::testAttribute(Dtk::Gui::DGuiApplicationHelper::IsWaylandPlatform)) {
193+
DDBusSender()
194+
.service("org.deepin.dde.SessionManager1")
195+
.interface("org.deepin.dde.SessionManager1")
196+
.path("/org/deepin/dde/SessionManager1")
197+
.method("RequestReboot")
198+
.call();
199+
} else {
200+
DDBusSender()
201+
.service("org.deepin.dde.ShutdownFront1")
202+
.interface("org.deepin.dde.ShutdownFront1")
203+
.path("/org/deepin/dde/ShutdownFront1")
204+
.method("Restart")
205+
.call();
206+
}
198207
}
199208
}
200209

0 commit comments

Comments
 (0)