Commit Graph

34 Commits

Author SHA1 Message Date
Gabriele M
d5f4c1bcec Detect update failures
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
2018-04-08 22:48:19 +02:00
Gabriele M
a64eae5fc0 Simplify code syntax using Java 8 features
Change-Id: I3e59f0c38e4047595374a951619c9b43a46901df
2018-04-08 14:25:56 +02:00
Gabriele M
a72b78c31e Get file size from JSON
The server now reports the size of the file, so use it and
require it.

Change-Id: I2248347431b65ae54dd7295872d70aba456ed8d8
2018-04-08 14:25:53 +02:00
Gabriele M
6fd45962c1 Print stack trace if the JSON could not be parsed
This helps to identify errors in the response.

Change-Id: Icda0919378ebf1deba3a4c7d6d6d010a09eed3ce
2018-04-08 14:25:45 +02:00
Gabriele M
5252d60671 Define the entire server URL as resource
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
2018-04-05 16:37:49 +02:00
meganukebmp
76b9f49684 Updater: add changelog button
Add a changelog button in the menu toolbar throwing the user in
the recent changes page

Change-Id: I16609825c0662fc22b95189cbdf324a8c0b94f81
2018-02-17 17:46:45 +00:00
Paul Keith
c05521baba Updater: Allow specifying a new device name
* To allow transitions from e.g. variant->unified build
* Example process, using klteusc->klte as the example:
 - Set ro.updater.next_device to klte in klteusc's tree
 - Wait for build to roll out with ro.updater.next_device
 - Pull klteusc from build roster

Change-Id: I3c70d54de3f9e036cd8700edc4ee0b11093740d2
2017-10-12 20:12:49 +02:00
Gabriele M
c50871c0dc Allow to keep incompatible updates when parsing jsons
The condition was wrong and incompatible updates were always
discarded regardless of the flag passed.

Change-Id: Iefc2d64b841921eb77a9f73cf374b63b477d2588
2017-08-31 17:29:48 +02:00
Mustafa Karatas
2327e83c51 Fix No updates found for users with Turkish Locale
There is a problem with Java's toLowerCase() method which returns
"LATIN SMALL LETTER DOTLESS I" for "I" character. This breaks update check
because Utils.getInstalledBuildType() returns "nıghtly (notice dottles small
i)" instead of "nightly".

This change forces toLowerCase() to use ROOT locale which is recommended in
javadocs

There is a note for Turkish locale on javadocs:
http://devdocs.io/openjdk~8/java/lang/string#toLowerCase--

Change-Id: Ifada815202588d67643136846de08f94cefb46a5
Signed-off-by: Mustafa Karatas <mstfkaratas@gmail.com>
2017-08-20 14:21:38 +02:00
Gabriele M
ca5b75ebd1 Don't use lower case device names when requesting the updates list
URLs are case sensitive, the server expects the same exact value
stored in the system property, so don't change it.
2017-08-08 19:08:37 +02:00
Gabriele M
acd7387d23 Warn user about downloading update package via mobile data
Based on: 8928492535
2017-08-08 10:32:48 +02:00
Gabriele M
13f3849b96 Actually check if an OTA is encrypted 2017-07-26 11:57:32 +02:00
Gabriele M
20ea513684 Create a copy of the zips on encrypted devices
On encrypted devices, uncrypt modifies the zip so that it can be
read without mounting the filesystem. Instead of installing the zip
downloaded, create a copy of it which will be deleted. This will
allow to re-install the zip multiple times or export it after
installing it.
2017-07-21 17:05:53 +02:00
Gabriele M
1e2f353b55 Rename UpdateDownload and Update classes 2017-07-21 17:04:12 +02:00
Gabriele M
28b8774db6 Define interfaces with only getters for the updates
This also changes the code to use the new interfaces wherever the
update is not supposed to change.
2017-07-21 16:52:24 +02:00
Gabriele M
11f82cfb87 Reorder includes directives
These went out of order moving some stuff around. Reorder them so
that there won't be unnecessary line changes in future.
2017-07-21 01:17:19 +02:00
Gabriele M
1659fe26b9 Allow to export verified updates 2017-07-20 00:45:34 +02:00
Gabriele M
ee6013dfd1 Allow to copy the URL of the updates 2017-07-20 00:45:34 +02:00
Gabriele M
009f41cc90 Remove unneeded throws declaration 2017-07-18 22:17:29 +02:00
Gabriele M
af1e9c4478 Create model package 2017-07-18 22:15:13 +02:00
Gabriele M
1f0aa4e79b Collapse header if the device has no touchscreen
The header can't be collpased without a touchscreen, so collapse
it if we detect that the current device has no touchscreen.
2017-07-17 12:26:18 +02:00
Gabriele M
12688ba761 Allow to check if an update is of type AB from anywhere 2017-07-16 22:52:45 +02:00
Gabriele M
a455c95e0c Install updates from UpdaterService
This allows to easily handle AB updates.
2017-07-16 22:52:45 +02:00
Gabriele M
c7f4c48a67 Allow to re-install the current update 2017-07-15 02:10:32 +02:00
Gabriele M
79b44602e0 Allow to have different updates using the same filename 2017-07-08 22:18:15 +02:00
Gabriele M
c0bf32c097 Don't allow to install older builds
In some cases, installing an update older than the one currently
installed requires a data wipe, so don't allow it. However, allow
to verify old updates if not verified yet (e.g. when imported).
2017-07-08 22:11:00 +02:00
Gabriele M
efa829358d Remove unknwon files that are in the downloads dir
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-08 14:07:05 +02:00
Gabriele M
e6a061c090 Use a single config to define the download path
There's no point in using a bool, just define the path.
2017-07-07 22:05:23 +02:00
Gabriele M
3e36596127 Create Constants class 2017-07-05 23:35:14 +02:00
Gabriele M
e245631b46 Add support for A/B (Seamless) System Updates
Loosely based on:
0465cb691d
2017-07-04 19:36:32 +02:00
Gabriele M
f26cb61aa0 Check for new updates every day
Compare the previously downloaded updates list with the current one
and check if the old list includes all the updates of the new list.
If the network is not available at the time of the check, a new
check is scheduled.
2017-07-03 01:18:19 +02:00
Gabriele M
c30940649c Treat major upgrades as a special case
Major upgrades are compatible, but shouldn't be allowed since they
require some manual extra steps.
2017-07-02 22:26:43 +02:00
Gabriele M
1e20caffc4 Throw an exception when trying to install unverified downloads
Don't silently ignore the request. This will allow to display some
useful message to the user.
2017-07-02 22:26:43 +02:00
Gabriele M
e7511d0041 Project init 2017-07-02 18:13:34 +02:00