Commit Graph

212 Commits

Author SHA1 Message Date
Michael Bestas
68638afc52 Automatic translation import
Change-Id: I90a24d5ff9b1f57a9c0f9283279afd71b9c71ed7
2018-10-14 13:54:31 +03:00
Gabriele M
27968c4490 Don't use one shot PendingIntents for the notification actions
FLAG_ONE_SHOT doesn't make so much sense here, the intents are generic
and can be repeated.

Change-Id: Ib457d975387dfd838372639e2aaa40a3df6f4d15
2018-07-14 18:46:01 +02:00
Luca Stefani
4ccf010e2e Updater: Improve battery check
* Lower default value by 10%
* Decrease the level by another 10% if charging
* Always allow installation in case device doesn't have a battery
* Show the requirements in the alert dialog

Change-Id: Iebb10220612006fbd096eb474cf3034ef52144b3
2018-07-14 18:46:01 +02:00
Gabriele M
6b44a7702c Don't treat the current build as compatible
Even if technically it is compatible.

Change-Id: I72d39c761ad02b851c5ec7cfae664e886931f852
2018-07-14 18:35:28 +02:00
LuK1337
eaf1fa8f31 Updater: Add property that allows us to downgrade
Change-Id: I6916639f05c52ae198f0d1656deb23ee5186907f
2018-07-14 18:13:25 +02:00
LuK1337
26a4c7a145 Updater: Move battery level check to UpdatesListAdapter
* We cannot create dialog from service level without
  hardcoding theme resource and granting SYSTEM_ALERT_WINDOW
  permission therefore we got to move it here.

Change-Id: I70ee5d6c8ef4af4f5c6f29e593b1c20797781017
2018-06-15 21:28:06 +02:00
Gabriele M
219c6d38f8 Requre a minimum remaining battery capacity to install updates
The recovery doesn't install the update if the remaining battery
capacity isn't at least 20% (or 15% if charging). Require at least
40%, just to be safe.

Change-Id: I5cd7c40f029141cde2b0922b25fece2b55989710
2018-06-13 23:33:13 +02:00
Gabriele M
b9c9037c34 Minor app notification improvements
- Don't use BigTextStyle if we only need to show a single line of
  text, but keep using it if the progressbar is visible.
- Change the icon to reflect the currrent state.
- Use android.R.drawable instead of com.android.internal.R.drawable

Change-Id: I0f69fe5f4fa63cdec180e89afa098d27819f33fd
2018-06-13 23:33:13 +02:00
Gabriele M
acab307e82 Show in app reboot button
Change-Id: I8d65746b58c16a7cf4a430ea29bb7b0fba1802d5
2018-06-13 23:33:13 +02:00
Gabriele M
d3bfa1d264 Turn UpdateInstaller into a singleton
For symmetry with ABUpdateInstaller.

Change-Id: I9b61ed286c91f10140705e7b3e24b0eab0c75f49
2018-06-13 23:33:13 +02:00
Gabriele M
f3fac9acf1 Remove Controller interface
This is just useless as is.

Change-Id: I957ea3bda4097ccb8d730943639cd5e74b1b2440
2018-06-13 23:33:13 +02:00
Gabriele M
3be47241ff 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:33:13 +02:00
Michael W
852d7761b1 Automatic translation import
Change-Id: Ia2630b06d550680275d516b84266ba9a432af691
2018-06-10 16:05:35 +02:00
Gabriele M
8fc772108a Prevent null pointer exceptions
The main activity connects to the service after setting up the local
broadcast. This allows the service to send notification before the
activity is ready, causing null pointer exceptions. This happens for
example rotating the screen while an update is being installed.

Also, replace the existing check on mUpdaterController with a check
on mDownloadsId since the latter depends on the former and both are
required.

Change-Id: I620fd7aa1e90468ab40dfedaa06c23f96f3e6807
2018-05-16 22:46:13 +02:00
Gabriele M
d8c781a105 Use Content-Length if greater than current size
The server may temporarily report an incorrect size that is smaller
than the actual size. Content-Length is expected to always be
accurate, but its value does not correspond to the full file size
when resuming downloads. Use Content-Length only if it's bigger
than the currently known size.

Change-Id: I2cc06bfbd2349f21528047b4840f549fbe84964e
2018-05-16 22:46:13 +02:00
Michael Bestas
ab0ec47173 Automatic translation import
Change-Id: Ie8a42d7a52c11030586ccf03a6595c3bb50bfa78
2018-05-06 02:27:04 +03:00
Michael Bestas
cef327d63c Fix eta_hours quantity="one" string
* Fixes fd096a564a

Change-Id: I19633ead80b690e1c22655bcac842a901e450f8a
2018-05-05 17:17:20 +02:00
Gabriele M
f30ab67c85 Allow to properly translate the download ETA string
Change-Id: Ie6bbbddbbd9fd7adbc16472ad9c42c1d257413a1
2018-04-22 14:29:12 +02:00
Gabriele M
a4b3f87403 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:22 +02:00
Gabriele M
d450bca3ce Use a determinate progressbar while installing A/B updates
This needs to be done explicitly after the recent UI changes.

Change-Id: Ie333a51d7c679c17998872071b2bd84c1f47ca48
2018-04-20 21:25:33 +02:00
Michael Bestas
2602faf417 Automatic translation import
Change-Id: I577833a1a990f2bfb120e9887de0a431a74f5b84
2018-04-19 22:45:41 +03:00
Gabriele M
8c183c262d Replace some paddings with margings in the preferences
This ensures that each Switch is always fully visible independently
of the size of system font.

Change-Id: I1e56a9537dbbb124d86ea0da76d48b7b53172e47
2018-04-12 00:17:56 +02:00
Gabriele M
03424aec69 Add a script to push updates
Useful to test OTA updates without setting up a server.

Change-Id: Ic4c2dc1ea9ce6bd6ec6750d1c4250079a5be7580
2018-04-11 00:30:56 +02:00
Gabriele M
1585898961 gen-keystore.sh: Don't pass the passwords as args
Also mention that the password is saved in clear text.

Change-Id: Ia7bf8b1b85193aa76b541dc5c6ee99a471d12f92
2018-04-11 00:30:44 +02:00
Gabriele M
99e05e3b0c Detect update failures
This allows to delete the update only if the installation succeeded
and to notify the user in case the installation failed.

Since we now need the file in case of failure, create a copy for
uncrypt even if the user chose to delete installed updates.

Change-Id: I80b0f499663bbf50bcbca5f643c01ffdb4cd3957
2018-04-08 20:52:29 +02:00
Joey
5ad6e8c857 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:25:53 +02:00
Gabriele M
d0819dc7dd Always show the size of the updates
This is now possible since the size is included in the JSON.

Change-Id: Ie38ccfbdc7abb0e4b86e8e625ed8d131376402e7
2018-04-08 15:54:21 +02:00
Joey
3dfe55113f Updater: Minor UI improvements
Change-Id: I5028aaa154991806ab911be0119fed0836e6851b
2018-04-08 15:54:21 +02:00
Joey
d108dc6229 Updater: Use popup menu instead of ActionMode
Change-Id: I707682708711679a7cbe1b0058cea9b1ed003cb6
2018-04-08 15:54:20 +02:00
Gabriele M
5606f95c87 Simplify code syntax using Java 8 features
Change-Id: I3e59f0c38e4047595374a951619c9b43a46901df
2018-04-08 10:26:20 +02:00
Gabriele M
e6e14dd7e2 Get file size from JSON
The server now reports the size of the file, so use it and
require it.

Change-Id: I2248347431b65ae54dd7295872d70aba456ed8d8
2018-04-08 10:25:47 +02:00
Gabriele M
dbcccbbff0 Print stack trace if the JSON could not be parsed
This helps to identify errors in the response.

Change-Id: Icda0919378ebf1deba3a4c7d6d6d010a09eed3ce
2018-04-08 10:25:46 +02:00
Roman Birg
288bce9ccd Updater: fix wrong preference key in A/B installer
We are referencing the wrong key for deciding whether to delete the
update on reboot.

Change-Id: If83d278259291b61c26302bdd59c2774901b18ca
Signed-off-by: Roman Birg <romanbirg@gmail.com>
2018-04-05 16:49:56 +02:00
Gabriele M
da8267fc28 Add README to document the communication with the server
While at it, move README-STUDIO.txt into the newly created file.

Change-Id: I3e853a32d57f2d2bea3c41f7e8ec6fb22859e5f5
2018-04-05 16:46:26 +02:00
Gabriele M
e930cf7f67 Define the entire server URL as resource
Currently the URL is only partially customizable, part of
it is hard-coded and there's no clear indication of it.
Define the entire URL as resource string and use placeholders
for runtime variables.

Also, invalidate old overrides by changing the name of the
resource.

Warning: cm.updater.uri must be updated accordingly

Change-Id: Iecfdaf9d422d08a707c7319bafea5befc6b757d2
2018-04-05 16:46:14 +02:00
Gabriele M
28be10bd64 Replace refresh dialog with icon animation
Change-Id: I6d2cc649b9fa8883a7256d8ecb62cb56bbf5dd59
2018-04-05 16:44:51 +02:00
Gabriele M
efa1a14b19 Handle install errors from onPayloadApplicationComplete()
When the installation terminates because of an error, update_engine
sets the status to IDLE and sends a notification. Thus, we might
miss the error report and never update the status of the update.

Change-Id: Ic1536b1c157c4dab0128f039f9512f2fb734287d
2018-04-05 16:44:51 +02:00
Gabriele M
9a5fe30317 Make updates world readable
This should allow update_engine to access the file without
granting the dac_override capability.

Change-Id: I5d0c8792fd47e5571dbaf802b2725f99ee2dc150
2018-04-05 16:44:51 +02:00
Gabriele M
4b6cfe820e Use single return statement in onStartCommand()
This should prevent future changes from accidentally turning a
sticky service into a not sticky one.

Change-Id: I89f172626a98635149441a63536e0aa5a27f8280
2018-04-05 16:44:51 +02:00
Gabriele M
91acb2a7fd Prevent NPE on A/B devices
The NPE shouldn't happen as we get a null intent only when the
service is sticky (i.e., isInstallingUpdate() is true), so this
is currently not a problem.

Change-Id: I8647498d9a1022f5c7207a2da3e42cf57d9ee030
2018-04-05 16:44:51 +02:00
Gabriele M
c34c266513 Clear NEEDS_REBOOT preference on reboot
UpdateEngine doesn't send an initial notification to bound client
if the last status is not known, so clear the preference when we
detect that the device has been rebooted.

Change-Id: Ib15dff5fa8ac9ec07a68018a83683cc561fd3e85
2018-04-05 16:44:51 +02:00
Gabriele M
fa5f24ac3f Set status to INSTALLING when reconnecting to the service
Otherwise the service won't run in foreground after restarting
the app while an update is being installed.

Change-Id: I8a75d206ead2945e7326c144b0b4354fbb2accb4
2018-04-05 16:44:51 +02:00
Gabriele M
dd712cfdbe Don't register multiple UpdateEngine callbacks
We are loosely tied to UpdateEngine and have no way to know whether
we are bound or not without keeping track of the connection manually.
Since UpdaterService is for both A/B and legacy updates, turn
ABUpdateInstaller into a singleton to keep the code simple while
ensuring that a single callback is registered.

Change-Id: Ib4e9ad1413ba96bf5ed59cc3383741b5c9bac427
2018-04-05 16:44:51 +02:00
Gabriele M
c92f44b66e Remove duplicate INSTALLING notification
Change-Id: Ia1515aef1a24a5d54143e1423ae96f09163625bc
2018-04-05 16:44:51 +02:00
Michael Bestas
3002ccccba Automatic translation import
Change-Id: I0112a7802397907df4c937e9b5657ecfe925808b
2018-03-28 01:49:04 +03:00
Michael W
33a8169c45 Automatic translation import
Change-Id: I74de7535820ed77d0e6bd237841eaf2d8e67343a
2018-02-21 22:36:41 +00:00
meganukebmp
1db6636425 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:44:24 +00:00
Michael Bestas
e71140189d Automatic translation import
Change-Id: If6b92fad59faa51810201dfb980dbac8e80deaf0
2018-02-04 04:51:21 +02:00
Gabriele M
9e3168e987 Add support for duplicate links
Support duplicate links [1] to handle better temporarily unavailable
mirrors.

[1] https://tools.ietf.org/html/rfc6249

Change-Id: If78fb4a90da68ef221294eed2c59063a14cf1f43
2018-01-23 22:36:45 +01:00
Gabriele M
cabab63dd2 Updater: Android Studio support
See README-STUDIO.txt for more info.

Change-Id: Ie673bba5618b0f00a585049cd85687a64db2b420
2018-01-18 20:32:06 +01:00