Commit Graph

147 Commits

Author SHA1 Message Date
Harry Youd
c5324a5fc6 Updater: Move to new lineage build props
Change-Id: I6ff93f34602de6e79208d382f9be157c14ffbb99
2017-11-28 14:27:20 +01:00
Gabriele M
7be5b7c057 Don't stop service while installing AB updates
Change-Id: I2e5eaffa2b64ce8d387958b070a23f393f827c5e
2017-11-12 20:14:18 +01:00
Gabriele M
8c9976d622 Show delete button for old updates
Old updates can't be installed if the current build is newer, so show
a delete button instead.

Change-Id: Ib34aad31d93e87a1009c23f86686fc4a008129e7
2017-11-12 16:10:17 +01:00
Gabriele M
9dc1349c1a Implement DownloadClient using HttpURLConnection
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-11-12 16:10:17 +01:00
Abhisek Devkota
7aa3a999d8 Automatic translation import
Change-Id: I139708300601c694863783cb23cf7c2ce49150f3
2017-10-21 11:11:30 -07: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
Abhisek Devkota
a891ac9709 Automatic translation import
Change-Id: I15611e4ff76d2364d8be1c1873dc40796e17a7f1
2017-09-19 00:29:02 -07:00
Gabriele M
6f3dfda1b0 Improve the automatic updates checks
The builds for each device are released more or less at the same
time of the day, so check when the last build was released and
schedule the next check accordingly. Also, allow multiple automatic
updates check in the same day. There's no need to limit the number
of checks since they are not frequent and this can affect negatively
the effectiveness of the new algorithm. In addition to that, remove
any pending oneshot alarm in case a subsequent check succeeds and
log every new alarm.

Change-Id: I4668f2e342e51d3578992eec6d8c270065d9aa21
2017-08-31 22:36:23 +02:00
Gabriele M
5c09d5c5f1 Minor code refactoring
Use a separate function to process the new json to increase the
readability of the code.

Change-Id: If508563fd9ccb2a6b0edb40a3cfe2a0081cb97f4
2017-08-31 17:29: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
Gabriele M
17f35382d7 Show alert dialog for major upgrades
Major upgrades are not possible with Updater and they are already
blocked. This commit adds a dialog with a link to a webpage that
explains how to upgrade manually.

Based on: d5d343d627

Change-Id: Ifb23e0a4db1060fc696d13e6694f3e849af70e2d
2017-08-25 18:13:46 +00:00
Gabriele M
88b6fd84bb Show the actual version of the update
We were showing the version of the currently installed build for
all the updates.

Change-Id: I76150ff248d6c6a106571c2ba4d26ae57847aed3
2017-08-25 20:05:56 +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
87202371de Don't change status when cancelled downloads fail
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-08-18 14:31:54 +02:00
Luca Stefani
4c5dd9c391 Disable clip to padding
* Allow the last item shadow to be seen

Change-Id: If24b0db3feb75a4468b6dddde62b4c79917552c8
2017-08-14 22:47:03 +02:00
Luca Stefani
a0cd205b1d Don't add margins in update items
Change-Id: I71a22a4bd0a15e70a045cef1c49f67ff5625dbd6
2017-08-14 22:47:02 +02:00
Luca Stefani
8217a4aac6 Exclude updater from recents
Change-Id: Iae2737aa5890aa00da79c5b04dd253273aa9fabc
2017-08-14 22:47:01 +02:00
Gabriele M
7c25e7aef9 Show message if there are no updates 2017-08-09 17:18:15 +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
ea3ac38e25 Dismiss some notifications when clicked 2017-08-08 10:32:48 +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
cdc4849767 Remove duplicate icon
ic_tab_install is basically the same as ic_system_update. The only
difference is the color, but that doesn't really matter.
2017-08-07 16:43:34 +02:00
Gabriele M
415e62df5d Add permission to show system alert dialogs
While at it, sort the permissions and fix their coding style.
2017-07-26 11:57:33 +02:00
Gabriele M
13f3849b96 Actually check if an OTA is encrypted 2017-07-26 11:57:32 +02:00
Gabriele M
d854c6377b Restore the status of the checkboxes when creating the menu 2017-07-22 20:39:52 +02:00
Gabriele M
758521bb53 Allow to delete updates currently in download 2017-07-22 20:38:20 +02:00
Gabriele M
8768daddf0 Add option to delete updates when installed
This is mostly useful on encrypted devices since it allows to not
copy the update before installing it.
2017-07-22 20:38:20 +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
09968f1b25 Rename cancelDownload() to deleteUpdate()
The method can be used to delete any update, incomplete or not.
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
ec269b6fb1 Allow to resume updates fully downloaded
Resuming an update fully downloaded will simply trigger an update
verification. This is useful for imported downloads since it allows
exporting them.
2017-07-20 00:45:34 +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
257ab087d6 Enable action mode on card long press
This will allow to perform different operations, although currently
it's only used to delete updates.
2017-07-20 00:45:34 +02:00
Gabriele M
ebe0bb2e42 Use a method to determine if the list is "busy"
Consider also installing updates, needed for A/B updates.
2017-07-19 21:11:46 +02:00
Gabriele M
554c294a39 Define abstract class for the activity containing the updates list
While at it, rename showSnackBar() to showSnackbar() since normally
the 'B' is lowercase.
2017-07-19 21:11:46 +02:00
Gabriele M
2b276395e1 Use /data/lineageos_updates/ as download path
GmsCore deletes the files in /data/ota_package/, so don't use it.
2017-07-19 18:50:16 +02:00
Gabriele M
821efd8219 Rename UpdaterControllerInt to Controller 2017-07-18 22:26:51 +02:00
Gabriele M
009f41cc90 Remove unneeded throws declaration 2017-07-18 22:17:29 +02:00
Gabriele M
341eec0b28 Fix a couple of typos 2017-07-18 22:17:29 +02:00
Gabriele M
82dbc8fde3 Remove a couple of extra semicolons 2017-07-18 22:17:29 +02:00
Gabriele M
6f1861abe0 Remove unused resources 2017-07-18 22:17:29 +02:00
Gabriele M
96b1145b29 Add missing android namespace declaration 2017-07-18 22:17:29 +02:00
Gabriele M
a06fa3f9f0 Add own formatDuration() method
DateUtils.formatDuration() is not public, so create our own version.
2017-07-18 22:17:26 +02:00
Gabriele M
af1e9c4478 Create model package 2017-07-18 22:15:13 +02:00
Gabriele M
6abafa60a8 Always show downloaded data in megabytes
We omit the unit for the downloaded data and assume it's MB, so
we must always show megabytes.
2017-07-18 13:37:44 +02:00
Gabriele M
8ce10da9ce Use UTC timezone for the build dates 2017-07-18 12:52:08 +02:00
Gabriele M
fecd837b70 Fix fling gestures when expanding the AppBar from RecyclerView
Fling gestures don't work when expanding the AppBar. Define a new
behavior class to fix them

https://issuetracker.google.com/issues/37058076
https://stackoverflow.com/a/32454407
2017-07-18 12:51:42 +02:00