NetworkListener: Only disable Wi-Fi on suspend on hasWifiManager platforms

Assume the host system does things right otherwise.
Should be sane on Kindle
On PocketBook, who knows, but assuming the device actually suspends,
that should effectively kill our keepalive
Irrelevant for Android, as we skipped it because the wifi toggling
methods are interactive.
reviewable/pr10830/r1
NiLuJe 9 months ago
parent d52e0a0dfe
commit 910b67d35b

@ -757,7 +757,8 @@ end
function NetworkMgr:getRestoreMenuTable()
return {
text = _("Restore Wi-Fi connection on resume"),
help_text = _([[This will attempt to automatically and silently re-connect to Wi-Fi on startup or on resume if Wi-Fi used to be enabled the last time you used KOReader.]]),
-- i.e., *everything* flips wifi_was_on true, but only direct user interaction (i.e., Menu & Gestures) will flip it off.
help_text = _([[This will attempt to automatically and silently re-connect to Wi-Fi on startup or on resume if Wi-Fi used to be enabled the last time you used KOReader, and you did not explicitly disable it.]]),
checked_func = function() return G_reader_settings:isTrue("auto_restore_wifi") end,
enabled_func = function() return Device:hasWifiRestore() end,
callback = function() G_reader_settings:flipNilOrFalse("auto_restore_wifi") end,

@ -205,8 +205,8 @@ function NetworkListener:onSuspend()
logger.dbg("NetworkListener: onSuspend")
-- If we haven't already (e.g., via Generic's onPowerEvent), kill Wi-Fi.
-- Except on Android, where turnOnWifi/turnOffWifi are *interactive*... :/
if Device:hasWifiToggle() and NetworkMgr:isWifiOn() and not Device:isAndroid() then
-- Do so only on devices where we have explicit management of Wi-Fi: assume the host system does things properly elsewhere.
if Device:hasWifiManager() and NetworkMgr:isWifiOn() then
NetworkMgr:disableWifi()
end

Loading…
Cancel
Save