Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/dde-session/impl/sessionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ void SessionManager::prepareLogout(bool force)
stopRedshift();
stopObexService();
stopDock();
stopAppSlice();

// 防止注销时,蓝牙音频设置没有断开连接
disconnectAudioDevices();
Expand Down Expand Up @@ -513,6 +514,7 @@ void SessionManager::prepareShutdown(bool force)
{
stopSogouIme();
stopBAMFDaemon();
stopAppSlice();
preparePlayShutdownSound();
stopPulseAudioService();

Expand Down Expand Up @@ -689,6 +691,22 @@ void SessionManager::stopDock()
VIEW_SERVICE(DDE_DOCK_SERVICE);
}

bool SessionManager::killUnitProcesses(const QString &unit, int signal)
{
auto reply = m_systemd1ManagerInter->KillUnit(unit, "all", signal);
if (reply.isError()) {
qWarning() << "failed to kill unit:" << unit << ", error:" << reply.error().name();
return false;
}

return true;
}

void SessionManager::stopAppSlice()
{
killUnitProcesses(APP_SLICE, SIGKILL);
}

void SessionManager::disconnectAudioDevices()
{
auto msg = QDBusInterface("org.deepin.dde.Bluetooth1"
Expand Down
2 changes: 2 additions & 0 deletions src/dde-session/impl/sessionmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public Q_SLOTS:
void stopBAMFDaemon();
void stopRedshift();
void stopDock();
bool killUnitProcesses(const QString &unit, int signal);
void stopAppSlice();
void disconnectAudioDevices();

void preparePlayShutdownSound();
Expand Down
3 changes: 2 additions & 1 deletion src/utils/utils.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2021 - 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2021 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -16,6 +16,7 @@
#define BAMFDAEMON_SERVICE "bamfdaemon.service"
#define REDSHIFT_SERVICE "redshift.service"
#define DDE_DOCK_SERVICE "dde-dock.service"
#define APP_SLICE "app.slice"

// sound
#define SOUND_EFFECT_SCHEMA "com.deepin.dde.sound-effect"
Expand Down
Loading