The main activity connects to the service after setting up the local
broadcast. This allows the service to send notification before the
activity is ready, causing null pointer exceptions. This happens for
example rotating the screen while an update is being installed.
Also, replace the existing check on mUpdaterController with a check
on mDownloadsId since the latter depends on the former and both are
required.
Change-Id: I620fd7aa1e90468ab40dfedaa06c23f96f3e6807
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
Multiple update list downloads can happen simultaneously. Use
unique file names for the temporary jsons to avoid conflicts.
Change-Id: I751c9838394e1f5aebbe359f61532947b429f39b
This allows to delete the update only if the installation succeeded
and to notify the user in case the installation failed.
Since we now need the file in case of failure, create a copy for
uncrypt even if the user chose to delete installed updates.
Change-Id: I80b0f499663bbf50bcbca5f643c01ffdb4cd3957
Menu is not a good place to store preferences that have long strings
Change-Id: I84e782af33b2452c15998f7266c57d681dc8a377
Signed-off-by: Joey <joey@lineageos.org>
Currently the URL is only partially customizable, part of
it is hard-coded and there's no clear indication of it.
Define the entire URL as resource string and use placeholders
for runtime variables.
Also, invalidate old overrides by changing the name of the
resource.
Warning: lineage.updater.uri must be updated accordingly
Change-Id: Iecfdaf9d422d08a707c7319bafea5befc6b757d2
When the installation terminates because of an error, update_engine
sets the status to IDLE and sends a notification. Thus, we might
miss the error report and never update the status of the update.
Change-Id: Ic1536b1c157c4dab0128f039f9512f2fb734287d
This should prevent future changes from accidentally turning a
sticky service into a not sticky one.
Change-Id: I89f172626a98635149441a63536e0aa5a27f8280
The NPE shouldn't happen as we get a null intent only when the
service is sticky (i.e., isInstallingUpdate() is true), so this
is currently not a problem.
Change-Id: I8647498d9a1022f5c7207a2da3e42cf57d9ee030
UpdateEngine doesn't send an initial notification to bound client
if the last status is not known, so clear the preference when we
detect that the device has been rebooted.
Change-Id: Ib15dff5fa8ac9ec07a68018a83683cc561fd3e85
Otherwise the service won't run in foreground after restarting
the app while an update is being installed.
Change-Id: I8a75d206ead2945e7326c144b0b4354fbb2accb4
We are loosely tied to UpdateEngine and have no way to know whether
we are bound or not without keeping track of the connection manually.
Since UpdaterService is for both A/B and legacy updates, turn
ABUpdateInstaller into a singleton to keep the code simple while
ensuring that a single callback is registered.
Change-Id: Ib4e9ad1413ba96bf5ed59cc3383741b5c9bac427
We are referencing the wrong key for deciding whether to delete the
update on reboot.
Change-Id: If83d278259291b61c26302bdd59c2774901b18ca
Signed-off-by: Roman Birg <romanbirg@gmail.com>
In this way apks built with gradle/Android Studio will have the
same versionCode, allowing to update the one in /system.
Change-Id: I020cc623dd7c1c5085fec4e6f5978b6ee46468a2
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