summaryrefslogtreecommitdiff
path: root/src/org/lineageos/updater/controller/UpdaterController.java
AgeCommit message (Collapse)Author
2022-02-10Updater: The great cleanupMichael W
* Make final where possible * Remove unused casts, imports, methods, enums and constructors * Add null checks Change-Id: Idd1a16426dd1928e2ed9922f5a35ba32ce4f808b
2019-09-07Updater: Move to AndroidXLuca Stefani
Change-Id: I7bd67915638db5330b854f66f9fc1adb864b64be
2018-07-11Updater: Allow toggling A/B perf modeTheScarastic
Change-Id: I380a39bf6008b341c8005ac548d42d2413d0d643
2018-06-13Remove Controller interfaceGabriele M
This is just useless as is. Change-Id: I957ea3bda4097ccb8d730943639cd5e74b1b2440
2018-05-16Use Content-Length if greater than current sizeGabriele M
The server may temporarily report an incorrect size that is smaller than the actual size. Content-Length is expected to always be accurate, but its value does not correspond to the full file size when resuming downloads. Use Content-Length only if it's bigger than the currently known size. Change-Id: I2cc06bfbd2349f21528047b4840f549fbe84964e
2018-04-08Simplify code syntax using Java 8 featuresGabriele M
Change-Id: I3e59f0c38e4047595374a951619c9b43a46901df
2018-04-05Make updates world readableGabriele M
This should allow update_engine to access the file without granting the dac_override capability. Change-Id: I5d0c8792fd47e5571dbaf802b2725f99ee2dc150
2018-01-23Add support for duplicate linksGabriele M
Support duplicate links [1] to handle better temporarily unavailable mirrors. [1] https://tools.ietf.org/html/rfc6249 Change-Id: If78fb4a90da68ef221294eed2c59063a14cf1f43
2018-01-23Copy the updates for uncrypt using a ServiceGabriele M
Same as change I488018d01c0baf74660362a384e53bfe5d85de2b ("Use a service to export the updates"). While at it, move the code out of UpdaterService to better separate the code that deal with AB updates and regular updates. Change-Id: I2bc3e78e80f5e63c57303cbbcdc0353dbab0f67f
2018-01-23Allow service restarts while installing AB updatesGabriele M
The update engine service is independent and once started doesn't need our service to install updates. Therefore we can't assume that our service will stay up as long as the installation is being performed. If the service gets terminated while an update is being installed, we simply lose our connection to the update engine service and stop receiving notifications, the installation itself won't stop. Keep track of ongoing installations using a shared preference and use a sticky service when installing updates. The service will try to re-connect to the update engine service and determine if the installation is still ongoing. Change-Id: Id2fc11cab51610d04bf41a0927824bb8c0c94d71
2017-11-12Implement DownloadClient using HttpURLConnectionGabriele M
The version of OkHttp used in AOSP doesn't handle dynamic table size updates [1] properly [2]. Instead of fixing OkHttp or importing a prebuilt updated version, implement a new download client only using HttpURLConnection, which seems to work properly. [1] https://tools.ietf.org/html/rfc7541#section-6.3 [2] https://trac.nginx.org/nginx/ticket/1397 Change-Id: I3eedf7326f2017812c4a12d41f9ea028d255f7a8
2017-08-18Don't change status when cancelled downloads failGabriele M
It takes a bit of time to actually pause (i.e. cancel) a download. If we change the update status once the download is actually cancelled, we might override any status change that happened between the user request and its completion. For example, the following can happen when the user deletes an ongoing downloads: - pauseDownload(): DOWNLOADING -> PAUSED - deleteUpdate(): PAUSED -> DELETED - onFailure(): DELETED -> PAUSED Don't change the status of cancelled downloads from the onFailure() callback not to have an incorrect final status. Change-Id: Iee90482d82df984672c59d7c508ad834fa08061f
2017-07-21Rename cancelDownload() to deleteUpdate()Gabriele M
The method can be used to delete any update, incomplete or not.
2017-07-21Rename UpdateDownload and Update classesGabriele M
2017-07-21Define interfaces with only getters for the updatesGabriele M
This also changes the code to use the new interfaces wherever the update is not supposed to change.
2017-07-21Reorder includes directivesGabriele M
These went out of order moving some stuff around. Reorder them so that there won't be unnecessary line changes in future.
2017-07-18Rename UpdaterControllerInt to ControllerGabriele M
2017-07-18Fix a couple of typosGabriele M
2017-07-18Create model packageGabriele M
2017-07-17Don't set status of download to unknown when download failGabriele M
The controller should report the actual status of the downloads, let the clients handle the special cases. Also, don't try to resume downloads whose destination doesn't exist. This partially reverts 7369e9cea939bb715243293cedc693b049a3e770 ("Set the status of paused downloads to unknown if no file exists").
2017-07-17Send the notification and then start the downloadGabriele M
In this way if the download fails immediately, it will fail after the notification.
2017-07-16Allow to check if an AB update is being installedGabriele M
2017-07-16Allow to check if an update is being verifiedGabriele M
2017-07-16Set the status of paused downloads to unknown if no file existsGabriele M
This is useful in case the download is stopped before it could start.
2017-07-15Reset speed and ETA when pausing downloadsGabriele M
2017-07-15Update download size only if it was unknownGabriele M
The returned content-length depends on the requested range, therefore when resuming download the reported size is smaller than the actual file size and we should not update it.
2017-07-10Pass the destination File to the callbackGabriele M
The current argument is unused and it should have been removed with commit 81229329f1228bbf10ca65b2478d22341c3a19c5 ("Generate download clients using a builder class"). Instead of removing it completely, use it to pass the File of the download.
2017-07-08Allow to have different updates using the same filenameGabriele M
2017-07-08Increase number of veryfing updates immediatelyGabriele M
Or we might notify the listeners too early.
2017-07-08Protect the data of UpdaterControllerGabriele M
Create copies of the objects not to allow other classes change them, excluding those of controller package.
2017-07-08Don't modify the objects of the controller directlyGabriele M
Add a method to the controller that allows to set a list of downloads as not available online.
2017-07-08Generate download clients using a builder classGabriele M
This change allows to define a proper interface for the download client and keep its implementation completely separate. It also allows to create clients without starting the download right away, which could be useful when defining callbacks that require a reference to the client. Note that this change also drops the unused methods of DownloadClient.
2017-07-08Remove unknwon files that are in the downloads dirGabriele M
The files are supposed to be downloaded in a privileged location that the user can't access. If the user wipes the data of the application, the updates downloaded are not removed. Perform a one-time cleanup so that our downloads dir doesn't grow without control.
2017-07-07Don't save the URL of the update in the databaseGabriele M
Each update must now be in updates.json to be downloaded. Since this file already stores the URL of each update and that the URL is not needed after the download, the URL entry can be removed from the database.
2017-07-07Replace error message with debug messageGabriele M
Trying to add an already added download is not error and it's actually a way to mark an update as available online.
2017-07-07Remove no longer available updates when refreshing the listGabriele M
2017-07-07Send an event when update are canceledGabriele M
This allows to properly update the status of the application. In particular, when an update is deleted: - Cancel the associated notification, if any. - Remove the entry from the controller if the update is no longer available online. - Disable the resume button if download is partially downloaded and is no longer available online.
2017-07-07Track "online updates" rather than "local updates"Gabriele M
This is a preparation commit with no actual changes.
2017-07-07Use deleteUpdateAsync() even if we know the file doesn't existGabriele M
deleteUpdateAsync() is safe and it makes the code more readable at the expense of an extra File.exists() call.
2017-07-05Simplify handling of intentional download failuresGabriele M
2017-07-05Report if a failure is following a download abortGabriele M
2017-07-04Add support for A/B (Seamless) System UpdatesGabriele M
Loosely based on: https://github.com/LineageOS/android_packages_apps_CMUpdater/commit/0465cb691de5acd2f459ce0687b988ddf050b354
2017-07-04Replace DB entries on conflictGabriele M
In this way we could add previously unknown info such as the size.
2017-07-04Allow to choose the conflict algorithm when adding DB entriesGabriele M
2017-07-04Don't assume we always know the final size of the filesGabriele M
2017-07-04Keep track of the number of updates being verifiedGabriele M
2017-07-04Keep track of the number of active downloadsGabriele M
2017-07-04Verify package when resuming a completed downloadGabriele M
It's possible to resume already completed downloads. When this happens, starts verifying the package. Otherwise we won't be able to resume the download since the server will likely reply with 416.
2017-07-04Perform some database operations in separate threadsGabriele M
These operations shouldn't be frequent enough to require explicit synchronization.
2017-07-04Verify downloads in a separate threadGabriele M