From cdbf00d1265ecf5f1821fb7bd71864e30274b321 Mon Sep 17 00:00:00 2001 From: zhangkun Date: Mon, 7 Sep 2026 10:48:11 +0800 Subject: [PATCH] fix(power): respect shutdown inhibitors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Check logind block inhibitors before scheduled shutdown. 2. Open ShutdownFront when an application blocks shutdown. Log: Prevent scheduled shutdown from bypassing block inhibitors. Influence: Blocking applications are shown instead of logout. fix(power): 遵循关机强阻塞 1. 定时关机前检查 logind 强阻塞项。 2. 存在程序阻止关机时打开 ShutdownFront 提示界面。 Log: 防止定时关机绕过应用程序的关机强阻塞。 PMS: BUG-375851 Influence: 显示阻塞程序,不再异常进入登录界面。 Change-Id: I5de0f44647bb121cd91ebb5535e675fe2b53b4f2 --- src/plugin-qt/power/session/powermanager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugin-qt/power/session/powermanager.cpp b/src/plugin-qt/power/session/powermanager.cpp index a7f5b95a..3a394385 100644 --- a/src/plugin-qt/power/session/powermanager.cpp +++ b/src/plugin-qt/power/session/powermanager.cpp @@ -1355,7 +1355,14 @@ void PowerManager::doAutoShutdown() { qInfo(logPowerSession) << "Performing auto shutdown"; closeNotify(); - m_proxy->requestShutdown(); + + QString who; + if (isInConfigOrPowerButtonInhibitors(QStringLiteral("shutdown"), who)) { + qInfo(logPowerSession) << "Scheduled shutdown blocked by" << who; + m_proxy->requestShutdownByFront(); + } else { + m_proxy->requestShutdown(); + } } void PowerManager::shutdownCountdownNotify(int count, bool playSound)