ReaderRolling: avoid ANR on Android when (re)rendering. (#8501)

Wrap document opening and re-renderings (which can block
the app for some time) with setIgnoreInput() to avoid ANR
on Android.
Any setting update that could possibly cause a re-rendering
should send the UpdatePos event, to ensure the re-rendering
happens in ReaderRolling:onUpdatePos() where precautions
are taken to avoid ANR.
This commit is contained in:
zwim
2021-12-07 19:55:55 +01:00
committed by GitHub
parent 02ddd41b38
commit a001a13ab6
3 changed files with 13 additions and 0 deletions

View File

@@ -106,6 +106,8 @@ function ReaderUI:init()
-- cap screen refresh on pan to 2 refreshes per second
local pan_rate = Screen.low_pan_rate and 2.0 or 30.0
Device:setIgnoreInput(true) -- Avoid ANRs on Android with unprocessed events.
self.postInitCallback = {}
self.postReaderCallback = {}
-- if we are not the top level dialog ourselves, it must be given in the table
@@ -457,6 +459,8 @@ function ReaderUI:init()
end
self.postReaderCallback = nil
Device:setIgnoreInput(false) -- Allow processing of events (on Android).
-- print("Ordered registered gestures:")
-- for _, tzone in ipairs(self._ordered_touch_zones) do
-- print(" "..tzone.def.id)