Commit graph

3001 commits

Author SHA1 Message Date
Tao Bao
1033408801 Add tests for setup-bcb and clear-bcb via uncrypt.
Bug: http://b/33534933
Test: recovery_component_test passes (and fails on buggy build due to
      the CL in [1]).

[1]: commit 7e31f421a5

Change-Id: I120498048ec1db8f9fcbb3cf135c05d3a48cfcdf
2016-12-13 17:46:03 -08:00
Tao Bao
d6a5005fcb Merge "clang-format: Adjust short functions / if settings." 2016-12-13 18:13:56 +00:00
Tao Bao
c908f4f0e3 Merge "Revert "write_bootloader_message(<options>) should not reset stage field."" 2016-12-13 01:24:04 +00:00
Tao Bao
26d5ae741e Revert "write_bootloader_message(<options>) should not reset stage field."
This reverts commit 7e31f421a5.

Bug: 33534933
Change-Id: Ib173f6b1e36a79deafc3592785195693a6779471
2016-12-13 01:06:24 +00:00
Tao Bao
e65fa0a892 clang-format: Adjust short functions / if settings.
http://clang.llvm.org/docs/ClangFormatStyleOptions.html

AllowShortFunctionsOnASingleLine: Empty
  Empty functions like "int f() {}" can be put on a single line.

AllowShortIfStatementsOnASingleLine: true
  If true, "if (a) return;" can be put on a single line.

Test: N/A
Change-Id: Ia4f411a958235ab18d16972f2c9d0f55b645b4ba
2016-12-12 15:00:52 -08:00
Tao Bao
594dc4f5be Merge "recovery: Remove obsolete code that supports "CACHE:foo" format." 2016-12-10 20:50:16 +00:00
Tao Bao
f038ca00f4 recovery: Remove obsolete code that supports "CACHE:foo" format.
The passing of "--update_package=CACHE:foo" format has been removed
in Gingerbread, with commit 4baf641e7d96375eba3f9a3aff5400b9e3d28cd6
in frameworks/base (core/java/android/os/RecoverySystem.java).

Test: Recovery image with --update_package still works.
Change-Id: I37b56ccf98f62cadf2a3975bbc38b16fea6fe9a1
2016-12-10 09:29:16 -08:00
Tao Bao
f28afc191d Merge "write_bootloader_message(<options>) should not reset stage field." 2016-12-09 22:33:49 +00:00
Tao Bao
332af25b7c Merge "recovery: Fix the argument parsing from COMMAND_FILE." 2016-12-09 19:48:58 +00:00
Tao Bao
7d34fa17ab recovery: Fix the argument parsing from COMMAND_FILE.
Commit f0ed159f48 didn't ensure mounting
COMMAND_FILE (i.e. /cache) prior to reading. Also the first argument in
COMMAND_FILE should not be dropped (unlike the first "recovery" argument
in BCB message).

Bug: 33431888
Test: Push /cache/recovery/command and recovery imag parses the
      arguments successfully.

Change-Id: Ica3157a0bb03a2355315123354617eaf3fff15a4
2016-12-08 18:15:29 -08:00
Tao Bao
c3ab25c237 Merge "recovery: Clean up get_args()."
am: 3aadbbac39

Change-Id: I8dd8003433ae2a33da51d69c25fe1b51628c8f97
2016-12-05 23:35:16 +00:00
Tao Bao
7e31f421a5 write_bootloader_message(<options>) should not reset stage field.
Commit bd56f1590c switches to calling
write_bootloader_message(<options>) in get_args(), which
unintentionally resets the stage field thus breaks two-step OTAs.

This CL changes write_bootloader_message(<options>) to only set the
command field (to "boot-recovery") and the recovery field (with the
specified options).

Test: Apply a two-step package.
Change-Id: I6905918812c7d3402cc1524688079066a4d22d29
2016-12-05 15:31:52 -08:00
Tao Bao
3aadbbac39 Merge "recovery: Clean up get_args()." 2016-12-05 23:28:36 +00:00
Tao Bao
f0ed159f48 recovery: Clean up get_args().
Test: Boot into new recovery image, verify the parsed parameters.
Change-Id: Ieefafb26cc4147ce4cb9ced4297cdb3b5d1d3789
2016-12-05 11:39:46 -08:00
Tao Bao
1d9779b57b Merge "updater: Switch to libbase logging."
am: d2c56629ab

Change-Id: Iadb27da225c4b0c7c6bc80d177d36bdf87296a5b
2016-12-02 05:37:54 +00:00
Tao Bao
d2c56629ab Merge "updater: Switch to libbase logging." 2016-12-02 05:27:04 +00:00
Tao Bao
80cd188162 Merge "bootable/recovery: cleanup compiler warnings (unused value)"
am: ef3bea15b8

Change-Id: I401597b9d7bad8a13c98093019cd6ad915d325f3
2016-12-01 17:25:37 +00:00
Tao Bao
ef3bea15b8 Merge "bootable/recovery: cleanup compiler warnings (unused value)" 2016-12-01 17:03:13 +00:00
Tao Bao
039f2da3e4 updater: Switch to libbase logging.
Test: Build an updater into a package and apply it on device.
Change-Id: I289b5768e9b1e44ef78e0479c64dbaa36fb1a685
2016-11-30 23:44:41 -08:00
Tao Bao
be54feda58 Merge "bootable/recovery: cleanup compiler warnings (potential leak of memory)"
am: d255b661a1

Change-Id: I700b0591b9e67ff7932598da1e48c9fa793bb763
2016-11-30 21:30:01 +00:00
Tao Bao
d255b661a1 Merge "bootable/recovery: cleanup compiler warnings (potential leak of memory)" 2016-11-30 21:19:42 +00:00
Rahul Chaudhry
a793c58208 bootable/recovery: cleanup compiler warnings (unused value)
bootable/recovery/applypatch/imgdiff.cpp:322:11: warning: Value stored to 'ret' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
bootable/recovery/applypatch/imgdiff.cpp:447:11: warning: Value stored to 'ret' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
bootable/recovery/applypatch/imgdiff.cpp:553:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]

Bug: 26936282
Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mm
Change-Id: I3f865e3e9b9d19e5ea5e8dfd2fe2c644254ffbb5
2016-11-30 11:18:32 -08:00
Connor O'Brien
ae2463bb35 Merge "Switch update verifier to HIDL HAL"
am: 1528def46e

Change-Id: I77f12c0c865b04e191039de4b15482c02d5d5d9e
2016-11-30 19:12:14 +00:00
Connor O'Brien
1528def46e Merge "Switch update verifier to HIDL HAL" 2016-11-30 18:58:53 +00:00
Tao Bao
1f934beedd Merge "Remove ota_close(int) and ota_fclose(FILE*)."
am: 7b59b45b08

Change-Id: I5d325de48d99c8056bdf95381537ba6b938822f0
2016-11-29 17:59:10 +00:00
Tao Bao
7b59b45b08 Merge "Remove ota_close(int) and ota_fclose(FILE*)." 2016-11-29 17:55:11 +00:00
Tao Bao
839fbbdad3 Merge "Add ota_close(unique_fd&) and ota_fclose(std::unique_ptr<FILE>&)."
am: eed7f607cf

Change-Id: Ib570d0f548cc680e9c8f38c43573f71c52494ee9
2016-11-29 05:21:37 +00:00
Tao Bao
fcfdda98da Merge "tests: Add testcases for EMMC targets."
am: d226f28e87

Change-Id: Ifadb3608e4856e5b4075b717cdb9c21c04162548
2016-11-29 05:21:24 +00:00
Tao Bao
eed7f607cf Merge "Add ota_close(unique_fd&) and ota_fclose(std::unique_ptr<FILE>&)." 2016-11-29 05:15:18 +00:00
Tao Bao
d226f28e87 Merge "tests: Add testcases for EMMC targets." 2016-11-29 05:13:10 +00:00
Tao Bao
358c2ec1dc Remove ota_close(int) and ota_fclose(FILE*).
We should always use unique_fd or unique_file to hold the FD or FILE*
pointer when opening via ota_(f)open functions.

This CL avoids accidentally closing raw FDs or FILE* pointers that are
managed by unique_fd/unique_file.

Test: recovery_component_test passes.
Change-Id: If58eb8b5c5da507563f85efd5d56276472a1c957
2016-11-28 12:09:39 -08:00
Tao Bao
3dc14cb429 Add ota_close(unique_fd&) and ota_fclose(std::unique_ptr<FILE>&).
We were using the below sequence prior to the CL in [1].

unique_fd fd(ota_open(...));
ota_close(fd);
fd.reset(ota_open(...));

fd.reset() may unintentionally close the newly opened FD if it
has the same value as the early ota_open. The CL in [1] changed to
"ota_close(fd.release())" to avoid the issue. This CL adds a new
overloaded function ota_close(unique_fd&) to handle the release
automatically.

Similarly add ota_fclose(std::unique_ptr<FILE>&).

[1] commit 48cf770471.

Bug: 33034669
Test: recovery_component_test passes.
Change-Id: Ief91edc590e95a7426e33364b28754173efb1056
2016-11-22 16:44:41 -08:00
Tao Bao
8dd44e907a tests: Add testcases for EMMC targets.
There're two types of targets in applypatch: regular files and EMMC
targets. We have two sets of functions to handle them respectively.

This CL adds testcases to use "EMMC:filename:size:sha1" as the target
name, which triggers the code path for patching EMMC targets.

Bug: 33034669
Test: recovery_component_test passes.

Change-Id: I8f10c6c8d2c1fb083f06a83de91d9e23cb41fb6d
2016-11-21 23:32:33 -08:00
Connor O'Brien
ad43d2dd30 Switch update verifier to HIDL HAL
Test: UV logs show success in both binderized and passthrough modes.
Bug: 31864052
Change-Id: Ied67a52c458dba7fe600e0fe7eca84db1a9f2587
Signed-off-by: Connor O'Brien <connoro@google.com>
2016-11-21 13:48:42 -08:00
Tao Bao
1aa41a106d Merge "applypatch: Release FD when explicitly calling close."
am: a511a3c407

Change-Id: Ie4188abf0d9a9dec56ae162f7bd6d1cd35aacb0f
2016-11-21 19:32:37 +00:00
Treehugger Robot
a511a3c407 Merge "applypatch: Release FD when explicitly calling close." 2016-11-21 19:24:09 +00:00
Tao Bao
2a962adc85 Merge "Fail gracefully when we fail to fork the update binary"
am: 340a2d364f

Change-Id: If68e5c3b97e01186804076caf516512d8b9977b3
2016-11-21 19:11:35 +00:00
Tao Bao
340a2d364f Merge "Fail gracefully when we fail to fork the update binary" 2016-11-21 19:06:37 +00:00
Tao Bao
48cf770471 applypatch: Release FD when explicitly calling close.
We use android::base::unique_fd() to avoid leaking FD. We also want to
call close (or ota_close) to explicitly check the close result. When
combining the two together, we need to release the unique_fd to avoid
closing the same FD twice.

Bug: 33034669
Test: Trigger applypatch with install-recovery.sh.
Change-Id: I1a4f5d5fba7a23ef98d8bd7b7b07e87ae6f705c5
2016-11-21 09:47:34 -08:00
Matthew Bouyack
10cd48da1d Fail gracefully when we fail to fork the update binary
This change was original made in cw-f-dev but caused failures in
nyc-mr1-dev-plus-aosp due to lack of support for 'LOGE'

This version of the change uses the new 'LOG(ERROR)' style logging
instead.

See bug b/31395655
Test: attempt a memory intensive incremental OTA on a low-memory device

Change-Id: Ia87d989a66b0ce3f48e862abf9b9d6943f70e554
(cherry picked from commit c8db481780)
2016-11-20 22:38:37 -08:00
TreeHugger Robot
cf589f523a Merge "Import translations. DO NOT MERGE" into stage-aosp-master 2016-11-21 01:24:53 +00:00
Bill Yi
9a4ff5a900 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 32177112
Change-Id: I4d68cd0c69b40d1765cd74dfa730f56be01b5b23
2016-11-20 15:25:37 -08:00
Tao Bao
fa62ae6d0b Merge "Call update_engine_sideload from recovery."
am: 1d77c93bcc

Change-Id: I110237afa38d616138e2ec8eec17b9c46b009a13
2016-11-20 18:19:37 +00:00
Tao Bao
1d77c93bcc Merge "Call update_engine_sideload from recovery." 2016-11-20 18:13:14 +00:00
Alex Deymo
9b10e6095a Call update_engine_sideload from recovery.
This patch enables sideloading an OTA on A/B devices while running from
recovery. Recovery accepts the same OTA package format as recent
versions of GMS, which consists of .zip file with the payload in it.

Bug: 27178350
TEST=`adb sideload` successfully a full OTA (*)
TEST=Failed to take several invalid payloads (wrong product,
fingerprint, update type, serial, etc).

<small>(*) with no postinstall script.</small>

Change-Id: I951869340100feb5a37e41fac0ee59c10095659e
(cherry picked from commit 4344d636d4)
2016-11-19 22:39:51 -08:00
Tao Bao
146f92ab3e Merge "updater: Refactor set_stage() and get_stage() functions."
am: c627cd6486

Change-Id: Ie4ff6fa512c875c6be65b02908eadb498d3f9644
2016-11-20 05:09:49 +00:00
Tao Bao
ad57e2ca2c Merge "update_verifier: Sync Android.mk with aosp-master." into stage-aosp-master 2016-11-20 05:06:00 +00:00
Tao Bao
c627cd6486 Merge "updater: Refactor set_stage() and get_stage() functions." 2016-11-20 05:04:54 +00:00
Tao Bao
fbde508ace bootloader_message: Remove the no-op blank line.
This single blank line was introduced by some cherry-pick, which is
causing merge conflicts.

Test: N/A
Change-Id: Ida527b76fca7cc916499c5f888476c8e51ba3eaa
2016-11-18 16:00:23 -08:00
Tao Bao
5422d80961 update_verifier: Sync Android.mk with aosp-master.
It's out of sync due to the cherry-pick in commit
d007cf2da2.

Test: mmma bootable/recovery
Change-Id: I286fe89c4c7d09de3a06d09f9a2b0cdecef326f5
2016-11-18 15:10:01 -08:00