Commit graph

6441 commits

Author SHA1 Message Date
Tao Bao
09e8493861 applypatch: {Load,Save}FileContents return bool values.
Bug: 110106408
Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: Id72e24dd00eb451565d90cff6e049f4f4b844ea2
2018-08-31 14:31:19 -07:00
Tao Bao
af522672a2 Merge "applypatch: Refactor applypatch()." 2018-08-31 21:24:31 +00:00
Tao Bao
5609bc8b34 applypatch: Refactor applypatch().
applypatch() was initially designed for file-based OTA, operating on
individual files. It was later extended to allow patching eMMC targets
as a whole, in favor of block-based updates.

As we have deprecated file-based OTA since Oreo, part of the code in
applypatch() has become obsolete. This CL refactors the related
functions, by removing the obsolete logic and focusing on eMMC targets.

Since this CL substantially changes applypatch APIs, it adds new
functions to avoid unintentionally mixing them together. In particular,
it removes `applypatch()`, `applypatch_check()`, `applypatch_flash()`,
and adds `PatchPartition()`, `PatchPartitionCheck()`, `FlashPartition()`
and `CheckPartition()`. It also replaces the old Edify functions
`apply_patch()` and `apply_patch_check()` with `patch_partition()` and
`patch_partition_check()` respectively.

This CL requires matching changes to OTA generation script (in the same
topic).

Bug: 110106408
Test: Run recovery_unit_test and recovery_component_test on marlin.
Test: `m dist` with non-A/B target. Verify
      /system/bin/install-recovery.sh on device.
Test: `m dist` with non-A/B target using BOARD_USES_FULL_RECOVERY_IMAGE.
      Verify /system/bin/install-recovery.sh on device.
Test: Install an incremental OTA with the new updater and scripts.
Change-Id: Ia34a90114bb227f4216eb478c22dc98c8194cb7f
2018-08-31 09:21:15 -07:00
Tao Bao
6a333cde10 Merge "Enable c++17 in recovery_defaults." 2018-08-28 20:07:09 +00:00
Tao Bao
43bfa6e429 Enable c++17 in recovery_defaults.
And add the first few users.

Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: Ifdf093d011478b6a1dd0405b0ba48c145b509cc8
2018-08-28 10:49:07 -07:00
Tianjie Xu
a1e3d67bd7 Merge "Remove otafault" 2018-08-28 02:05:17 +00:00
Tianjie Xu
22f11205a1 Remove otafault
Now it's less beneficial to inject I/O faults since we don't see many of
them. Remove the library that mocks I/O failures. And switch to android::base
I/O when possible.

Bug: 113032079
Test: unit tests pass
Change-Id: I9f2a92b7ba80f4da6ff9e2abc27f2680138f942c
2018-08-27 17:16:19 -07:00
Treehugger Robot
9d7f918506 Merge "uncrypt: Depend on commonly used shared libs." 2018-08-23 17:38:42 +00:00
Treehugger Robot
11f766af4e Merge "Add /dev/stdin, /dev/stdout, and /dev/stderr in recovery too." 2018-08-23 16:54:33 +00:00
Elliott Hughes
a4495b5ee2 Add /dev/stdin, /dev/stdout, and /dev/stderr in recovery too.
Now these are in the main image, there's some chance of code assuming
they're present in recovery too (or command-line users using them out
of habit).

Bug: http://b/31824379
Test: builds
Change-Id: Ia19272cd1959685765099f3e15d1d1e63babd279
2018-08-23 08:31:59 -07:00
Tao Bao
d881d4f205 uncrypt: Depend on commonly used shared libs.
We already have these shared libraries on device. And `uncrypt` doesn't
need to be statically linked (it wasn't, even prior to this change).

With this change, the size of uncrypt goes down from 139KiB to 33KiB
(aosp_marlin-userdebug).

Test: Build and flash on marlin. Trigger a factory reset (which calls
      `uncrypt` to set up the BCB).
Change-Id: I77e3c82e8ce3734019da75c48928d881cb7ef0f0
2018-08-22 17:59:21 -07:00
Zhomart Mukhamejanov
ab7e652484 Merge "Move ab_streaming_metadata under ab_config." 2018-08-22 18:38:06 +00:00
Zhomart Mukhamejanov
88712f7610 Move ab_streaming_metadata under ab_config.
Add new config: ab_config.verify_payload_metadata.

Change-Id: I521dff92166c33dd9c2efa498dc599fe4bc83fde
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
Test: mmm, junit
Bug: 77150191
2018-08-22 18:37:51 +00:00
Treehugger Robot
0115b79cbd Merge "recovery: Add "boot-fastboot" command to BCB." 2018-08-22 01:48:58 +00:00
David Anderson
eee4e260f9 recovery: Add "boot-fastboot" command to BCB.
This change adds a new "boot-fastboot" command in order to boot into fastboot
without overwriting recovery tasks. This also allows bootloaders to boot
directly into userspace fastboot from the bootloader menu, or via
bootloader fastboot.

Bug: 112277594
Test: adb reboot fastboot
Change-Id: Ia0c9a0961a76c6cbe19486590179abaa50d93f58
2018-08-21 16:04:57 -07:00
Tao Bao
aa536568b3 Merge "Depend on mke2fs.conf.recovery." 2018-08-21 22:35:48 +00:00
Tao Bao
7c074d97bd Depend on mke2fs.conf.recovery.
Bug: 112780007
Test: `m dist` along with other changes in the topic. Check the file
      under recovery. Trigger factory reset from recovery UI.
Change-Id: I2fb6954576eefecea60712a21506a2aeb1cecc53
2018-08-21 12:32:03 -07:00
Treehugger Robot
09ce7686f2 Merge "tests: Remove {old,new}.file." 2018-08-20 17:48:56 +00:00
Tao Bao
cdbe58a2a2 tests: Remove {old,new}.file.
They serve the same purpose as {boot,recovery}.img, except that they're
not structured to be imgdiff'd. Remove the two files and replace all the
uses with {boot,recovery}.img instead.

Bug: 110106408
Test: Run recovery_{unit,component}_test on marlin.
Change-Id: I8e71187d5b0c142ad932f33717f6fae364b43abc
2018-08-20 09:08:35 -07:00
Tao Bao
102d14d6d1 Merge "updater: Add TransferList class." 2018-08-17 18:31:54 +00:00
Tao Bao
f8811bbd3a updater: Add TransferList class.
This would be the top-level class that represents and holds the info
parsed from a transfer list file.

Bug: 112151972
Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: I83b54df9d1411542eeeb8ef4a2db167e97f989c3
2018-08-17 09:37:26 -07:00
Tianjie Xu
fae0881528 Merge "Add a python binary to generate the protobuf for care_map" 2018-08-17 00:02:24 +00:00
Tianjie Xu
7e520d24fe Add a python binary to generate the protobuf for care_map
This binary parses the legacy care_map text in the input file and writes
the generated protobuf message into the output file. For test purpose,
it also has a "--parse_proto" option to reverse the process and convert
a protobuf message file into plain text.

The build script will then call the binary to generate the care_map.txt
in the new format.

Bug: 77867897
Test: Run the binary to convert a care_map.txt, run update_verifier
Change-Id: I3ca65e19027404806132aa8d51e9bff766630c99
2018-08-16 15:09:32 -07:00
Tao Bao
cf01f7dcbe Merge "ui: Only set brightness when needed." 2018-08-16 20:10:26 +00:00
Tao Bao
d460afe963 Merge "updater: Add SourceInfo::{ReadAll,DumpBuffer,Overlaps}." 2018-08-16 19:26:37 +00:00
Tao Bao
53be332711 ui: Only set brightness when needed.
There is a regression due to recent change in commit
b76af93ab5, where it started to set
brightness to normal on every key input. This is unneeded and spamming
the recovery log.

Test: Run recovery_unit_test on marlin.
Test: Built and boot into recovery image. Press a few keys, then check
      the recovery log.
Change-Id: Ia3a7ea400bcccdebbb27a6a7586e435bfb915923
2018-08-16 11:54:01 -07:00
Tao Bao
3c8927390e updater: Add SourceInfo::{ReadAll,DumpBuffer,Overlaps}.
Bug: 112151972
Test: Run recovery_unit_test on marlin.
Change-Id: Ica2a7b3c768f5d8ca5d591a9560bca9f8ed847c5
2018-08-16 11:09:35 -07:00
Tao Bao
f83d9f6b71 Merge "tests: Add the missing tests in applypatch_modes_test.cpp." 2018-08-16 01:16:57 +00:00
Tao Bao
0b66e96da5 Merge "Fixing the Mac SDK build" 2018-08-16 01:10:49 +00:00
Andreas Huber
435dfac15c Fixing the Mac SDK build
recovery_host_test is now excluded from darwin targets as its
dependency libimgdiff is.

Change-Id: I6aa085125109ed2218572df97f35289b71c354ab
2018-08-15 16:11:25 -07:00
Tao Bao
26b645447f tests: Add the missing tests in applypatch_modes_test.cpp.
This file was somehow missed when converting from Android.mk to
Android.bp. This CL addresses the issue by picking up all the .cpp files
in the test source dir.

Test: Run recovery_{unit,component}_test on marlin. Check the reported
      number of tests (94 for unit test and 157 for component test).
Change-Id: I50435b07fcb8602ef7b3f7e7d3a69e10b6a5932d
2018-08-15 15:34:46 -07:00
Tianjie Xu
c8e0292b61 Merge "Further compress the recovery animation file" 2018-08-15 22:30:55 +00:00
Tianjie Xu
e45f359e9c Further compress the recovery animation file
The res/images/loop.*png can be further compressed with "pngquant
--quality 0-10"; and the difference is not noticeable to humans
under recovery. And This reduces the animation pictures under res-xxxhdpi
from 2.7M to 1.2M.

Note that the *_text.png files can't be compressed this way because they
requires lossless compression to keep the embedded locales intact.

Bug: 112494634
Test: Run recovery graphic tests.
Change-Id: I2cefaea8e037cb09cb4e4735d1b86e82da9e6875
2018-08-15 19:07:08 +00:00
Tao Bao
b1ff1bc43b Merge "tests: Move to Android.bp." 2018-08-15 17:56:19 +00:00
Tao Bao
ef5e38fef0 tests: Move to Android.bp.
Also separate libupdater_defaults out to be shareable.

It turns out the `data` property in `cc_test` doesn't follow symlinks as
LOCAL_TEST_DATA does in Android.mk. This CL creates a filegroup in
top-level Android.bp in order to pick up the testdata for ResourcesTest.

Test: `mmma -j bootable/recovery` with aosp_marlin-userdebug
Test: Run recovery_{unit,component,manual}_test on marlin.
Test: Run recovery_host_test.
Change-Id: I4532ab25aeb83c0b0baa8051d5fe34ba7b910a35
2018-08-14 21:46:45 -07:00
Tao Bao
97de9c3d3e Merge "Track the change to update_engine_sideload path." 2018-08-15 01:46:31 +00:00
Treehugger Robot
19a5316412 Merge "Add fastboot mode to recovery" 2018-08-14 21:25:50 +00:00
Yifan Hong
ce2f0d85fb Merge "recovery uses IHealth::getService" 2018-08-14 21:06:58 +00:00
Tao Bao
2cc9bbb1ec Track the change to update_engine_sideload path.
Bug: 112494634
Test: Build and boot into recovery image on taimen. Verify that
      `Apply updates from ADB` keeps working.
Test: Run recovery_component_test on marlin.

Change-Id: I9ee8834053fda79a4fd77bfa83eab3cc51a90dff
2018-08-14 12:34:46 -07:00
Tao Bao
c205dd9d43 Merge "updater: Move libupdater to Soong." 2018-08-14 16:43:15 +00:00
Tao Bao
19d002d33f Merge "recovery: Drop the dependency on libcrypto_utils.so and libsparse.so." 2018-08-14 16:42:37 +00:00
Tianjie Xu
c0195801dc Merge "Add the hash_tree_info class in Command" 2018-08-14 16:33:10 +00:00
Tao Bao
b0f132e244 recovery: Drop the dependency on libcrypto_utils.so and libsparse.so.
They're only needed in past when we statically linked libs that had
dependencies on them. Dropping them doesn't affect the recovery image
size, as there're still other users of the libs. But this would avoid
the false dependencies on them.

Test: `mmma -j bootable/recovery`
Change-Id: Ib43cc42221edde9efea1f12357cfc2f2232ec520
2018-08-13 23:02:17 -07:00
Hridya Valsaraju
20c81b308d Add fastboot mode to recovery
Add a fastboot mode to recovery that can be
entered with command line args or with the ui.

Add usb property triggers to switch between
fastboot and adb configurations.

Allow switching between fastboot and adb through
usb commands by opening a unix socket. adbd/fastbootd
writes to this socket, which interrupts the ui and
switches to the new mode.

Test: Use fastboot mode
Bug: 78793464
Change-Id: I7891bb84427ec734a21a872036629b95ab3fb13c
2018-08-13 21:18:18 -07:00
Tianjie Xu
8f64bf635f Add the hash_tree_info class in Command
Add hash_tree_info to represent the hash tree computation arguments in
the transfer commands 'compute_hash_tree'. Also add its parsing code in
the Command class.

Bug: 25170618
Test: unit tests pass
Change-Id: Ie8607968377968e8fb3e58d1af0b8ca315e145be
2018-08-13 17:27:30 -07:00
Yifan Hong
056538c0a9 recovery uses IHealth::getService
recovery is_battery_ok function uses get_health_service(),
which calls IHealth::getService("default") then
IHealth::getService("backup").

- An OEM can provide the default instance by installing
  android.hardware.health@2.0-impl-<device>.so to recovery
  partition.

- If that's not found, the "backup" instance is provided
  to the recovery partition by default.

Test: call is_battery_ok() in recovery, successfully
  get battery information.

Bug: 80132328

Change-Id: Ibfee80636325a07bc20b24d044d007a60b3dd7c2
2018-08-13 16:16:18 -07:00
Tao Bao
337bd80b78 Merge "Reland "Build and use minadbd as a shared library."" 2018-08-13 22:52:56 +00:00
Tao Bao
7d2a63afe1 Reland "Build and use minadbd as a shared library."
This relands the previously reverted CL in commit
c70446ce7b ("Build and use minadbd as a
shared library."). `recovery` has been built with Soong, so the previous
concern (unintentionally installing `libminadbd_services.so` to normal
system image) no longer holds.

Note that `reocvery` can't use `libminadbd_services.a`, as functions
like `daemon_service_to_fd()` (needed by `libadbd.so`) won't be linked
into `recovery`.

This CL moves the dependency of `libminadbd_services` from `librecovery`
into `recovery`, as only the latter actually relies on it (via
`recovery_main.cpp`). Note that we no longer need to list the transitive
dependency on `libadbd` or `libasyncio`.

Bug: 112494634
Test: `mmma -j bootable/recovery`
Test: Build and boot into recovery with aosp_taimen-userdebug. Verify that
      sideloading keeps working.
Test: `build/soong/build_test.bash --dist`
Change-Id: Ic086470b86d6770bede317e0f5534f608fa7b7d2
2018-08-13 14:09:58 -07:00
Colin Cross
1914bd0f4b Merge "Remove TODO for b/112462307" 2018-08-13 21:02:58 +00:00
Colin Cross
f27ca7eff6 Remove TODO for b/112462307
b/112462307 is fixed now, remove the TODO.

Bug: 112462307
Test: dexlist out/soong/.intermediates/bootable/recovery/updater_sample/SystemUpdaterSample/android_common/dex/classes.dex | grep getUpdaterState
Change-Id: I19cb93a74b714967e4bab2964e229a0ab0a15676
2018-08-13 12:38:28 -07:00