Commit Graph

18 Commits

Author SHA1 Message Date
Michael Bestas
e0bcaec5b6 Updater: Add FLAG_IMMUTABLE flag to PendingIntent
Fixes:
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE
or FLAG_MUTABLE be specified when creating a PendingIntent.

Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some
functionality depends on the PendingIntent being mutable,
e.g. if it needs to be used with inline replies or bubbles.

Change-Id: I63b25512d3bf6e0d3b0cc95d91295f4065175848
2022-02-10 15:45:17 +01:00
Michael W
46c06ad958 Updater: The great cleanup
* Make final where possible
* Remove unused casts, imports, methods, enums and constructors
* Add null checks

Change-Id: Idd1a16426dd1928e2ed9922f5a35ba32ce4f808b
2022-02-10 15:44:46 +01:00
Luca Stefani
91f33aa03e Updater: Move to AndroidX
Change-Id: I7bd67915638db5330b854f66f9fc1adb864b64be
2019-09-07 19:11:27 +02:00
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
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
Harry Youd
ff53035537 Updater: Add notification channels
Change-Id: I2f538fb47fe90e1008bf286739d33c829123353a
2018-01-23 23:47:18 +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
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
ea3ac38e25 Dismiss some notifications when clicked 2017-08-08 10:32:48 +02:00
Gabriele M
75befd1738 Always cleanup the download directory
This shouldn't really be necessary since the cleanup is needed after
the application data has been wiped, which by default has the
automatic updates check enabled.
2017-07-17 00:33:19 +02:00
Gabriele M
fd856dce70 Allow to disable the automatic updates check 2017-07-16 22:52:45 +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
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
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
3e36596127 Create Constants class 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
4196ccb301 Don't use wakup alarms to check for updates
There's no need to wake the device just to check for new updates.
2017-07-03 16:08:30 +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