From b4c2704c7127768623a3918f0a32981525a859a1 Mon Sep 17 00:00:00 2001 From: fuleyi Date: Wed, 4 Feb 2026 10:54:09 +0800 Subject: [PATCH] fix: fix sound effect process exit and optimize bluetooth notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed sound effect service not exiting properly during logout by adding systemd service configuration. Enhanced Bluetooth file transfer notifications to properly close previous notifications and use new notification IDs. The changes include: 1. Added SystemdService directive to D-Bus service file for proper service management 2. Created systemd user service unit file for sound effect service with proper session integration 3. Modified Bluetooth OBEX agent to close previous notifications before sending new ones 4. Changed notification ID handling to use 0 (new notification) instead of replaceID for better user experience Log: Improved Bluetooth file transfer notification behavior and fixed sound effect service lifecycle Influence: 1. Test Bluetooth file transfer notifications - they should properly replace old notifications 2. Verify sound effect service exits correctly during logout/reboot 3. Check that new Bluetooth transfer notifications appear correctly 4. Test system stability when multiple file transfers occur simultaneously 5. Verify sound effects work normally during regular usage fix: 修复音效进程退出问题并优化蓝牙通知 修复注销时音效进程未正确退出的问题,通过添加 systemd 服务配置。优化蓝牙 文件传输通知,正确关闭先前通知并使用新的通知ID。 具体修改包括: 1. 在 D-Bus 服务文件中添加 SystemdService 指令以实现正确的服务管理 2. 为音效服务创建 systemd 用户服务单元文件,实现正确的会话集成 3. 修改蓝牙 OBEX 代理,在发送新通知前正确关闭先前通知 4. 更改通知 ID 处理,使用 0(新通知)而非 replaceID 以提升用户体验 Log: 改进蓝牙文件传输通知行为并修复音效服务生命周期问题 PMS: BUG-334279 BUG-299605 Influence: 1. 测试蓝牙文件传输通知 - 应正确替换旧通知 2. 验证音效服务在注销/重启时正确退出 3. 检查新的蓝牙传输通知是否正确显示 4. 测试多个文件同时传输时的系统稳定性 5. 验证正常使用期间音效功能正常工作 --- bluetooth1/obex_agent.go | 6 ++++-- .../services/org.deepin.dde.SoundEffect1.service | 3 ++- .../user/org.deepin.dde.SoundEffect1.service | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 misc/systemd/services/user/org.deepin.dde.SoundEffect1.service diff --git a/bluetooth1/obex_agent.go b/bluetooth1/obex_agent.go index e787189f1..e991007af 100644 --- a/bluetooth1/obex_agent.go +++ b/bluetooth1/obex_agent.go @@ -455,11 +455,12 @@ func (a *obexAgent) notifyProgress(notify notifications.Notifications, replaceID logger.Warning("failed to send notify:", err) } } else { + notify.CloseNotification(0, replaceID) actions = []string{"_view", gettext.Tr("View")} hints := map[string]dbus.Variant{"x-deepin-action-_view": dbus.MakeVariant("dde-file-manager,--show-item," + filename)} notifyID, err = notify.Notify(0, gettext.Tr("dde-control-center"), - replaceID, + 0, notifyIconBluetoothConnected, fmt.Sprintf(gettext.Tr("You have received files from %q successfully"), device), gettext.Tr("Done"), @@ -484,9 +485,10 @@ func (a *obexAgent) notifyFailed(notify notifications.Notifications, replaceID u body = gettext.Tr("Bluetooth connection failed") } + notify.CloseNotification(0, replaceID) notifyID, err := notify.Notify(0, gettext.Tr("dde-control-center"), - replaceID, + 0, notifyIconBluetoothConnectFailed, summary, body, diff --git a/misc/services/org.deepin.dde.SoundEffect1.service b/misc/services/org.deepin.dde.SoundEffect1.service index a135253af..bb11bc3e9 100644 --- a/misc/services/org.deepin.dde.SoundEffect1.service +++ b/misc/services/org.deepin.dde.SoundEffect1.service @@ -1,3 +1,4 @@ [D-BUS Service] Name=org.deepin.dde.SoundEffect1 -Exec=/usr/lib/deepin-daemon/soundeffect +Exec=/bin/false +SystemdService=org.deepin.dde.SoundEffect1.service diff --git a/misc/systemd/services/user/org.deepin.dde.SoundEffect1.service b/misc/systemd/services/user/org.deepin.dde.SoundEffect1.service new file mode 100644 index 000000000..2da02ed15 --- /dev/null +++ b/misc/systemd/services/user/org.deepin.dde.SoundEffect1.service @@ -0,0 +1,16 @@ +[Unit] +Description=Deepin Sound Effect Service +RefuseManualStart=no +RefuseManualStop=no +CollectMode=inactive-or-failed + +PartOf=graphical-session.target +After=dbus.service + +[Service] +Type=dbus +BusName=org.deepin.dde.SoundEffect1 +ExecStart=/usr/lib/deepin-daemon/soundeffect +Slice=session.slice +Restart=on-failure +RestartSec=1s