Age | Commit message (Collapse) | Author |
|
* Make final where possible
* Remove unused casts, imports, methods, enums and constructors
* Add null checks
Change-Id: Idd1a16426dd1928e2ed9922f5a35ba32ce4f808b
|
|
Change-Id: I7bd67915638db5330b854f66f9fc1adb864b64be
|
|
Change-Id: I380a39bf6008b341c8005ac548d42d2413d0d643
|
|
This is just useless as is.
Change-Id: I957ea3bda4097ccb8d730943639cd5e74b1b2440
|
|
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
|
|
Change-Id: I3e59f0c38e4047595374a951619c9b43a46901df
|
|
This should allow update_engine to access the file without
granting the dac_override capability.
Change-Id: I5d0c8792fd47e5571dbaf802b2725f99ee2dc150
|
|
Support duplicate links [1] to handle better temporarily unavailable
mirrors.
[1] https://tools.ietf.org/html/rfc6249
Change-Id: If78fb4a90da68ef221294eed2c59063a14cf1f43
|
|
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
|
|
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
|
|
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
|
|
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
|
|
The method can be used to delete any update, incomplete or not.
|
|
|
|
This also changes the code to use the new interfaces wherever the
update is not supposed to change.
|
|
These went out of order moving some stuff around. Reorder them so
that there won't be unnecessary line changes in future.
|
|
|
|
|
|
|
|
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").
|
|
In this way if the download fails immediately, it will fail after the
notification.
|
|
|
|
|
|
This is useful in case the download is stopped before it could start.
|
|
|
|
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.
|
|
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.
|
|
|
|
Or we might notify the listeners too early.
|
|
Create copies of the objects not to allow other classes change them,
excluding those of controller package.
|
|
Add a method to the controller that allows to set a list of
downloads as not available online.
|
|
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.
|
|
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.
|
|
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.
|
|
Trying to add an already added download is not error and it's
actually a way to mark an update as available online.
|
|
|
|
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.
|
|
This is a preparation commit with no actual changes.
|
|
deleteUpdateAsync() is safe and it makes the code more readable at
the expense of an extra File.exists() call.
|
|
|
|
|
|
Loosely based on:
https://github.com/LineageOS/android_packages_apps_CMUpdater/commit/0465cb691de5acd2f459ce0687b988ddf050b354
|
|
In this way we could add previously unknown info such as the size.
|
|
|
|
|
|
|
|
|
|
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.
|
|
These operations shouldn't be frequent enough to require explicit
synchronization.
|
|
|