Commit Graph

45 Commits

Author SHA1 Message Date
LuK1337
2454a339a3 Updater: Implement auto update check interval preference
* This replaces auto update check switch with a dropdown with 4 options:
  * Never
  * Once a day
  * Once a week (default)
  * Once a month

Change-Id: I4bcae4c013a5d44958f9c54d641e64aac3062a8b
2019-02-10 10:45:35 +01:00
TheScarastic
608789ff36 Updater: Allow toggling A/B perf mode
Change-Id: I380a39bf6008b341c8005ac548d42d2413d0d643
2018-07-11 22:27:33 +02:00
Gabriele M
4bacd24da4 Remove Controller interface
This is just useless as is.

Change-Id: I957ea3bda4097ccb8d730943639cd5e74b1b2440
2018-06-13 23:30:08 +02:00
Gabriele M
78e69c05d8 Remove LegacySupport class
This was meant to provide an upgrade path from the old app. It's
been almost a year now, this class is no longer needed.

Change-Id: I17c82e5877b275c5ceb3caefa28066abc170f095
2018-06-13 23:30:08 +02:00
Gabriele M
cc1ad0e827 Append random ID to temporary json file names
Multiple update list downloads can happen simultaneously. Use
unique file names for the temporary jsons to avoid conflicts.

Change-Id: I751c9838394e1f5aebbe359f61532947b429f39b
2018-04-20 21:26:30 +02:00
Joey
af9b4adbe0 Updater: show settings in a proper preferences dialog
Menu is not a good place to store preferences that have long strings

Change-Id: I84e782af33b2452c15998f7266c57d681dc8a377
Signed-off-by: Joey <joey@lineageos.org>
2018-04-08 18:21:57 +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
4fa7ba910a Replace refresh dialog with icon animation
Change-Id: I6d2cc649b9fa8883a7256d8ecb62cb56bbf5dd59
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
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
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
7c25e7aef9 Show message if there are no updates 2017-08-09 17:18:15 +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
d854c6377b Restore the status of the checkboxes when creating the menu 2017-07-22 20:39:52 +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
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
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
821efd8219 Rename UpdaterControllerInt to Controller 2017-07-18 22:26:51 +02:00
Gabriele M
af1e9c4478 Create model package 2017-07-18 22:15:13 +02:00
Gabriele M
8ce10da9ce Use UTC timezone for the build dates 2017-07-18 12:52:08 +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
c1f0aab382 Show snackbar for some download status changes 2017-07-17 12:27:15 +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
e51be80f6a Initial UI work
Look and feel based on CMUpdater.
2017-07-16 22:52:45 +02:00
Gabriele M
fd856dce70 Allow to disable the automatic updates check 2017-07-16 22:52:45 +02:00
Gabriele M
66ca7a79df Sort the updates, not their IDs
Also, use a comparator to sort the updates and stop using the
Comparable interface. There are different ways to sort updates,
so don't define one.
2017-07-10 01:32:19 +02:00
Gabriele M
e34334a1d7 Pass the destination File to the callback
The current argument is unused and it should have been removed
with commit 81229329f1
("Generate download clients using a builder class"). Instead of
removing it completely, use it to pass the File of the download.
2017-07-10 01:31:35 +02:00
Gabriele M
a2919a8947 Don't modify the objects of the controller directly
Add a method to the controller that allows to set a list of
downloads as not available online.
2017-07-08 22:10:58 +02:00
Gabriele M
81229329f1 Generate download clients using a builder class
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.
2017-07-08 17:43:56 +02:00
Gabriele M
26f149bef1 Import updates downloaded with CMUpdater 2017-07-08 14:05:19 +02:00
Gabriele M
c90700d3d2 Remove no longer available updates when refreshing the list 2017-07-07 22:05:23 +02:00
Gabriele M
d327d61cc6 Send an event when update are canceled
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.
2017-07-07 22:05:22 +02:00
Gabriele M
47f48cff3f Fix first updates list load 2017-07-06 22:07:36 +02:00
Gabriele M
718c877687 Provide some feedback when refreshing the list
Add a progress dialog to inform the user about the ongoing operation
and show a snackbar with the result of the operation.
2017-07-05 23:35:14 +02:00
Gabriele M
7819587a22 Add a toolbar menu with back and refresh buttons
Change theme just to make the refresh button visible without
changing its color.
2017-07-05 23:35:14 +02:00
Gabriele M
eaba161d43 Replace current json only if new one is valid 2017-07-05 23:35:14 +02:00
Gabriele M
1795bd8b11 Report if a failure is following a download abort 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
520105284c Rename some constants 2017-07-04 19:05:04 +02:00
Gabriele M
db3f14832a Replace 'Download' prefix with 'Updater'
These classes do more than controlling the download of the updates.
2017-07-04 19:05:04 +02:00
Gabriele M
9b3deda9fa Protect DownloadController instantiation
Enforce the use of DownloadService to create new DownloadController
instaces, but give access to the existing instances to anyone.
2017-07-03 17:41:33 +02:00
Gabriele M
bda4d2b9b4 Load the updates stored in the database from DownloadController
Also, hide the distinction between local and non-local updates.
Local updates should be handled only by DownloadController.
2017-07-03 16:08:31 +02:00
Gabriele M
e7511d0041 Project init 2017-07-02 18:13:34 +02:00