Commit graph

2534 commits

Author SHA1 Message Date
Tianjie Xu
8cf5c8f60f Replace minzip with libziparchive
Clean up the duplicated codes that handle the zip files in
bootable/recovery; and rename the library of the remaining
utility functions to libotautil.

Test: Update package installed successfully on angler.
Bug: 19472796

Change-Id: Iea8962fcf3004473cb0322b6bb3a9ea3ca7f679e
2016-10-17 17:41:51 -07:00
Treehugger Robot
2b17b24ae5 Merge "Change StringValue to use std::string" 2016-10-18 00:05:12 +00:00
Tao Bao
a01ffc73ef Merge "init: move healthd to late-init" 2016-10-17 17:32:56 +00:00
Tianjie Xu
aced5d9e4e Change StringValue to use std::string
Changing the field of 'Value' in edify to std::string from char*.
Meanwhile cleaning up the users of 'Value' and switching them to
cpp style.

Test: compontent tests passed.
Bug: 31713288

Change-Id: Iec5a7d601b1e4ca40935bf1c70d325dafecec235
2016-10-15 01:18:23 +00:00
Treehugger Robot
08d0ae9254 Merge "Fix the prefix matching for uncrypt status." 2016-10-14 22:39:19 +00:00
Tao Bao
ee9b95544a Fix the prefix matching for uncrypt status.
Also change its logging statement from PLOG to LOG, since
android::base::StartsWith() doesn't set errno.

Test: Build and reboot into recovery image. Check last_log.

Change-Id: I55ac7eec24228db76a13580958b4a4330b06cf57
2016-10-13 16:07:15 -07:00
Tao Bao
c5b4b71913 Merge "edify: Some clean-ups to libedify." 2016-10-13 17:18:07 +00:00
Tao Bao
39119ad8ec edify: Some clean-ups to libedify.
- Remove dead declarations in expr.h: SetError(), GetError(),
  ClearError().
- Remove the declaration of Build() out of expr.h.
- Use std::unordered_map to implement RegisterFunction() and
  FindFunction(); kill FinishRegistration().
- Add a testcase for calling unknown functions.

Test: mmma bootable/recovery; recovery_component_test passes.
Change-Id: I9af6825ae677f92b22d716a4a5682f58522af03b
2016-10-12 23:29:59 -07:00
Tao Bao
19bb05dfc7 Merge "updater: Kill the duplicate PrintSha1() in install.cpp." 2016-10-12 19:22:16 +00:00
Tao Bao
361342cbd2 updater: Kill the duplicate PrintSha1() in install.cpp.
Also add a testcase for sha1_check().

Test: mmma bootable/recovery; recovery_component_test passes.

Change-Id: I4d06d551a771aec84e460148544f68b247a7e721
2016-10-10 20:36:17 -07:00
Tao Bao
a7995d7581 Merge "Refactor libupdater into a seperate module." 2016-10-11 03:36:04 +00:00
Andriy Naborskyy
544a1562d9 init: move healthd to late-init
Starting healthd in early-init is not needed and can delay coldboot done
Now healthd is starting at boot as usual service.

Test: check kmsg that healthd starting after /dev/.coldboot_done

Bug: 30292927
Change-Id: I367d022f5885122da49181db3db536012e83f564
2016-10-10 17:29:11 -07:00
Tao Bao
0c7839ac14 Refactor libupdater into a seperate module.
So that we can write native tests for updater functions. This CL adds a
testcase for getprop() function.

Test: mmma bootable/recovery; Run recovery_component_test on device.

Change-Id: Iff4c1ff63c5c71aded2f9686fed6b71cc298c228
2016-10-10 16:49:50 -07:00
Tao Bao
2bd94433f8 Merge "Update the header path for ext4_utils." 2016-10-10 20:07:32 +00:00
Mark Salyzyn
b330559fb6 Merge "No longer need android/log.h" 2016-10-10 14:14:30 +00:00
Tao Bao
de40ba59c8 Update the header path for ext4_utils.
Test: `mmma bootable/recovery`
Change-Id: I70ccddb3ddf46bb012fdc5f632afc46ebdd5473e
2016-10-09 14:02:10 -07:00
Tao Bao
aa4924cab1 Merge "Disable the meaningless parts of the UI for A/B." 2016-10-09 21:00:37 +00:00
Elliott Hughes
b0c3f6ffeb Disable the meaningless parts of the UI for A/B.
Bug: http://b/28748484
Test: mmma bootable/recovery
Change-Id: Ie86a265f4699503471e7c717d65677a916dbd25b
(cherry picked from commit 01fcbe160b)
2016-10-09 12:55:50 -07:00
Mark Salyzyn
df1b6947ec No longer need android/log.h
Test: compile
Bug: 31992412
Change-Id: I5156590bfc94e46e9d282c197c3dd8c4bbd9e855
2016-10-07 14:19:48 -07:00
Treehugger Robot
8810634773 Merge "edify: Move State.script and State.errmsg to std::string." 2016-10-05 06:07:56 +00:00
Tao Bao
59dcb9cbea edify: Move State.script and State.errmsg to std::string.
This way we kill a few strdup() and free() calls.

Test: 1. recovery_component_test still passes;
2. Applying an update with the new updater works;
3. The error code in a script with abort("E310: xyz") is recorded into
last_install correctly.

Change-Id: Ibda4da5937346e058a0d7cc81764d6f02920010a
2016-10-04 14:24:32 -07:00
Mark Salyzyn
38b923ff6c Merge "recovery: drop log/logger.h" 2016-10-04 17:39:17 +00:00
Tao Bao
0bc2df1696 Merge "edify: Move the testcases to gtest." 2016-10-04 16:55:50 +00:00
Mark Salyzyn
fee79a4532 recovery: drop log/logger.h
private/android_logger.h contains all we need.

Test: compile
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I6714d730372dc81f784e7f9dfee8a33848643a5d
2016-10-04 09:04:08 -07:00
Tao Bao
d770d2e7af edify: Move the testcases to gtest.
Now they live in tests/component/edify_test.cpp.

Also rename edify/main.cpp to edify/edify_parser.cpp. It becomes a
host-side debugging tool that validates the input edify script. However,
it supports edify builtin functions only and doesn't recognize the ones
defined via updater.

Test: recovery_component_test passes on device.

Change-Id: Ib94a787bf15098a9cc078d256b6a6dc96ff12b2e
2016-10-03 15:33:20 -07:00
Tianjie Xu
695ef7cacc Merge "Turn on -Werror for recovery" 2016-09-30 17:41:14 +00:00
Tianjie Xu
7aa88748f6 Turn on -Werror for recovery
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.

Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
2016-09-29 19:21:24 -07:00
Treehugger Robot
af8b9363c6 Merge "Report uncrypt errors in details" 2016-09-27 21:11:06 +00:00
Tianjie Xu
da44cf18f3 Report uncrypt errors in details
Add the error codes for uncrypt and report the failure details in
uncrypt_status.

Test: uncrypt_error logs correctly in last_install
Bug: 31603820
Change-Id: I8e0de845ce1707b6f8f5ae84564c5e93fd5f5ef5
2016-09-26 22:48:45 -07:00
Tao Bao
95afc912fb Merge "Duplicate the last_install content into last_log." 2016-09-27 01:38:53 +00:00
Tao Bao
f4885adc18 Duplicate the last_install content into last_log.
Currently we save the OTA metrics in last_install, which keeps the data
for the _last_ install only. This CL logs the same content into last_log
so that we keep the metrics for every install.

Bug: 31607469
Test: Apply an update (via OTA and sideload) and check last_log and last_install.

Change-Id: Id8f174d79534fddc9f06d72a4e69b2b1d8ab186c
2016-09-26 14:46:12 -07:00
Elliott Hughes
cc02f9652f Merge "Switch to <android-base/properties.h>." 2016-09-26 19:32:48 +00:00
Elliott Hughes
cb22040c63 Switch to <android-base/properties.h>.
Bug: http://b/23102347
Test: boot into recovery.
Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e
Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e
2016-09-26 09:51:37 -07:00
Treehugger Robot
3cf815a6a9 Merge "Check corruption when reading uncrypt_status file" 2016-09-13 22:20:04 +00:00
Tianjie Xu
1c1864f321 Check corruption when reading uncrypt_status file
Bug: 31383361
Change-Id: I0de920916da213528d73b742e4823b4a98c63ea1
2016-09-13 13:56:00 -07:00
Tianjie Xu
cdf509cce2 Merge "save uncrypt status to last_install" 2016-09-12 22:56:31 +00:00
Tianjie Xu
fe16b5ccaf save uncrypt status to last_install
Save the uncrypt time cost to /cache/recovery/uncrypt_status. Recovery
reads the file and saves its contents to last_install.

Bug: 31383361
Test: Tested on angler and uncrypt_time reports correctly.

Change-Id: I5cd3f7b6ca069d69086d09acfea8fc4f1215c833
Merged-In: I5cd3f7b6ca069d69086d09acfea8fc4f1215c833
2016-09-12 22:55:36 +00:00
Tianjie Xu
61590bbf0d Merge "Switch recovery to libbase logging" 2016-09-01 23:04:37 +00:00
Tianjie Xu
7b0ad9c638 Switch recovery to libbase logging
Clean up the recovery image and switch to libbase logging.

Bug: 28191554
Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35
Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
2016-09-01 18:33:25 +00:00
Treehugger Robot
3202b8faf4 Merge "Check an edge case when read(2) returns 0" 2016-09-01 17:48:39 +00:00
Tianjie Xu
71e182bc38 Check an edge case when read(2) returns 0
We might end up in an infinite loop if read(2) reached EOF unexpectedly.
The problematic code in uncrypt mentioned in the bug has been fixed
by switching to libbase ReadFully(). So I grepped through the recovery
code and fixed some other occurences of the issue.

Bug: 31073201
Change-Id: Ib867029158ba23363b8f85d61c25058a635c5a6b
2016-08-31 19:11:41 -07:00
Josh Gao
818394869d Merge "minadbd: rename adb_server_main to minadbd_main." 2016-08-30 20:17:27 +00:00
Josh Gao
acb2a2fa4c minadbd: rename adb_server_main to minadbd_main.
adb_server_main in adb refers to the adb server on the host, not adbd.
Since there doesn't seem to be a good reason to reuse the declaration
from adb's headers, give minadbd a main function of its own.

Change-Id: I748f1a6822dc14c726cb73ef3b533c57a6615608
2016-08-30 13:15:12 -07:00
Treehugger Robot
89bf2bdc85 Merge "Fix clang-tidy warnings in bootable/recovery." 2016-08-26 23:29:23 +00:00
Chih-Hung Hsieh
8b23811d2a Fix clang-tidy warnings in bootable/recovery.
* Use const reference type for read-only parameters.
Bug: 30407689
* Use faster overloaded string find function.
Bug: 30411878
* Add parentheses around macro parameters.
Bug: 28705665

Test: build with WITH_TIDY=1
Change-Id: I4e8e5748bfa4ae89871f1fb5fa4624d372530d75
2016-08-26 14:54:29 -07:00
Tao Bao
b3ddc0a4bf Merge "Free mmaped area if keys fail to load"
am: f599414aec

Change-Id: Id96153c211ca1fcc1cd78d6e662b0b48795c0d76
2016-08-18 06:14:46 +00:00
Tao Bao
f599414aec Merge "Free mmaped area if keys fail to load" 2016-08-18 06:10:35 +00:00
WiZarD
edafac6c7b Free mmaped area if keys fail to load
Keys for package verification is loaded after the update
package is mmaped into memory. This mmaped area needs
to be freed when exiting the function.

Another approach would be to mmap after loading the keys.

Change-Id: Ib77711a8acd5c363b5517da12dc311fb8f9f4605
Signed-off-by: WiZarD <WiZarD.Devel@gmail.com>
2016-08-18 05:20:40 +00:00
Tianjie Xu
4e4474c9c5 Merge ""view recovery logs" will show /tmp/recovery.log"
am: c158cf0a14

Change-Id: I1485c1c84a7caa20b11da4fd2561e0dba95fc39b
2016-08-17 22:07:44 +00:00
Tianjie Xu
c158cf0a14 Merge ""view recovery logs" will show /tmp/recovery.log" 2016-08-17 22:05:16 +00:00