Interface OTADownloader
- Version:
- 2024-04-22
-
Method Summary
Modifier and TypeMethodDescriptiondownloadKab
(OTADownloadRequest request) Request the downloader to download the kab identified in the request.Return the name of the downloader.boolean
Return true if the downloader is active.default void
onPause()
Called when the downloader is paused at the service level.default void
onResume()
Called when the downloader is resumed at the service level.
-
Method Details
-
getDownloaderName
String getDownloaderName()Return the name of the downloader. This may be shown in a ui as part of showing download progress. This must not be null. -
isDownloaderActive
boolean isDownloaderActive()Return true if the downloader is active. This indicates that download requests can be serviced. If a downloader can detect that is does not have the ability to download kabs (network issues, disabled, etc...) then it should return false which will cause the downloader to be ignored.This is polled during the natural scheduling process for fetching kabs and results in the downloader being skipped when not active.
If a downloader becomes active, it can wait for the current delay cycle to complete before it is checked, or it can call
otaService.active(downloader)
to indicate that the downloader is now available for use. This will cause the delay to be aborted and the downloader to be checked again if there is an OTA in progress. -
downloadKab
Request the downloader to download the kab identified in the request. If the downloader cannot find the file, throwFileNotFoundException
. If the download fails for any other reason, throwReasonException
with a reason code that may be presented to the user in a ui, typically after converting the reason code to a localization key. Upon successful download, return theFile
so the service can move the file to the installation staging area.During the download process, the downloader should call
setCurrentSize()
on the request to indicate download progress.Returning null is equivalent to throwing
FileNotFoundException
and this will be tracked as a missing file. If this is not actually the case in the downloader implementation, this will likely result in misleading data from the field.A downloader may be interrupted in the event that the current OTA session is aborted, such as by setting a
targetManifestId
to another manifest or to null. When interrupted, the downloader is expected to abort the current operation and exit immediately. The downloader must cleanup any state to allow it to be called again in the future.There is a single downloader thread shared by all downloaders. A downloader should never block for any reason other than trying to read the requested kab. For example, if a downloader needs to be paused, it should return and become inactive to avoid future calls. It should not artificially put the thread to sleep in the downloader.
- Throws:
Exception
-
onPause
default void onPause()Called when the downloader is paused at the service level. -
onResume
default void onResume()Called when the downloader is resumed at the service level.
-