From 6bf38e3b82f217862daa22c62d6f4129c0e45dd4 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:12:27 +0800 Subject: [PATCH] Update flutter/lib/common.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- flutter/lib/common.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 0097c1828..69a2b235e 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -2696,9 +2696,19 @@ class WakelockManager { } static void disable(UniqueKey key) { + // Mirror keep-awake behavior from enable; if wakelock was never enabled + // due to user settings, there is nothing to disable. + final keepAwake = mainGetLocalBoolOptionSync('keep-awake-during-outgoing-sessions'); + if (!keepAwake) { + return; + } if (_enabledKeys.remove(key)) { if (_enabledKeys.isEmpty) { - WakelockPlus.disable(); + // Avoid calling WakelockPlus.disable on Linux, where special handling + // is required. + if (defaultTargetPlatform != TargetPlatform.linux) { + WakelockPlus.disable(); + } } } }