Commit Graph

205 Commits

Author SHA1 Message Date
Gabriele M
8b300f0d05 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:10 +02:00
Gabriele M
4f7db45fa6 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:10 +02:00
Michael Bestas
907486ad4f Automatic translation import
Change-Id: I7197b0358cd9e9e94260cee425390fa7deb6fe2d
2018-05-08 19:47:25 +03:00
Michael Bestas
8a8f1d98f0 Fix eta_hours quantity="one" string
* Fixes fd096a564a

Change-Id: I19633ead80b690e1c22655bcac842a901e450f8a
2018-05-04 22:36:25 +03:00
Gabriele M
fd096a564a Allow to properly translate the download ETA string
Change-Id: Ie6bbbddbbd9fd7adbc16472ad9c42c1d257413a1
2018-04-21 16:31:28 +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
Gabriele M
dc9890f09c 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:26:07 +02:00
Michael Bestas
75c31f3274 Automatic translation import
Change-Id: I593d19fa09ae2605d05aa0a38029691d3653821b
2018-04-20 00:56:08 +03:00
Bruno Martins
569d9a2c51 Updater: Build with AAPT2
Change-Id: I45553984269bd2375311047b053e01f67349c695
2018-04-17 15:39:42 +02:00
Gabriele M
6aa0a04fbb 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:19:41 +02:00
Gabriele M
e198389bd5 Add a script to push updates
Useful to test OTA updates without setting up a server.

Change-Id: Ic4c2dc1ea9ce6bd6ec6750d1c4250079a5be7580
2018-04-11 00:33:05 +02:00
Gabriele M
6c0aa8118e 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:33:05 +02:00
Gabriele M
d5f4c1bcec 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 22:48:19 +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
17db209f13 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 14:26:19 +02:00
Joey
ec4f3146d6 Updater: Minor UI improvements
Change-Id: I5028aaa154991806ab911be0119fed0836e6851b
2018-04-08 14:26:12 +02:00
Joey
862e913590 Updater: Support Dark mode and update colors
Change-Id: I3503311e9e94663c4b708fc744962ce97690d6e1
2018-04-08 14:26:07 +02:00
Joey
6d24b010f7 Updater: Use popup menu instead of ActionMode
Change-Id: I707682708711679a7cbe1b0058cea9b1ed003cb6
2018-04-08 14:25:59 +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
a72b78c31e 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 14:25:53 +02:00
Gabriele M
6fd45962c1 Print stack trace if the JSON could not be parsed
This helps to identify errors in the response.

Change-Id: Icda0919378ebf1deba3a4c7d6d6d010a09eed3ce
2018-04-08 14:25:45 +02:00
Gabriele M
bf2e25d400 Updater: Fix Android Studio build
Increase the min API level to support notification channels
without compat libraries.

Change-Id: Ia2f383a108dbb4fc38b3d923ac7c5e3d173fcf71
2018-04-05 23:49:51 +02:00
Gabriele M
548f515a48 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:37:50 +02:00
Gabriele M
5252d60671 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: lineage.updater.uri must be updated accordingly

Change-Id: Iecfdaf9d422d08a707c7319bafea5befc6b757d2
2018-04-05 16:37:49 +02:00
Gabriele M
4fa7ba910a Replace refresh dialog with icon animation
Change-Id: I6d2cc649b9fa8883a7256d8ecb62cb56bbf5dd59
2018-04-05 16:37:49 +02:00
Gabriele M
4d5e82b885 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:37:49 +02:00
Gabriele M
8d0471effc 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:37:49 +02:00
Gabriele M
3aabbc7ed5 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:37:49 +02:00
Gabriele M
2ec8fc6cec 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:37:49 +02:00
Gabriele M
a409a4a03d 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:37:49 +02:00
Gabriele M
eecdf389ef 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:37:49 +02:00
Gabriele M
28644b3491 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:37:49 +02:00
Gabriele M
69e65ca4bf Remove duplicate INSTALLING notification
Change-Id: Ia1515aef1a24a5d54143e1423ae96f09163625bc
2018-04-05 16:37:46 +02:00
Michael Bestas
a0bdd6abba Automatic translation import
Change-Id: I0cd872bbd27613db1203a0538eff765379316ecb
2018-04-01 22:32:42 +03:00
Dan Pasanen
37524ad0fa Updater: explicitly include android-support-transition
* Fixes non-jack build

Change-Id: I44d470daa36f9ef5f06e5307297fa4c01fb078e5
2018-03-21 22:51:08 +00:00
Michael Bestas
14d522818c Automatic translation import
Change-Id: I5265394cac0bdd174c3cec21a11a1d0e6d35597d
2018-03-09 00:35:54 +02:00
Roman Birg
31057295dc 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-03-07 02:55:32 +00:00
Michael Bestas
f183b58b09 Automatic translation import
Change-Id: I2923971e3477640a67a241762d1dc164f1e0c462
2018-02-25 22:04:16 +02:00
Michael Bestas
d44eb7c414 Automatic translation import
Change-Id: I47e08290ebdb11c3d05d0614560dc2847884928d
2018-02-22 03:49:55 +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
Joey
f62a57c463 Updater: gradle: target api27
Change-Id: I83aae173b4e885368737ac94f5d6d018708d642b
Signed-off-by: Joey <joey@lineageos.org>
2018-02-17 12:54:17 +00:00
Joey
2a9c85e675 Updater: adaptive icon
Change-Id: Ifee7b51f48b204b646935d9470d31f6e9519124d
Signed-off-by: Joey <joey@lineageos.org>
2018-02-15 13:43:40 +00:00
Harry Youd
ff53035537 Updater: Add notification channels
Change-Id: I2f538fb47fe90e1008bf286739d33c829123353a
2018-01-23 23:47:18 +01:00
Gabriele M
0e79b791f0 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:41:40 +01:00
Gabriele M
3fc17494eb Updater: Android Studio support
See README-STUDIO.txt for more info.

Change-Id: Ie673bba5618b0f00a585049cd85687a64db2b420
2018-01-23 22:41:40 +01:00
Gabriele M
7005b005d9 Updater: Set version code explicitly
In this way apks built with gradle/Android Studio will have the
same versionCode, allowing to update the one in /system.

Change-Id: I020cc623dd7c1c5085fec4e6f5978b6ee46468a2
2018-01-23 22:41:40 +01:00
Gabriele M
e50edf0811 Remove progress from notification when done
Change-Id: If49c8d0ca2270f22dcc5350379f1bb1f34f02041
2018-01-23 22:41:40 +01:00
Gabriele M
63f6fd1a70 Report installation failures
Change-Id: I5e11db1e6e338a510b3c1c7d16f8c085d874a9db
2018-01-23 22:41:40 +01:00
Gabriele M
e02b8a0b00 Copy the updates for uncrypt using a Service
Same as change I488018d01c0baf74660362a384e53bfe5d85de2b
("Use a service to export the updates"). While at it, move the code
out of UpdaterService to better separate the code that deal with AB
updates and regular updates.

Change-Id: I2bc3e78e80f5e63c57303cbbcdc0353dbab0f67f
2018-01-23 22:41:40 +01:00
Gabriele M
e66a8fa53a Keep track of the installation status of AB updates
This allows to show the correct labels.

Change-Id: I52f42e042af0df2d091d786c03102cec352b3a5b
2018-01-23 22:41:40 +01:00