Commit graph

3783 commits

Author SHA1 Message Date
Tao Bao
bc4b1fe4c4 Add tests for update_binary_command().
Expose update_binary_command() through private/install.h for testing
purpose.

Also make minor clean-ups to install.cpp: a) adding more verbose logging
on ExtractToMemory failures; b) update_binary_command() taking
std::string instead of const char*; c) moving a few macro and global
constants into update_binary_command().

Bug: 37300957
Test: recovery_component_test on marlin
Test: Build new recovery and adb sideload on angler and sailfish.
Change-Id: Ib2d9068af3fee038f01c90940ccaeb0a7da374fc
2017-04-17 20:44:37 -07:00
Tao Bao
ce91df8293 Merge "Fix the double free in verify_package_compatibility()." 2017-04-18 03:21:07 +00:00
Tao Bao
c1ca21a32d Merge changes from topic 'libvintf'
* changes:
  Add the missing LOCAL_CFLAGS for librecovery.
  Verify the package compatibility with libvintf.
2017-04-18 03:20:49 +00:00
Tom Cherry
4608daf0fe init.rc: Remove sys.powerctl action
Init now handles this property change directly.

Bug: 37209359
Bug: 37415192

Test: Init reboots normally.
Change-Id: I9a4925897fb83bed180d12c871d9a71126fa4aa8
2017-04-17 16:55:54 -07:00
Tao Bao
4854e77fd2 Merge "libmounts: Remove two dead functions." 2017-04-17 23:10:28 +00:00
Tao Bao
99c549db74 Fix the double free in verify_package_compatibility().
"""
void* cookie;
std::unique_ptr<void, decltype(&EndIteration)> guard(cookie, EndIteration);
  ...
EndIteration(cookie);
"""

The above pattern is buggy that frees 'cookie' twice.

Bug: 37413730
Test: Build new recovery and adb sideload a previously crashed package
      that contains 'compatibility.zip'.
Change-Id: I183c33827fb28a438ebaedda446e84cabe7cb92d
(cherry picked from commit f978278995)
2017-04-17 15:59:10 -07:00
Tao Bao
7fdcb19e10 Add the missing LOCAL_CFLAGS for librecovery.
The -DAB_OTA_UDPATER part was missing when separating the librecovery
module (commit 62e0bc7586).

Bug: 37300957
Test: Build sailfish recovery image and sideload full OTA.
Change-Id: Idd25662f6bc812c1aca95b096802f59b051f8d63
(cherry picked from commit 25dbe1717e)
2017-04-17 15:58:56 -07:00
Tao Bao
e95902280c libmounts: Remove two dead functions.
find_mounted_volume_by_device() and remount_read_only() have no active
users. And we don't have a code logic that requires these two functions.

Test: mmma bootable/recovery
Test: Code search shows no user.
Change-Id: Ib11c2ba93ee087ea020c1337eb06686a6165f894
2017-04-16 15:53:47 -07:00
Josh Gao
d3d91e5595 Merge "minadbd: switch adb_thread_create to std::thread." 2017-04-14 20:04:04 +00:00
Josh Gao
2aa0d3abb4 minadbd: switch adb_thread_create to std::thread.
Test: treehugger
Change-Id: I7edcb13eb1fc6d4f36f5a764a1b647fbf9cd063e
2017-04-13 14:28:00 -07:00
Tao Bao
1d866050eb Verify the package compatibility with libvintf.
verify_package_compatibility() is added to parse the compatibility entry
(compatibility.zip) in a given OTA package. If entry is present, the
information is sent to libvintf to check the compatibility.

This CL doesn't actually call libvintf, since the API there is not
available yet.

Bug: 36597505
Test: Doesn't break the install with existing packages (i.e. w/o the
      compatibility entry).
Test: recovery_component_test
Change-Id: I3903ffa5f6ba33a5c0d761602ade6290c6752596
(cherry picked from commit 62e0bc7586)
2017-04-12 22:46:09 -07:00
Tianjie Xu
1b28a27c33 Merge "Protect filename_cache with lock in ota fault" 2017-04-11 05:08:05 +00:00
Tianjie Xu
4bb11c745b Protect filename_cache with lock in ota fault
Bug: 33173924
Test: Apply a successfully update on bullhead
Change-Id: I28cc356e216a3e957b5533c338ee6bc3c0920222
2017-04-10 16:21:09 -07:00
Tianjie Xu
b4b0c49c48 Merge "Abort the update if there's not enough new data" 2017-04-10 18:12:09 +00:00
Tianjie Xu
3a8d98dd90 Abort the update if there's not enough new data
Right now the update stuck in a deadlock if there's less new data than
expection. Add some checkers and abort the update if such case happens.
Also add a corresponding test.

Bug: 36787146
Test: update aborts correctly on bullhead && recovery_component_test passes
Change-Id: I914e4a2a4cf157b99ef2fc65bd21c6981e38ca47
2017-04-07 17:19:46 -07:00
Tao Bao
3cd630a5a8 Merge "tests: Use get_bootloader_message_blk_device() to find /misc." 2017-04-05 15:40:59 +00:00
Tao Bao
ad87d9dc78 tests: Use get_bootloader_message_blk_device() to find /misc.
Since commit fb00d82f32 has added
get_bootloader_message_blk_device() as an API, switch the tests-local
implementation to it.

Test: recovery_component_test on angler.
Test: recovery_component_test on a local build that doesn't have /misc.
Change-Id: I4f5f542cb9ef58292c587a677da73d8822db7262
2017-04-04 20:35:10 -07:00
Alex Deymo
b5fca37976 Merge "Boot control HAL based on the A/B headers." 2017-04-04 23:14:30 +00:00
Tao Bao
7ffa8be41d Merge "Change the internal representation in RangeSet." 2017-04-04 21:44:27 +00:00
Tom Cherry
2717c28e77 Merge "update_verifier: correct group in rc file"
am: 310fa65c02

Change-Id: I66e145f77ab1543f91a2b666f6bd4f4287b61292
2017-04-04 01:11:54 +00:00
Treehugger Robot
310fa65c02 Merge "update_verifier: correct group in rc file" 2017-04-04 01:06:21 +00:00
Tom Cherry
3a8002f8c0 update_verifier: correct group in rc file
update_verifier should be in the cache group, not 'class'.

Also use PLOG instead of LOG if care_map.txt cannot be opened.

Bug: 36818743
Test: boot sailfish
Test: fake OTA on sailfish and verify update_verifier reads care_package
Change-Id: I0ec844cac5ef5c63b18ebee90160854fd84ee829
2017-04-03 16:31:16 -07:00
Wei Wang
56e9b9cc26 Merge "update_verifier: tweak priority of update_verifier for quick boot"
am: a6ea26987d

Change-Id: I19d4e2680f731d78a22f595a049cb079f1531516
2017-04-03 23:22:47 +00:00
Treehugger Robot
a6ea26987d Merge "update_verifier: tweak priority of update_verifier for quick boot" 2017-04-03 23:15:52 +00:00
Wei Wang
a015cd1d7a update_verifier: tweak priority of update_verifier for quick boot
Highest ioprio is 0 for CFQ and we should run update_verifier with that.
Tested on device and showing boottime decreased.

Bug: 36511808
Bug: 36102163
Test: Boot marlin
Change-Id: Iddd925951d976e21014b61e5590bcdae3cea8470
2017-04-03 13:53:49 -07:00
Alex Deymo
fb00d82f32 Boot control HAL based on the A/B headers.
The added bootctrl.bcb module implement the legacy interface for the
bootctrl HAL based on the Boot Control Block (BCB) and the headers
already specified in the booloader_message library.

This serves as a reference implementation of the boot_control HAL.

Bug: 32707546
Test: Tested internally that a device can use this HAL to flip slots and
recovery from a /misc wipe.

Change-Id: Ic02e5aaf4de7d0a1780eac4e8705dae20d0b3e10
2017-04-03 11:25:33 -07:00
Tao Bao
1f38a9b96e Merge "applypatch: Remove duplicate test files."
am: b6609f8895

Change-Id: I725317517485f5332cf4ebd326deb027bfc397e8
2017-04-03 16:23:31 +00:00
Tao Bao
a982e53a6e Merge "updater: Keep the parsed parameters in std::unique_ptr."
am: c80dd4ade2

Change-Id: I1387f9134a9bfeada23120b64544cdd7630f25e1
2017-04-03 16:23:20 +00:00
Tao Bao
bf5b77dbf7 Change the internal representation in RangeSet.
This CL makes the following changes to RangeSet:
 - Uses std::pair<size_t, size_t> to represent a Range;
 - Uses std::vector<Range> to represent a RangeSet;
 - Provides const iterators (forward and reverse);
 - Provides const accessor;
 - 'blocks()' returns the number of blocks (formerly 'size');
 - 'size()' returns the number of Range's (formerly 'count').

Test: recovery_unit_test
Test: Apply an incremental update with the new updater.
Change-Id: Ia1fbb343370a152e1f7aa050cf914c2da09b1396
2017-04-03 09:22:48 -07:00
Tao Bao
b6609f8895 Merge "applypatch: Remove duplicate test files." 2017-04-03 16:18:37 +00:00
Tao Bao
c80dd4ade2 Merge "updater: Keep the parsed parameters in std::unique_ptr." 2017-04-03 16:18:12 +00:00
Tao Bao
c3ef089dfa applypatch: Remove duplicate test files.
CL in commit b8a693bbc7 has ported the
tests to gtest-based recovery_component_tests.

Test: N/A
Change-Id: I485fa11413df68a11416d4a9f91f090f302bcfc0
2017-04-02 11:27:13 -07:00
TreeHugger Robot
474dc18479 Merge "Import translations. DO NOT MERGE" into stage-aosp-master 2017-04-02 03:57:09 +00:00
Tianjie Xu
cd66e52573 Merge "Use regular check for partition name instead of CHECK()"
am: 76cb4eeda6

Change-Id: Idd4686a7d30f08baa92557a0bcc872e95f867ba3
2017-04-02 03:05:45 +00:00
Tianjie Xu
76cb4eeda6 Merge "Use regular check for partition name instead of CHECK()" 2017-04-02 03:01:18 +00:00
Bill Yi
14eb2086c0 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 36832302
Change-Id: I1bfbb1791a4d7925491d7574c08994f6e7ff640d
2017-04-01 15:49:37 -07:00
Tianjie Xu
5a176c0d3c Use regular check for partition name instead of CHECK()
Bug: 36260064
Test: Device reboots for invalid care_map.
Change-Id: Id614f0d118fc2b9d9abf24918aa4b4324f4c94e1
2017-03-31 23:54:05 +00:00
Tianjie Xu
89559e3cfe Merge "Update_verifier should read blocks in EIO mode"
am: 21d481c81e

Change-Id: Ib564e410f614ef516784eeaf9df24f33e4a07d8c
2017-03-31 22:22:06 +00:00
Tianjie Xu
21d481c81e Merge "Update_verifier should read blocks in EIO mode" 2017-03-31 22:17:00 +00:00
Tao Bao
74c4da4c01 Merge "Move parse_range() and range_overlaps() into RangeSet."
am: 8fab8f97b7

Change-Id: Ibb85242f50b14baea227661443d105e1a68e9504
2017-03-31 19:24:56 +00:00
Tao Bao
c97edcb4f4 updater: Keep the parsed parameters in std::unique_ptr.
We don't need to take raw pointers out of the parsed arguments.
std::unique_ptr handles the dereferencing automatically.

Test: mmma bootable/recovery
Change-Id: I1beabf6e04dc350bdad7b36cee5fb345c82b28f2
2017-03-31 12:24:22 -07:00
Tao Bao
8fab8f97b7 Merge "Move parse_range() and range_overlaps() into RangeSet." 2017-03-31 19:18:45 +00:00
Tao Bao
8f23757ad4 Move parse_range() and range_overlaps() into RangeSet.
Also move RangeSet into a header file to make it testable, and add unit
tests.

In RangeSet::Parse() (the former parse_range()), use libbase logging to
do assertions. This has the same effect as the previous
exit(EXIT_FAILURE) to terminate the updater process and abort an update.
The difference lies in the exit status code (i.e. WEXITSTATUS(status) in
install.cpp), which changes from 1 (i.e. EXIT_FAILURE) to 0.

Test: recovery_unit_test
Test: Apply an incremental update with the new updater.
Change-Id: Ie8393c78b0d8ae0fd5f0ca0646d871308d71fff0
2017-03-31 00:04:56 -07:00
Tianjie Xu
3958a95f54 Update_verifier should read blocks in EIO mode
Update_verifier will reboot the device if it fails to read some blocks
on the care_map when veritymode=eio. Also make some partition name
changes to match the care_map.txt.

Test: Update_verifier reboots the device after read failures in eio mode.
Change-Id: Icf68e6151dee72f626a9ab72946100cf482a4e6c
2017-03-30 22:11:56 -07:00
Bowgo Tsai
0e728806f3 Merge "recovery: switch to fs_mgr_read_fstab_default()"
am: d0c7ae1fa6

Change-Id: I2afb42ed6b87e3e8d8e8289eb99fa6198d1a7daf
2017-03-31 02:32:48 +00:00
Treehugger Robot
d0c7ae1fa6 Merge "recovery: switch to fs_mgr_read_fstab_default()" 2017-03-31 02:28:31 +00:00
Tao Bao
7ccb4090d1 Merge "updater: Move RangeSinkWrite into RangeSinkState."
am: 65c065b4bb

Change-Id: Ic58d5dc9343840feaf916fdeac556b4191e64dfe
2017-03-31 00:01:46 +00:00
Tao Bao
65c065b4bb Merge "updater: Move RangeSinkWrite into RangeSinkState." 2017-03-30 23:56:14 +00:00
Tao Bao
08224f745c Merge "updater: Don't append newline when calling uiPrint()."
am: 58cb690eac

Change-Id: Ib7f2356c3a519be52c65ebae179c24a138058b37
2017-03-30 19:27:29 +00:00
Tao Bao
58cb690eac Merge "updater: Don't append newline when calling uiPrint()." 2017-03-30 19:22:04 +00:00