android: avoid downloading the APK again if there's one download in progress + fix signature error (#7657)

pull/7668/head
Martín Fernández 3 years ago committed by GitHub
parent 247166b3df
commit 939fcf7f0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -85,6 +85,7 @@ local Device = Generic:new{
isHapticFeedbackEnabled = yes,
hasClipboard = yes,
hasOTAUpdates = android.ota.isEnabled,
hasOTARunning = function() return android.ota.isRunning end,
hasFastWifiStatusQuery = yes,
hasSystemFonts = yes,
canOpenLink = yes,
@ -216,6 +217,7 @@ function Device:init()
local Event = require("ui/event")
UIManager:broadcastEvent(Event:new("NotCharging"))
elseif ev.code == C.AEVENT_DOWNLOAD_COMPLETE then
android.ota.isRunning = false
if android.isResumed() then
self:install()
else

@ -103,6 +103,9 @@ local Device = {
-- set to yes on devices that support over-the-air incremental updates.
hasOTAUpdates = no,
-- For devices that have non-blocking OTA updates, this function will return true if the download is currently running.
hasOTARunning = no,
-- set to yes on devices that have a non-blocking isWifiOn implementation
-- (c.f., https://github.com/koreader/koreader/pull/5211#issuecomment-521304139)
hasFastWifiStatusQuery = no,

@ -208,6 +208,13 @@ function OTAManager:checkUpdate()
end
function OTAManager:fetchAndProcessUpdate()
if Device:hasOTARunning() then
UIManager:show(InfoMessage:new{
text = _("Download already scheduled. You'll be notified when it's ready."),
})
return
end
local ota_version, local_version, link, ota_package = OTAManager:checkUpdate()
if ota_version == 0 then
@ -247,6 +254,7 @@ function OTAManager:fetchAndProcessUpdate()
if ok == C.ADOWNLOAD_EXISTS then
Device:install()
elseif ok == C.ADOWNLOAD_OK then
android.ota.isRunning = true
UIManager:show(InfoMessage:new{
text = wait_for_download,
timeout = 3,

@ -1 +1 @@
Subproject commit 77ce2b7e63d28d6b1c520764c9104975bfdeeb8f
Subproject commit 76f10d206a8b07924630598667872b0cd7ede64c
Loading…
Cancel
Save