Commit Graph

5488 Commits

Author SHA1 Message Date
Tao Bao 20d9c8ea5a Merge "tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test."
am: 3537a2659e

Change-Id: I34a71d1a294bad5dd110be63a9d5a0cf746c8491
2018-03-13 16:02:47 +00:00
Treehugger Robot 3537a2659e Merge "tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test." 2018-03-13 15:48:33 +00:00
Tao Bao d612b23dfd 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
2018-03-12 21:21:41 -07:00
Yifan Hong da5bb13507 Merge "recovery: add libhidl-gen-utils depedency"
am: fc39f3ffd7

Change-Id: I059487aa0a6e1d569bb59f088670082987dc1fb6
2018-03-12 21:07:58 +00:00
Yifan Hong fc39f3ffd7 Merge "recovery: add libhidl-gen-utils depedency" 2018-03-12 20:50:25 +00:00
Tianjie Xu 7120c687a5 Merge "Set the update locations to default in CacheLocation's constructor"
am: 0acbdac82b

Change-Id: I2303237cc57446624b265f8fedad285105292a64
2018-03-09 04:43:51 +00:00
Tianjie Xu 0acbdac82b Merge "Set the update locations to default in CacheLocation's constructor" 2018-03-09 04:17:30 +00:00
Tianjie Xu b4e3a370bf 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
2018-03-08 14:24:02 -08:00
Yifan Hong 495c521ed3 recovery: add libhidl-gen-utils depedency
introduced as a depedency to libvintf.

Test: builds
Bug: 73556059
Change-Id: Ia51ba81ef462879481dcacb80d9ea9ea35e8b0bb
2018-03-07 18:35:15 -08:00
Tao Bao 9b0c133ff5 Merge "Export fuse_sideload.h for libfusesideload."
am: ddf93c0055

Change-Id: Iab8ed18018028ea936d48096751b007816fca08f
2018-03-07 22:17:43 +00:00
Treehugger Robot ddf93c0055 Merge "Export fuse_sideload.h for libfusesideload." 2018-03-07 22:05:54 +00:00
Tao Bao 2d62142fff Merge "Drop the no-op Android.bp."
am: 242d41b808

Change-Id: Id6c89984548aa261c4063f2cd1e90c2bc66f2074
2018-03-07 20:37:47 +00:00
Treehugger Robot 242d41b808 Merge "Drop the no-op Android.bp." 2018-03-07 20:17:06 +00:00
Tao Bao 734f76fc38 Merge "minadbd: Move to Soong."
am: 56160b2b03

Change-Id: I805ccc2c72bb1c391b4a72498283b911e826a547
2018-03-07 19:12:17 +00:00
Treehugger Robot 56160b2b03 Merge "minadbd: Move to Soong." 2018-03-07 18:56:50 +00:00
Tao Bao e8fdb1ab0b 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
2018-03-07 18:03:23 +00:00
Tao Bao 4b51c3ab40 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
2018-03-07 10:01:51 -08:00
Tao Bao 8c7761edec minadbd: Move to Soong.
Test: mmma -j bootable/recovery
Change-Id: Ic4cd676a842f0e8c4735cc6731fcbf13b844510c
2018-03-06 20:36:35 -08:00
Tianjie Xu a72f93d6da Merge "Add a singleton CacheLocation to replace the hard coded locations"
am: 47cd789eed

Change-Id: I11c265d3adebc338e0603ed00c7d1aaaffae0253
2018-03-01 18:45:52 +00:00
Tianjie Xu 47cd789eed Merge "Add a singleton CacheLocation to replace the hard coded locations" 2018-03-01 18:36:05 +00:00
Tianjie Xu 3bbb20f557 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
2018-02-28 11:19:11 -08:00
Tianjie Xu 7b9a92c1e2 Merge "Fix the behavior of undefined commands in BlockImageVerify"
am: ac4818d6af

Change-Id: I5e42bcafca4c42e6c30cef082c03ad2b8d18ac6c
2018-02-28 18:59:33 +00:00
Tianjie Xu ac4818d6af Merge "Fix the behavior of undefined commands in BlockImageVerify" 2018-02-28 18:49:56 +00:00
Tianjie Xu c242084539 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
2018-02-27 23:04:14 -08:00
Tianjie Xu a306d7bc55 Merge "Remove the assumption of target chunk size in imgdiff"
am: cc3446a7f7

Change-Id: Ic5d50e6c54dfd352950925d01448020669735056
2018-02-23 21:31:09 +00:00
Treehugger Robot cc3446a7f7 Merge "Remove the assumption of target chunk size in imgdiff" 2018-02-23 21:12:39 +00:00
Tianjie Xu 572abbb81c 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
2018-02-23 10:44:05 -08:00
George Burgess IV 44f2cb2d67 Merge "Replace vfork() with fork()."
am: 21b381622d

Change-Id: Ia06201cedfcca6358f6f65face5325a4cf528f72
2018-02-23 17:24:51 +00:00
Treehugger Robot 21b381622d Merge "Replace vfork() with fork()." 2018-02-23 17:04:34 +00:00
George Burgess IV 1cfb361129 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
2018-02-22 19:25:22 -08:00
hansson cd06b1696d Merge "Set LOCAL_SDK_VERSION where possible."
am: bf52b7e00b

Change-Id: I91a73e01b2a9b13923a551957da98a2eb9363dc9
2018-02-21 17:31:10 +00:00
hansson bf52b7e00b Merge "Set LOCAL_SDK_VERSION where possible." 2018-02-21 17:20:44 +00:00
Anton Hansson 6cc499ae07 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
2018-02-21 14:11:02 +00:00
Tianjie Xu 2754916f01 Merge "Disable building libapplypatch on mac"
am: c1e1d7e711

Change-Id: I333af93c0dc7cf8b2a175f6c42c5321f442bd115
2018-02-18 08:24:05 +00:00
Treehugger Robot c1e1d7e711 Merge "Disable building libapplypatch on mac" 2018-02-18 08:15:13 +00:00
Tianjie Xu 7a4dacf724 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
2018-02-17 22:06:31 -08:00
Tianjie Xu fb8496e3aa Merge "Skip the cache size check on host"
am: 31bcd7c002

Change-Id: If265166022cc36142e4cc6061f1165e9814e9482
2018-02-17 00:29:07 +00:00
Tianjie Xu 31bcd7c002 Merge "Skip the cache size check on host" 2018-02-17 00:15:19 +00:00
Tao Bao 470b4fef7f Merge "recovery: Porting screensave mode for new platform."
am: 15e376d792

Change-Id: I2537ea9b3b4a5560c79226450fcf236ec0935e9e
2018-02-16 05:15:40 +00:00
Tao Bao 15e376d792 Merge "recovery: Porting screensave mode for new platform." 2018-02-16 05:07:57 +00:00
Tianjie Xu 576d2754ee Merge "Reorder the functions in updater/install.cpp"
am: 9818283da7

Change-Id: I3451ff1641495a7a676d5ea3bea81ce38815fc2f
2018-02-13 06:48:24 +00:00
Tianjie Xu 9818283da7 Merge "Reorder the functions in updater/install.cpp" 2018-02-13 05:32:10 +00:00
Tianjie Xu e40c80d021 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
2018-02-12 15:19:37 -08:00
Tianjie Xu 5419ad31e7 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
2018-02-12 11:55:05 -08:00
Tianjie Xu 6d78bb5236 Merge "Log the last command to cache"
am: 6a3646fc03

Change-Id: I4e0e399b6140084cd681c5aba746d7b9dbe069d8
2018-02-08 20:06:35 +00:00
Tianjie Xu 6a3646fc03 Merge "Log the last command to cache" 2018-02-08 19:53:37 +00:00
Tao Bao 41186e13b7 Merge "Document instructions for using adb under recovery."
am: 7ee7e27400

Change-Id: Ia63a213baf4c1886379003220580e42cdc0f19c2
2018-02-08 19:36:32 +00:00
Treehugger Robot 7ee7e27400 Merge "Document instructions for using adb under recovery." 2018-02-08 19:20:57 +00:00
Tao Bao c84a4ef053 Document instructions for using adb under recovery.
Fixes: 72740736
Test: N/A
Change-Id: Ifc96ed785fd80501bc6c276cb649c8cc1f05be0e
2018-02-07 20:55:33 -08:00
Tianjie Xu 284752e2bc 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
2018-02-06 16:16:49 -08:00