Commit Graph

137 Commits

Author SHA1 Message Date
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
Gabriele M
e710060baa Show a snackbar when trying to download/install invalid updates
Instead of disabling the action button, keep it enabled and make it
show a snackbar to inform the user about the impossibility of
installing the selected update.
2017-07-18 00:19:41 +02:00
Gabriele M
fe21c2cd49 Treat download resume and verification in the same way
Allowing to verify downloads, but not install them makes no sense
currently, so don't treat the two cases differently.
2017-07-18 00:19:33 +02:00
Gabriele M
4674d68eb3 Choose layout depending on the update persistent status
Using the persistent status is simpler and less error prone. This
fixes the view of verified downloads, which aren't shown as such.
2017-07-17 19:34:32 +02:00
Gabriele M
c6a60d78f5 Use a localized string as default content description 2017-07-17 14:48:59 +02:00
Gabriele M
d3436c37e9 Use Compat theme for the AppBar title 2017-07-17 13:17:48 +02:00
Gabriele M
61f9bb8f30 Get the height of the ToolBar from the current theme 2017-07-17 12:51:40 +02:00
Gabriele M
d0f9c4be22 Don't use the filename as notification title
Be consistent with the rest of the app and use "version - date".
2017-07-17 12:27:15 +02:00
Gabriele M
c1f0aab382 Show snackbar for some download status changes 2017-07-17 12:27:15 +02:00
Gabriele M
b337452eeb Show download button if a download fails immediately
If the download fails without downloading any data, treat it as a
new file.
2017-07-17 12:27:15 +02:00
Gabriele M
f496f0d0e7 Don't set status of download to unknown when download fail
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 7369e9cea9
("Set the status of paused downloads to unknown if no file exists").
2017-07-17 12:27:15 +02:00