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
* Make final where possible
* Remove unused casts, imports, methods, enums and constructors
* Add null checks
Change-Id: Idd1a16426dd1928e2ed9922f5a35ba32ce4f808b
* 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
Multiple update list downloads can happen simultaneously. Use
unique file names for the temporary jsons to avoid conflicts.
Change-Id: I751c9838394e1f5aebbe359f61532947b429f39b
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
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
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.
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.
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.
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.
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.