mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Device: Add some more logging in onPowerEvent
Could possibly help shed some light on potential SleepCover races... re #7633
This commit is contained in:
@@ -270,6 +270,8 @@ function Device:onPowerEvent(ev)
|
||||
self.powerd:beforeSuspend()
|
||||
local UIManager = require("ui/uimanager")
|
||||
logger.dbg("Suspending...")
|
||||
-- Add the current state of the SleepCover flag...
|
||||
logger.dbg("Sleep cover is", self.is_cover_closed and "closed" or "open")
|
||||
-- Let Screensaver set its widget up, so we get accurate info down the line in case fallbacks kick in...
|
||||
Screensaver:setup()
|
||||
-- Mostly always suspend in Portrait/Inverted Portrait mode...
|
||||
@@ -325,7 +327,11 @@ function Device:onPowerEvent(ev)
|
||||
network_manager:turnOffWifi()
|
||||
end
|
||||
end
|
||||
UIManager:scheduleIn(self.suspend_wait_timeout, self.suspend)
|
||||
-- Only actually schedule suspension if we're still supposed to go to sleep,
|
||||
-- because the Wi-Fi stuff above may have blocked for a significant amount of time...
|
||||
if self.screen_saver_mode then
|
||||
UIManager:scheduleIn(self.suspend_wait_timeout, self.suspend)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user