android/platform-bootable-recovery.git
3 years agoMerge "tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test." master
Treehugger Robot [Tue, 13 Mar 2018 15:48:33 +0000 (15:48 +0000)]
Merge "tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test."

3 years agotests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test.
Tao Bao [Tue, 13 Mar 2018 04:18:52 +0000 (21:18 -0700)]
tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test.

/system/bin/applypatch on device is expected to work with bsdiff based
recovery-from-boot patch automatically. Adding a test to ensure that's
always the case.

Bug: 72731506
Test: Run recovery_component_test on marlin.
Change-Id: I56283cd3ce7cf0215cc3bb3619b206fa01d552c4

3 years agoMerge "recovery: add libhidl-gen-utils depedency"
Yifan Hong [Mon, 12 Mar 2018 20:50:25 +0000 (20:50 +0000)]
Merge "recovery: add libhidl-gen-utils depedency"

3 years agoMerge "Set the update locations to default in CacheLocation's constructor"
Tianjie Xu [Fri, 9 Mar 2018 04:17:30 +0000 (04:17 +0000)]
Merge "Set the update locations to default in CacheLocation's constructor"

3 years agoSet the update locations to default in CacheLocation's constructor
Tianjie Xu [Thu, 8 Mar 2018 20:34:19 +0000 (12:34 -0800)]
Set the update locations to default in CacheLocation's constructor

Otherwise the applypatch executable will fail to back up the source
file to /cache when patching the recovery image.

Bug: 74198354
Test: run applypatch from boot to recovery
Change-Id: I6e5b9cd06d6ed0b26066b779a348437ecf984b92

3 years agorecovery: add libhidl-gen-utils depedency
Yifan Hong [Wed, 7 Mar 2018 01:59:58 +0000 (17:59 -0800)]
recovery: add libhidl-gen-utils depedency

introduced as a depedency to libvintf.

Test: builds
Bug: 73556059
Change-Id: Ia51ba81ef462879481dcacb80d9ea9ea35e8b0bb

3 years agoMerge "Export fuse_sideload.h for libfusesideload." android-o-mr1-iot-preview-7
Treehugger Robot [Wed, 7 Mar 2018 22:05:54 +0000 (22:05 +0000)]
Merge "Export fuse_sideload.h for libfusesideload."

3 years agoMerge "Drop the no-op Android.bp."
Treehugger Robot [Wed, 7 Mar 2018 20:17:06 +0000 (20:17 +0000)]
Merge "Drop the no-op Android.bp."

3 years agoMerge "minadbd: Move to Soong."
Treehugger Robot [Wed, 7 Mar 2018 18:56:50 +0000 (18:56 +0000)]
Merge "minadbd: Move to Soong."

3 years agoDrop the no-op Android.bp.
Tao Bao [Wed, 7 Mar 2018 17:54:50 +0000 (09:54 -0800)]
Drop the no-op Android.bp.

The "subdirs=" statement no longer has any effect (with the CL in [1]
that's merged last November). All the Android.bp's will be picked up
automatically.

[1] commit 4f21237342e715cbbac6e409cd67e86a304483c4 in
https://android-review.googlesource.com/c/platform/build/blueprint/+/530115.

Test: mmma -j bootable/recovery
Change-Id: Idd39af1fff907e8c1886f91eea0dd4a9e38a4079

3 years agoExport fuse_sideload.h for libfusesideload.
Tao Bao [Wed, 7 Mar 2018 06:05:25 +0000 (22:05 -0800)]
Export fuse_sideload.h for libfusesideload.

Move the module into a separate directory so that we can export only the
expected header.

With this change, minadbd no longer needs to include bootable/recovery.

Test: mmma -j bootable/recovery
Change-Id: I69b888ceb160a33a67d79c5bda208dc17ad6ed86

3 years agominadbd: Move to Soong.
Tao Bao [Wed, 15 Nov 2017 19:45:23 +0000 (11:45 -0800)]
minadbd: Move to Soong.

Test: mmma -j bootable/recovery
Change-Id: Ic4cd676a842f0e8c4735cc6731fcbf13b844510c

3 years agoMerge "Add a singleton CacheLocation to replace the hard coded locations" android-p-preview-1
Tianjie Xu [Thu, 1 Mar 2018 18:36:05 +0000 (18:36 +0000)]
Merge "Add a singleton CacheLocation to replace the hard coded locations"

3 years agoAdd a singleton CacheLocation to replace the hard coded locations
Tianjie Xu [Tue, 27 Feb 2018 23:56:11 +0000 (15:56 -0800)]
Add a singleton CacheLocation to replace the hard coded locations

This class allows us to set the following locations dynamically:
cache_temp_source, last_command_file, stash_directory_base.

In the updater's main function, we reset the values of these variables
to their default locations in /cache; while we can set them to temp
files in unit tests or host simulation.

Test: unit tests pass
Change-Id: I528652650caa41373617ab055d41b1f1a4ec0f87

3 years agoMerge "Fix the behavior of undefined commands in BlockImageVerify"
Tianjie Xu [Wed, 28 Feb 2018 18:49:56 +0000 (18:49 +0000)]
Merge "Fix the behavior of undefined commands in BlockImageVerify"

3 years agoFix the behavior of undefined commands in BlockImageVerify
Tianjie Xu [Wed, 28 Feb 2018 01:05:39 +0000 (17:05 -0800)]
Fix the behavior of undefined commands in BlockImageVerify

In BlockImageVerify some commands are undefined, e.g. "erase", "new",
"zero". And we should not error out if the corresponding function
pointer of these commands is null; otherwise we will fail the
verification.

The old code is:
if (cmd->f != nullptr && cmd->f(params) == -1)
  return false;

In the last_command_file change the logic was wrongly modified to
if (cmd->f == nullptr)
  return false;
...
if (cmd->f(params) == -1)
  return false;

Test: sideload an incremental OTA twice on bullhead
Change-Id: I2561c365badb850da0e416629ccd61f0df7da5d7

3 years agoMerge "Remove the assumption of target chunk size in imgdiff"
Treehugger Robot [Fri, 23 Feb 2018 21:12:39 +0000 (21:12 +0000)]
Merge "Remove the assumption of target chunk size in imgdiff"

3 years agoRemove the assumption of target chunk size in imgdiff
Tianjie Xu [Thu, 22 Feb 2018 23:40:39 +0000 (15:40 -0800)]
Remove the assumption of target chunk size in imgdiff

In the split mode of imgdiff, we used to assume that the size of a split
target chunk is always greater than the blocksize i.e. 4096. This may
lead to the following assertion failure:
I0221 04:57:33.451323 818464 common.py:205 imgdiff F 02-21 04:57:33 821203 821203 imgdiff.cpp:999]
Check failed: tgt_size >= BLOCK_SIZE (tgt_size=476, BLOCK_SIZE=4096)

This CL removes the assumption and handles the edge cases.

Test: generate and verify the incremental update for TFs in the bug; unit test passes

Bug: 73757557
Bug: 73711365
Change-Id: Iadbb4ee658995f5856cd488f3793980881a59620

3 years agoMerge "Replace vfork() with fork()."
Treehugger Robot [Fri, 23 Feb 2018 17:04:34 +0000 (17:04 +0000)]
Merge "Replace vfork() with fork()."

3 years agoReplace vfork() with fork().
George Burgess IV [Sun, 18 Feb 2018 01:48:45 +0000 (17:48 -0800)]
Replace vfork() with fork().

The static analyzer complained about the function calls we were doing
here to vector::data() and vector::operator[]:
bootable/recovery/roots.cpp:193:11: warning: This function call is
prohibited after a successful vfork

Since it's not clear that vfork() is needed here, just use fork()
instead.

Bug: None
Test: Reran the static analyzer with only this patch applied. Bug
disappeared
Change-Id: I580f8243a21899f1e1678c8aee6948dfa7f69a1d

3 years agoMerge "Set LOCAL_SDK_VERSION where possible."
hansson [Wed, 21 Feb 2018 17:20:44 +0000 (17:20 +0000)]
Merge "Set LOCAL_SDK_VERSION where possible."

3 years agoSet LOCAL_SDK_VERSION where possible.
Anton Hansson [Wed, 21 Feb 2018 14:11:02 +0000 (14:11 +0000)]
Set LOCAL_SDK_VERSION where possible.

This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Change-Id: I82fee834c5d92e699e9571933faded11c6d4596e

3 years agoMerge "Disable building libapplypatch on mac"
Treehugger Robot [Sun, 18 Feb 2018 08:15:13 +0000 (08:15 +0000)]
Merge "Disable building libapplypatch on mac"

3 years agoDisable building libapplypatch on mac
Tianjie Xu [Sun, 18 Feb 2018 05:58:54 +0000 (21:58 -0800)]
Disable building libapplypatch on mac

The sdk_mac on build server fails with the error:
bootable/recovery/applypatch/freecache.cpp:23:10: fatal error: 'sys/statfs.h' file not found

So we will disable libapplypatch on mac.

Test: the library still builds on linux; and check the other host targets in the same cl.
Change-Id: Ie4a30708726e51c810f7ad7f1085d38154076cca

3 years agoMerge "Skip the cache size check on host"
Tianjie Xu [Sat, 17 Feb 2018 00:15:19 +0000 (00:15 +0000)]
Merge "Skip the cache size check on host"

3 years agoMerge "recovery: Porting screensave mode for new platform."
Tao Bao [Fri, 16 Feb 2018 05:07:57 +0000 (05:07 +0000)]
Merge "recovery: Porting screensave mode for new platform."

3 years agoMerge "Reorder the functions in updater/install.cpp"
Tianjie Xu [Tue, 13 Feb 2018 05:32:10 +0000 (05:32 +0000)]
Merge "Reorder the functions in updater/install.cpp"

3 years agoSkip the cache size check on host
Tianjie Xu [Sun, 4 Feb 2018 01:20:56 +0000 (17:20 -0800)]
Skip the cache size check on host

When running the update simulation, we choose to skip the cache size
check for now due to the lack of "/cache" on host. And in later cls we
can implement a cache size estimator to make the check more constrained.

Also build the host version of support libraries.

Test: unit test pass
Change-Id: I3ed93c857fd02f7b62f5baba9130f75c3236e717

3 years agoReorder the functions in updater/install.cpp
Tianjie Xu [Sat, 3 Feb 2018 00:49:15 +0000 (16:49 -0800)]
Reorder the functions in updater/install.cpp

There is no logical change to the file; merely the function definition
reorder and some comestic change to make the future review easier.

Test: mma
Change-Id: I7ffe952f8c78e840f10aa6bfad0c4b5a58e29896

3 years agoMerge "Log the last command to cache"
Tianjie Xu [Thu, 8 Feb 2018 19:53:37 +0000 (19:53 +0000)]
Merge "Log the last command to cache"

3 years agoMerge "Document instructions for using adb under recovery."
Treehugger Robot [Thu, 8 Feb 2018 19:20:57 +0000 (19:20 +0000)]
Merge "Document instructions for using adb under recovery."

3 years agoDocument instructions for using adb under recovery.
Tao Bao [Wed, 7 Feb 2018 17:15:36 +0000 (09:15 -0800)]
Document instructions for using adb under recovery.

Fixes: 72740736
Test: N/A
Change-Id: Ifc96ed785fd80501bc6c276cb649c8cc1f05be0e

3 years agoLog the last command to cache
Tianjie Xu [Tue, 5 Dec 2017 19:04:17 +0000 (11:04 -0800)]
Log the last command to cache

When performing an update, save the index and cmdline of the current
command into the last command file if this command writes to the stash
either explicitly of implicitly. This mitigates the overhead to update
the last command file for every command. I ran a simple test on angler
and the time to update 1000 times is ~2.3 seconds.

Upon resuming an update, read the saved index first; then
  1. In verification mode, check if all commands before the saved index
     have already produced the expected target blocks. If not, delete the
     last command file so that we will later resume the update from the
     start of the transfer list.
  2. In update mode, skip all commands before the saved index. Therefore,
     we can avoid deleting stashes with duplicate id unintentionally;
     and also speed up the update.

If an update succeeds or is unresumable, delete the last command file.
Bug: 69858743
Test: Unittest passed, apply a failed update with invalid cmd on angler
and check the last_command content, apply a failed update with invalid
source hash and last_command is deleted.
Change-Id: Ib60ba1e3c6d111d9f33097759b17dbcef97a37bf

3 years agoMerge "Avoid overwrite of the error message in AbortFn"
Tianjie Xu [Tue, 30 Jan 2018 21:44:02 +0000 (21:44 +0000)]
Merge "Avoid overwrite of the error message in AbortFn"

3 years agoAvoid overwrite of the error message in AbortFn
Tianjie Xu [Sun, 28 Jan 2018 23:37:48 +0000 (15:37 -0800)]
Avoid overwrite of the error message in AbortFn

The AbortFn() used to overwrite the error message, hiding the real
failure reported in ErrorAbort(). And we will miss the failure in
the script patterns like 'blockimageupdate() || abort()'

We will ensure there's one line break at the end of ErrorAbort's
error message; and append to the existing error message when calling
abort().

Test: Message from ErrorAbort shows up in the log
Change-Id: I3aebd06629c5129330250c7fe5e8cdead2ae85bc

3 years agoMerge "Add update_channel field to bootloader_message_ab."
Sen Jiang [Fri, 26 Jan 2018 00:48:09 +0000 (00:48 +0000)]
Merge "Add update_channel field to bootloader_message_ab."

3 years agoAdd update_channel field to bootloader_message_ab.
Sen Jiang [Mon, 22 Jan 2018 23:01:48 +0000 (15:01 -0800)]
Add update_channel field to bootloader_message_ab.

The update_channel field is used to store the Omaha update channel
if update_engine is compiled with Omaha support.

We need it to be in misc to persist through factory reset.

Bug: 72332119
Test: mma
Change-Id: Ied4fecc6e78cc69d33a36ba4d101d675100f9d82

3 years agoMerge "StartsWith allows a std::string prefix now." android-wear-8.0.0_r1
Treehugger Robot [Thu, 21 Dec 2017 02:11:08 +0000 (02:11 +0000)]
Merge "StartsWith allows a std::string prefix now."

3 years agoStartsWith allows a std::string prefix now.
Elliott Hughes [Wed, 20 Dec 2017 20:36:31 +0000 (12:36 -0800)]
StartsWith allows a std::string prefix now.

Bug: N/A
Test: builds
Change-Id: I5183ec8133f5dc9a81a438223c6d3d2ea11ef0ec

3 years agorecovery: Porting screensave mode for new platform.
katao [Fri, 8 Dec 2017 03:02:43 +0000 (11:02 +0800)]
recovery: Porting screensave mode for new platform.

On new board platform the brightness path of
sys/class/leds/lcd-backlight is deprecated,instead of
/sys/class/backlight/panel0-backlight/.

Test: reboot into recovery on sdm845.
Change-Id: Idf0027ab888f9f982a8eef7de230ce3635e7c300
Signed-off-by: katao <katao@xiaomi.com>
3 years agoMerge "Let update_verifier work on non-AB update devices"
Isaac Chen [Thu, 14 Dec 2017 04:18:41 +0000 (04:18 +0000)]
Merge "Let update_verifier work on non-AB update devices"

3 years agoLet update_verifier work on non-AB update devices
Isaac Chen [Wed, 13 Dec 2017 09:27:12 +0000 (17:27 +0800)]
Let update_verifier work on non-AB update devices

Make update_verifier check if it runs on A/B update devices at the
beginning, and quit immediately if it doesn't, instead of re-boot.

Bug: 70541023
Test: On aosp/master:
    $ lunch aosp_x86_64-userdebug; m -j # boot to home screen
    # On goog/master:
    $ lunch aosp_walleye-userdebug; m -j # boot to home screen

Change-Id: Ib71a3a3b272cfa5dd0b479eaa067eedaec8fde7d

3 years agoMerge "applypatch: Remove the 'st' field from FileContents."
Tao Bao [Sat, 9 Dec 2017 17:27:39 +0000 (17:27 +0000)]
Merge "applypatch: Remove the 'st' field from FileContents."

3 years agoMerge "add sload.f2fs for recovery format"
Jaegeuk Kim [Fri, 8 Dec 2017 00:57:41 +0000 (00:57 +0000)]
Merge "add sload.f2fs for recovery format"

3 years agoapplypatch: Remove the 'st' field from FileContents.
Tao Bao [Fri, 1 Dec 2017 18:53:34 +0000 (10:53 -0800)]
applypatch: Remove the 'st' field from FileContents.

It used to keep track of the stat(2) info (e.g. st_mode/st_gid/st_uid)
while patching a file in file-based OTA.

Test: Build and use the new updater to apply an update on bullhead.
Change-Id: Ibf8f0f4b14298a9489bf24a2678bb279c5d9c8f3

3 years agoMerge "Add a /bin symlink for consistency."
Elliott Hughes [Thu, 7 Dec 2017 16:55:25 +0000 (16:55 +0000)]
Merge "Add a /bin symlink for consistency."

3 years agoAdd a /bin symlink for consistency.
Elliott Hughes [Wed, 6 Dec 2017 16:41:50 +0000 (08:41 -0800)]
Add a /bin symlink for consistency.

Bug: http://b/63142920
Test: builds
Change-Id: I1f96935daca4d79f753e172067e07f8e27ea819e

3 years agoadd sload.f2fs for recovery format
Jaegeuk Kim [Wed, 29 Nov 2017 03:48:05 +0000 (19:48 -0800)]
add sload.f2fs for recovery format

Change-Id: Iddfe54b2b36f2d531925cbe61c98dbfb4903c0d1
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
3 years agoMerge "Detect interrupted update due to power off"
Tianjie Xu [Fri, 1 Dec 2017 02:58:41 +0000 (02:58 +0000)]
Merge "Detect interrupted update due to power off"
am: d8fadfb606

Change-Id: I2295430f7153711fb4e23d3e6f7af7c65efb7c54

3 years agoMerge "Detect interrupted update due to power off"
Treehugger Robot [Fri, 1 Dec 2017 02:52:23 +0000 (02:52 +0000)]
Merge "Detect interrupted update due to power off"

3 years agoDetect interrupted update due to power off
Tianjie Xu [Wed, 29 Nov 2017 01:23:06 +0000 (17:23 -0800)]
Detect interrupted update due to power off

An interrupted update may stash extra blocks in /cache, leading to a
failure when checking the cache size. We can save the incremented
retry_count in the BCB before installing the update; and distinguish
a fresh update from an interrupted one this way.

Bug: 68679601
Test: An interrupted update reapplies successfully.
Change-Id: Ic1403e1fd25a937c91ef34c14b92a0f6c8f1c0f4

3 years agoMerge "root: Fix an issue when volume length from fs_mgr is negative."
Jin Qian [Mon, 20 Nov 2017 18:52:48 +0000 (18:52 +0000)]
Merge "root: Fix an issue when volume length from fs_mgr is negative."
am: 5ce9fe355c

Change-Id: I4ff7bccb0dd2fecf309f3a3d23379d2467d64aea

3 years agoMerge "root: Fix an issue when volume length from fs_mgr is negative." android-o-mr1-iot-preview-6
Treehugger Robot [Mon, 20 Nov 2017 18:47:56 +0000 (18:47 +0000)]
Merge "root: Fix an issue when volume length from fs_mgr is negative."

3 years agoroot: Fix an issue when volume length from fs_mgr is negative.
Jin Qian [Sat, 18 Nov 2017 07:53:22 +0000 (23:53 -0800)]
root: Fix an issue when volume length from fs_mgr is negative.

fs_mgr passes negative length as offset for crypt_footer. We need
to compute the actual device size for this case in addition to
when length is zero.

Bug: 68949069
Change-Id: I803955dd9591ad7752cee0dea9b683be8f4fd4ba

3 years agoMerge "Add libbrotli as a dependency when building applypatch binary"
Tianjie Xu [Fri, 17 Nov 2017 16:13:13 +0000 (16:13 +0000)]
Merge "Add libbrotli as a dependency when building applypatch binary"
am: c7069cc922

Change-Id: I3379f84048c1b4c4858da537d045a1012c358b8b

3 years agoMerge "Add libbrotli as a dependency when building applypatch binary"
Tianjie Xu [Fri, 17 Nov 2017 16:09:08 +0000 (16:09 +0000)]
Merge "Add libbrotli as a dependency when building applypatch binary"

3 years agoMerge "Switch imgdiff to libbase logging"
Tianjie Xu [Fri, 17 Nov 2017 05:56:10 +0000 (05:56 +0000)]
Merge "Switch imgdiff to libbase logging"
am: fd9c25e636

Change-Id: Iaf36238df9567f9e0e08abec2581e55d4692068b

3 years agoMerge "Switch imgdiff to libbase logging"
Tianjie Xu [Fri, 17 Nov 2017 05:53:58 +0000 (05:53 +0000)]
Merge "Switch imgdiff to libbase logging"

3 years agoSwitch imgdiff to libbase logging
Tianjie Xu [Thu, 16 Nov 2017 00:26:41 +0000 (16:26 -0800)]
Switch imgdiff to libbase logging

Also add a verbose option. And we won't print messages of 'info'
severity unless '-v' is present.

Test: run imgdiff and check the logs.
Change-Id: I1b90874baea8e72e2a2323a0b63bc5d35e653e6b

3 years agoMerge "minadbd: Remove two warning options."
Tao Bao [Wed, 15 Nov 2017 23:04:09 +0000 (23:04 +0000)]
Merge "minadbd: Remove two warning options."
am: 7bd61f0cc0

Change-Id: Id5e986ecd00cb2b953d761957a987a1b0c5ebf20

3 years agoMerge "minadbd: Remove two warning options."
Tao Bao [Wed, 15 Nov 2017 22:59:40 +0000 (22:59 +0000)]
Merge "minadbd: Remove two warning options."

3 years agominadbd: Remove two warning options.
Tao Bao [Wed, 15 Nov 2017 19:26:06 +0000 (11:26 -0800)]
minadbd: Remove two warning options.

'-Wimplicit-function-declaration' is not needed (it's for C89) and
already enabled by -Wall.

For '-Wno-missing-field-initializers', don't see any existing case that
requires the flag.

Test: `mmma -j bootable/recovery` on aosp_{bullhead,marlin}-userdebug.
Change-Id: I46604723087ed9a7747f6cae31a95fc0074c6758

3 years agoMerge "recovery: format f2fs with encrypt/quota"
Jaegeuk Kim [Tue, 14 Nov 2017 02:45:25 +0000 (02:45 +0000)]
Merge "recovery: format f2fs with encrypt/quota"
am: d4b6e25fdd

Change-Id: I1d17a488d2eea4d858fa31e7a00d694e20b011b3

3 years agoMerge "recovery: format f2fs with encrypt/quota"
Treehugger Robot [Tue, 14 Nov 2017 01:49:26 +0000 (01:49 +0000)]
Merge "recovery: format f2fs with encrypt/quota"

3 years agorecovery: format f2fs with encrypt/quota
Jaegeuk Kim [Wed, 1 Nov 2017 20:24:43 +0000 (13:24 -0700)]
recovery: format f2fs with encrypt/quota

Change-Id: Ia393b7b78b45f09964449ec0e255aa26bb3b8ddf
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
3 years agoMerge "applypatch: Change the patch parameter to const Value& in Apply{BSDiff,Image...
Tao Bao [Sat, 11 Nov 2017 01:18:04 +0000 (01:18 +0000)]
Merge "applypatch: Change the patch parameter to const Value& in Apply{BSDiff,Image}Patch."
am: de07371b03

Change-Id: I2261486420f8e55cfbdd61f130be24f6e4deebf4

3 years agoMerge "applypatch: Change the patch parameter to const Value& in Apply{BSDiff,Image...
Tao Bao [Sat, 11 Nov 2017 01:09:47 +0000 (01:09 +0000)]
Merge "applypatch: Change the patch parameter to const Value& in Apply{BSDiff,Image}Patch."

3 years agoapplypatch: Change the patch parameter to const Value& in Apply{BSDiff,Image}Patch.
Tao Bao [Fri, 10 Nov 2017 19:49:53 +0000 (11:49 -0800)]
applypatch: Change the patch parameter to const Value& in Apply{BSDiff,Image}Patch.

It used to be "const Value*", but nullptr won't be a valid input.

Test: recovery_host_test; recovery_component_test
Change-Id: I904b5689ac3e64504088bf0544c9fb5d45a52243

3 years agoMerge "Include bspatch.h from bsdiff/"
Alex Deymo [Fri, 10 Nov 2017 09:57:04 +0000 (09:57 +0000)]
Merge "Include bspatch.h from bsdiff/"
am: 29cd3215ec

Change-Id: Ib53e96bee59300c4f94bf5de1801d4482a5abe3c

3 years agoMerge "Include bspatch.h from bsdiff/"
Alex Deymo [Fri, 10 Nov 2017 09:54:11 +0000 (09:54 +0000)]
Merge "Include bspatch.h from bsdiff/"

3 years agoMerge "uncrypt: Move to Soong."
Tao Bao [Thu, 9 Nov 2017 23:29:04 +0000 (23:29 +0000)]
Merge "uncrypt: Move to Soong."
am: 992bccfef4

Change-Id: If87cf6f7e32eb8089ec72207222eb5ec0b22adac

3 years agoMerge "uncrypt: Move to Soong."
Tao Bao [Thu, 9 Nov 2017 23:09:33 +0000 (23:09 +0000)]
Merge "uncrypt: Move to Soong."

3 years agoMerge "Load-balancing update_verifier worker threads."
Tao Bao [Thu, 9 Nov 2017 20:35:38 +0000 (20:35 +0000)]
Merge "Load-balancing update_verifier worker threads."
am: f1e70b93f1

Change-Id: Ia1224ef69a80ebd247943c2f010bc7cee00e3f69

3 years agouncrypt: Move to Soong.
Tao Bao [Fri, 29 Sep 2017 21:06:20 +0000 (14:06 -0700)]
uncrypt: Move to Soong.

Test: mmma -j bootable/recovery
Change-Id: I405f2a70f51904c02c49a287c23cbc115a4c5132

3 years agoMerge "Load-balancing update_verifier worker threads."
Treehugger Robot [Thu, 9 Nov 2017 20:14:08 +0000 (20:14 +0000)]
Merge "Load-balancing update_verifier worker threads."

3 years agoLoad-balancing update_verifier worker threads.
Tao Bao [Sat, 4 Nov 2017 07:08:08 +0000 (00:08 -0700)]
Load-balancing update_verifier worker threads.

Prior to this CL, the block verification works were assigned based on
the pattern of the ranges, which could lead to unbalanced workloads. This
CL adds RangeSet::Split() and moves update_verifier over.

a) For the following care_map.txt on walleye:
system
20,0,347,348,540,556,32770,33084,98306,98620,163842,164156,229378,229692,294914,295228,524289,524291,524292,524348,529059
vendor
8,0,120,135,32770,32831,94564,98304,98306

Measured the time costs prior to and with this CL with the following
script.

$ cat test_update_verifier.sh
  #!/bin/sh

  adb shell stop
  adb shell "cp /data/local/tmp/care_map.txt /data/ota_package/"
  for i in $(seq 1 50)
  do
    echo "Iteration: $i"
    adb shell "bootctl set-active-boot-slot 0"
    adb shell "echo 3 > /proc/sys/vm/drop_caches"
    adb shell "time /data/local/tmp/update_verifier"
    sleep 3
  done

Without this CL, the average time cost is 5.66s, while with the CL it's
reduced to 3.2s.

b) For the following care_map.txt, measured the performance on marlin:
system
18,0,271,286,457,8350,32770,33022,98306,98558,163842,164094,196609,204800,229378,229630,294914,295166,501547
vendor
10,0,42,44,85,2408,32770,32806,32807,36902,74242

It takes 12.9s and 5.6s without and with the CL respectively.

Fixes: 68553827
Test: recovery_unit_test
Test: Flash new build and trigger update_verifier. Check the balanced
      block verification.
Change-Id: I5fa4bf09a84e6b9b0975ee5f522724464181333f

3 years agoInclude bspatch.h from bsdiff/
Alex Deymo [Wed, 8 Nov 2017 11:26:44 +0000 (12:26 +0100)]
Include bspatch.h from bsdiff/

The function ApplyBSDiffPatch() defined in bspatch.cpp is declared in
applypatch.h, but it includes "bspatch.h" from the bsdiff/ project,
which is at least confusing. There is no "bspatch.h" in this repo, so
the include actually reffers to the one in bsdiff. This patch uses the
"bsdiff/bspatch.h" form instead to avoid confusion.

Bug: None
Test: It builds.

Change-Id: I6b6ffd6725b2b34ff644aed93683f69779103661

3 years agoMerge "otautil: Remove the aborts in RangeSet::Parse()."
Tao Bao [Wed, 8 Nov 2017 02:07:46 +0000 (02:07 +0000)]
Merge "otautil: Remove the aborts in RangeSet::Parse()."
am: 16b8b8fd1c

Change-Id: Ib3b934d2ef5db25786016896868e021d7e087d4d

3 years agoMerge "otautil: Remove the aborts in RangeSet::Parse()."
Tao Bao [Wed, 8 Nov 2017 01:51:17 +0000 (01:51 +0000)]
Merge "otautil: Remove the aborts in RangeSet::Parse()."

3 years agootautil: Remove the aborts in RangeSet::Parse().
Tao Bao [Sat, 4 Nov 2017 07:08:08 +0000 (00:08 -0700)]
otautil: Remove the aborts in RangeSet::Parse().

We used to CHECK and abort on parsing errors. While it works fine for
the updater use case (because recovery starts updater in a forked
process and collects the process exit code), it's difficult for other
clients to use RangeSet as a library (e.g. update_verifier).

This CL switches the aborts to returning empty RangeSet instead. Callers
need to check the parsing results explicitly.

The CL also separates RangeSet::PushBack() into a function, and moves
SortedRangeSet::Clear() into RangeSet.

Test: recovery_unit_test
Test: Sideload an OTA package with the new updater on angler.
Test: Sideload an OTA package with injected range string errors. The
      updater aborts from the explicit checks.
Change-Id: If2b7f6f41dc93af917a21c7877a83e98dc3fd016

3 years agoMerge "Switch to bionic gtest in bootable/recovery"
Tianjie Xu [Mon, 6 Nov 2017 19:02:01 +0000 (19:02 +0000)]
Merge "Switch to bionic gtest in bootable/recovery"
am: bf41f2aa23

Change-Id: I90238f94c3f3eeafe3f24d417f7f6c66ac3cf5fd

3 years agoMerge "Switch to bionic gtest in bootable/recovery"
Tianjie Xu [Mon, 6 Nov 2017 18:56:27 +0000 (18:56 +0000)]
Merge "Switch to bionic gtest in bootable/recovery"

3 years agoMerge "Clean up fuse_sideload and add a testcase."
Tao Bao [Sat, 4 Nov 2017 14:31:55 +0000 (14:31 +0000)]
Merge "Clean up fuse_sideload and add a testcase."
am: 73dca3e983

Change-Id: I1d895338f32c5814c22f7134aee579c2a252e8bb

3 years agoMerge "Clean up fuse_sideload and add a testcase."
Tao Bao [Sat, 4 Nov 2017 14:27:48 +0000 (14:27 +0000)]
Merge "Clean up fuse_sideload and add a testcase."

3 years agoClean up fuse_sideload and add a testcase.
Tao Bao [Mon, 1 May 2017 22:57:38 +0000 (15:57 -0700)]
Clean up fuse_sideload and add a testcase.

This CL mainly changes:
a) moving the interface in struct provider_vtab to std::function;
b) code cleanup, such as moving the declaration closer to the uses,
   using explicit type conversion.

Test: recovery_component_test
Test: minadbd_test
Test: Sideload a package on marlin.
Change-Id: Id0e3c70f1ada54a4cd985b54c84438c23ed4687e

3 years agoMerge "recovery: remove make_ext4fs from updater"
Jin Qian [Fri, 3 Nov 2017 23:22:23 +0000 (23:22 +0000)]
Merge "recovery: remove make_ext4fs from updater"
am: 3f06512714

Change-Id: Iaccf79dfa4fc7b85071567cd0d58d294478ea0f3

3 years agoMerge "recovery: remove make_ext4fs from updater"
Treehugger Robot [Fri, 3 Nov 2017 23:18:25 +0000 (23:18 +0000)]
Merge "recovery: remove make_ext4fs from updater"

3 years agoAdd libbrotli as a dependency when building applypatch binary
Tianjie Xu [Fri, 3 Nov 2017 22:52:22 +0000 (15:52 -0700)]
Add libbrotli as a dependency when building applypatch binary

libbrotli is now used in libbspatch.

Bug: 34220646
Test: mma
Change-Id: I8d3527141539ffdae112d9042355fd705caeb250

3 years agoMerge "recovery: fix library dependency"
Jin Qian [Fri, 3 Nov 2017 22:29:20 +0000 (22:29 +0000)]
Merge "recovery: fix library dependency"
am: 0da645fefa

Change-Id: If42448e311abde44b730f31e8ec779e4fe660ca3

3 years agoMerge "recovery: fix library dependency"
Treehugger Robot [Fri, 3 Nov 2017 22:16:55 +0000 (22:16 +0000)]
Merge "recovery: fix library dependency"

3 years agoSwitch to bionic gtest in bootable/recovery
Tianjie Xu [Wed, 25 Oct 2017 20:16:54 +0000 (13:16 -0700)]
Switch to bionic gtest in bootable/recovery

We encountered segfaults in Imgdiff host tests due to the failure to
reset states of getopt. The problem can be solved by switching to use
bionic's gtest where a new process is forked for each test.

Also modify the recovery_component_test to make sure it runs in parallel.
Changes include:
  1. Merge the writes to misc partition into one single test.
  2. Change the hard coded location "/cache/saved.file" into a configurable
  variable.

Bug: 67849209
Test: recovery tests pass

Change-Id: I165d313f32b83393fb7922c5078636ac40b50bc2

3 years agorecovery: remove make_ext4fs from updater
Jin Qian [Thu, 2 Nov 2017 18:58:12 +0000 (11:58 -0700)]
recovery: remove make_ext4fs from updater

Bug: 64395169
Change-Id: I6f6a4f82b225435c6ad5c828e110fa135e6f7579

3 years agorecovery: fix library dependency
Jin Qian [Fri, 3 Nov 2017 18:52:33 +0000 (11:52 -0700)]
recovery: fix library dependency

After removing some deadcode from libext4_utils, libz is optimized
out by linker. However, it's still required by libvintf. Moving libz
down the list fixed the build.

Bug: 64395169
Change-Id: I23ecd70c83af83a219faced59d8227dc3c4e43d5

3 years agoMerge "tests: Clean up the files in TemporaryDir."
Tao Bao [Fri, 3 Nov 2017 18:57:36 +0000 (18:57 +0000)]
Merge "tests: Clean up the files in TemporaryDir."
am: 2cf44d08cf

Change-Id: I37a43d8454caebc18e2916afffbe8b894cd5374e

3 years agoMerge "tests: Clean up the files in TemporaryDir."
Treehugger Robot [Fri, 3 Nov 2017 18:51:34 +0000 (18:51 +0000)]
Merge "tests: Clean up the files in TemporaryDir."

3 years agoMerge "Add a repohook to clang-format changes."
Tao Bao [Fri, 3 Nov 2017 03:31:14 +0000 (03:31 +0000)]
Merge "Add a repohook to clang-format changes."
am: 439263cb83

Change-Id: I954d3514875799af055eedd6fe5b536827f2ef12

3 years agoMerge "Add a repohook to clang-format changes."
Tao Bao [Fri, 3 Nov 2017 03:27:15 +0000 (03:27 +0000)]
Merge "Add a repohook to clang-format changes."

3 years agoAdd a repohook to clang-format changes.
Tao Bao [Tue, 26 Sep 2017 22:37:59 +0000 (15:37 -0700)]
Add a repohook to clang-format changes.

It would clang-format according to the local style file in
.clang-format, unless explicitly skipped with --no-verify.

An example output is as follows:

[COMMIT dda6b1ee4247] test
[FAILED] clang_format
    The following files have formatting errors:
        screen_ui.cpp
    You can run `/mnt/aosp/aosp-master/tools/repohooks/tools/clang-format.py --fix --clang-format /mnt/aosp/aosp-master/prebuilts/clang/host/linux-x86/clang-stable/bin/clang-format --git-clang-format /mnt/aosp/aosp-master/prebuilts/clang/host/linux-x86/clang-stable/bin/git-clang-format --style file --commit dda6b1ee424710760bbab4421e95239fa6a2b40d` to fix this
[COMMIT be69a2c4ba16] Add a repohook to clang-format the change.
[RUNNING 2/2] clang_format
An automatic fix can be attempted for the "clang_format" hook. Do you want to run it? (Yes/no)?
Fix successfully applied. Amend the current commit before attempting to upload again.

More details about repohooks can be found at:

  https://android.googlesource.com/platform/tools/repohooks/

Test: `repo upload` a CL.
Change-Id: Ie8203a317eb3be7acd5592e03374873997647aa0

3 years agoMerge commit '04bcf3ee761d8648d0247dd8322e3542c0319464' from
Xin Li [Thu, 2 Nov 2017 22:49:26 +0000 (15:49 -0700)]
Merge commit '04bcf3ee761d8648d0247dd8322e3542c0319464' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: Ie321cc4ce4a2324ca7bf0f3493f23ea7999765b8

3 years agoMerge "Add libbrotli as a dependency for libbsdiff"
Tianjie Xu [Thu, 2 Nov 2017 17:54:37 +0000 (17:54 +0000)]
Merge "Add libbrotli as a dependency for libbsdiff"
am: 43f194c8bc

Change-Id: Ia4dbce188995448384a94be87a3020f5ca033365