Commit graph

148 commits

Author SHA1 Message Date
Tao Bao
28b79f797c Fix the bad merge (duplicate tests).
Test: mmma bootable/recovery
Change-Id: I909164fed84fb17a7e1cb2427cb88208a69dc052
2017-03-28 19:07:12 -07:00
Tao Bao
fa617cdf97 resolve merge conflicts of 39ef2d7f to oc-dev-plus-aosp
am: 8fdce9ab99

Change-Id: Ifcd2c3236d337216adabb5bb810befd33f05f44c
2017-03-29 01:14:51 +00:00
Tao Bao
8fdce9ab99 resolve merge conflicts of 39ef2d7f to oc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I59d27cec1ef2c6befe824848cdc9ef3b0a0dc586
2017-03-28 17:58:31 -07:00
Tao Bao
3f2d35522a Merge "tests: Construct two bad packages at runtime for VerifierTest." 2017-03-29 00:37:05 +00:00
Tao Bao
dcf94dd14c Merge "tests: Add a test for --wipe_ab into UncryptTest." am: 7b0cda5b37 am: c6df7d2937 am: 62a4e5ca98
am: 20e4e73caa

Change-Id: Ib58d2e7843c6cbe75695b83651e3dcd2f9d94f9a
2017-03-28 22:39:39 +00:00
Tao Bao
20e4e73caa Merge "tests: Add a test for --wipe_ab into UncryptTest." am: 7b0cda5b37 am: c6df7d2937
am: 62a4e5ca98

Change-Id: I87b66da50364c0effdfdd5dbe8a7d0496152e68b
2017-03-28 22:34:39 +00:00
Tao Bao
7b0cda5b37 Merge "tests: Add a test for --wipe_ab into UncryptTest." 2017-03-28 22:12:35 +00:00
Tao Bao
2eb5d10846 Merge "tests: Construct two bad packages at runtime for VerifierTest." 2017-03-28 21:18:13 +00:00
Tianjie Xu
9166f66eee Merge "Add the missing sr-Latn into png files and rename the png locale header" am: 713d915636 am: dc235b5ab9
am: 5ec12126f0

Change-Id: Ia6b861c91958d3be23a4a7456d6d5d8e4a1607c8
2017-03-28 20:11:15 +00:00
Tianjie Xu
713d915636 Merge "Add the missing sr-Latn into png files and rename the png locale header" 2017-03-28 19:42:54 +00:00
Tao Bao
e003a97668 Merge changes from topic 'sinkfn' am: 34df98ee6d am: 862b7e8523
am: a2015e0d86

Change-Id: I55bd4c762033cbfd68b019c3fad861ff9b954450
2017-03-28 19:21:34 +00:00
Tao Bao
b5f84ef1c3 applypatch: Change the ssize_t length parameters to size_t. am: f7eb760fe7 am: d4d9ef3941
am: 52569ce2ed

Change-Id: Ifeeb537d59d93acac445a0c748e4180a9704fcfb
2017-03-28 19:21:31 +00:00
Tao Bao
bdc8c1a264 tests: Add a test for --wipe_ab into UncryptTest.
Also factor out the common parts in {setup,clear}_bcb into a separate
function.

Test: recovery_component_test
Change-Id: I7b95cced925c8135e020dcb791ca2425d4f28449
2017-03-28 10:55:02 -07:00
Tao Bao
c0e1c46a70 applypatch: Let Apply{BSDiff,Image}Patch accept std::function.
Test: mmma bootable/recovery system/update_engine
Test: recovery_component_test
Change-Id: I93c2caa87bf94a53509bb37f98f2c02bcadb6f5c
2017-03-28 10:14:53 -07:00
Tao Bao
f7eb760fe7 applypatch: Change the ssize_t length parameters to size_t.
Mostly for applypatch family APIs like ApplyBSDiffPatch() and
ApplyImagePatch(). Changing to size_t doesn't indicate they would
necessarily work with very large size_t (e.g. > ssize_t), just
similar to write(2). But otherwise accepting negative length doesn't
make much sense.

Also change the return type of SinkFn from ssize_t to size_t. Callers
tell a successful sink by comparing the number of written bytes against
the desired value. Negative return values like -1 are not needed. This
also makes it consistent with bsdiff::bspatch interface.

Test: recovery_component_test
Test: Apply an incremental with the new updater.
Change-Id: I7ff1615203a5c9854134f75d019e266f4ea6e714
2017-03-28 10:13:38 -07:00
Tao Bao
7e61c6a862 tests: Construct two bad packages at runtime for VerifierTest.
For the BadPackage tests from VerifierTest: one alters the footer, and
the other alters the metadata. Move the two tests to be based on
otasigned_v3.zip (they're based on otasigned_v1.zip previously). Also
construct the testdata files dynamically (to save the space and for
better readability).

Test: recovery_component_test
Change-Id: I7604d563f8b4fa0c55fec8730c063384158e3abc
(cherry picked from commit 217d9f9859)
2017-03-27 16:13:01 -07:00
Tao Bao
217d9f9859 tests: Construct two bad packages at runtime for VerifierTest.
For the BadPackage tests from VerifierTest: one alters the footer, and
the other alters the metadata. Move the two tests to be based on
otasigned_v3.zip (they're based on otasigned_v1.zip previously). Also
construct the testdata files dynamically (to save the space and for
better readability).

Test: recovery_component_test
Change-Id: I7604d563f8b4fa0c55fec8730c063384158e3abc
2017-03-27 16:10:11 -07:00
Tao Bao
056e2da679 tests: Construct signature-boundary.zip at runtime.
Test: Observe the same failure with recovery_component_test ("signature
      start: 65535 is larger than comment size: 0").
Change-Id: I98c357b5df2fa4caa9d8eed63af2e945ed99f18a
2017-03-26 23:34:13 -07:00
Tao Bao
e55215ffd5 Merge "applypatch: Drop the support for patching non-EMMC targets." am: b4c4f8c494 am: 351f69e64a
am: dcbabd5932

Change-Id: Ia8ff537f0c503fec5602ae6ad6677c8b427d0806
2017-03-26 18:08:40 +00:00
Tao Bao
b4c4f8c494 Merge "applypatch: Drop the support for patching non-EMMC targets." 2017-03-26 18:00:20 +00:00
Tianjie Xu
2078b22e41 Add the missing sr-Latn into png files and rename the png locale header
Switch the locale header in the png files from Locale.toString() to
Locale.toLanguageTag(). For example, en_US --> en-us and sr__#Latn
--> sr-Latn. Also clean up recovery a bit to expect the new locale
format.

Bug: 35215015
Test: sr-Latn shows correctly under graphic tests && recovery tests pass
Change-Id: Ic62bab7756cdc6e5f98f26076f7c2dd046f811db
2017-03-24 16:54:52 -07:00
Tao Bao
951a61b9a8 Merge "updater: Fix the broken case for apply_patch_check()." am: 9f2062657d am: 923d41ccd5
am: 47ee8fa42a

Change-Id: I24a2b7776779a61f786fae0cbe5dd9569250ff7b
2017-03-23 17:15:42 +00:00
Tao Bao
db56eb073e updater: Fix the broken case for apply_patch_check().
It's valid to provide only 1 argument to apply_patch_check(). We
shouldn't fail the argument parsing.

Bug: 36541737
Test: recovery_component_test passes.
Test: recovery_component_test captures the failure without the fix.
Test: The previously failed update applies successfully.
Change-Id: Iee4c54ed33b877fc4885945b085341ec5c64f663
2017-03-23 06:52:45 -07:00
Tianjie Xu
5e1a2dc522 Merge "Remove malloc in edify functions" am: 1ea869b0c6 am: 137d85333e
am: eb0623b14b

Change-Id: I7c48105d9259b1713e8be5fb2c50ef8d6a92c993
2017-03-23 00:45:51 +00:00
Tianjie Xu
c444732540 Remove malloc in edify functions
And switch them to std::vector & std::unique_ptr

Bug: 32117870
Test: recovery tests passed on sailfish
Change-Id: I5a45951c4bdf895be311d6d760e52e7a1b0798c3
2017-03-22 14:20:57 -07:00
Tao Bao
a309fec8af Merge "Refactor asn1_decoder functions into a class." am: ea3d0b923d am: d7846b7303
am: 6e30101834

Change-Id: I4ac855fe7b33e4b1141c601045ecf79a681c60cf
2017-03-22 17:11:14 +00:00
Tao Bao
861c53c6c5 Refactor asn1_decoder functions into a class.
Test: mmma bootable/recovery
Test: recovery_unit_test passes.
Test: recovery_component_test passes.
Change-Id: If0bf25993158eaebeedff55ba4f4dd0f6e5f937d
2017-03-21 15:17:43 -07:00
Tao Bao
9d9f310f4e Merge "verify_file: Add constness to a few addresses." am: 5b2bf90e13 am: 43bd2c8414
am: 1c456cd3a5

Change-Id: I6d423a2fe19727e0d41b083a4020be30ae9400fb
2017-03-21 19:16:39 +00:00
Tao Bao
76fdb2419b verify_file: Add constness to a few addresses.
We should not touch any data while verifying packages (or parsing the
in-memory ASN.1 structures).

Test: mmma bootable/recovery
Test: recovery_component_test passes.
Test: recovery_unit_test passes.
Change-Id: Ie990662c6451ec066a1807b3081c9296afbdb0bf
2017-03-20 22:13:56 -07:00
Tao Bao
e44af82043 Merge "Add testcases for load_keys()." am: 110102f37e am: 43f5ad6e90
am: 60ea643afb

Change-Id: I2246094d0db184726cae34d7b916c127512ad6d2
2017-03-20 19:36:05 +00:00
Tao Bao
110102f37e Merge "Add testcases for load_keys()." 2017-03-20 19:24:23 +00:00
Tao Bao
b7d07f7b1e Merge "Remove the dead #include's in verifier.cpp." am: 64d25024b9 am: b2617e882e
am: cc3f3c3d1c

Change-Id: Ib78b586044938d9ec41cabfb07e8a274cc7d4d73
2017-03-20 16:32:24 +00:00
Tao Bao
3116ce4651 Add testcases for load_keys().
Test: recovery_component_test passes.
Change-Id: I6276b59981c87c50736d69d4af7647c8ed892965
2017-03-18 14:16:21 -07:00
Tao Bao
d7bf82eb53 Remove the dead #include's in verifier.cpp.
A follow-up to commit 5e535014dd.
Also clean up Android.mk, since libverifier no longer needs anything
from libminui.

Test: mmma bootable/recovery
Test: recovery_component_test passes.
Change-Id: I1c11e4bbeef67ca34a2054debf1f5b280d509217
2017-03-18 09:28:42 -07:00
Tao Bao
90d3f20c99 Merge "Drop the dependency on 'ui' in verify_file()." 2017-03-18 14:16:16 +00:00
Tao Bao
2b83f36355 Merge "Drop the dependency on 'ui' in verify_file()." 2017-03-17 23:41:45 +00:00
Tao Bao
7b22c92ac1 Drop the dependency on 'ui' in verify_file().
verify_file() has a dependency on the global variable of 'ui' for
posting the verification progress, which requires the users of
libverifier to provide a UI instance.

This CL adds an optional argument to verify_file() so that it can
post the progress through the provided callback function. As a result,
we can drop the MockUI class in verifier_test.cpp.

Test: recovery_component_test passes.
Test: verify_file() posts progress update when installing an OTA.
Change-Id: I8b87d0f0d99777ea755d33d6dbbe2b6d44243bf1
(cherry picked from commit 5e535014dd)
2017-03-17 14:14:07 -07:00
Tao Bao
5e535014dd Drop the dependency on 'ui' in verify_file().
verify_file() has a dependency on the global variable of 'ui' for
posting the verification progress, which requires the users of
libverifier to provide a UI instance.

This CL adds an optional argument to verify_file() so that it can
post the progress through the provided callback function. As a result,
we can drop the MockUI class in verifier_test.cpp.

Test: recovery_component_test passes.
Test: verify_file() posts progress update when installing an OTA.
Change-Id: I8b87d0f0d99777ea755d33d6dbbe2b6d44243bf1
2017-03-17 14:07:12 -07:00
Tianjie Xu
c76805952e Merge "Add a test to perform block_image_update" am: 881b08ecd2 am: 5c06706d51
am: 640fc1d338

Change-Id: If611a8023bb5411ac2a1063411d0030121ce0de2
2017-03-17 18:34:31 +00:00
Tianjie Xu
881b08ecd2 Merge "Add a test to perform block_image_update" 2017-03-17 18:22:11 +00:00
Tianjie Xu
56ebe620a2 Add a test to perform block_image_update
Add the following tests:
stash src
bspatch stashed_src tgt
free stashed_src
(expected a successful update)

stash src
free stashed_src
fail_the_update
(expected stashed_src freed)

Bug: 36242722
Test: Test identified unfreed stashes correctly.
Change-Id: I5a136e8dc31774367972fbfe8c63cbc1ddb3a113
2017-03-16 23:06:37 -07:00
Tianjie Xu
92d167513d Merge "More cleanup to imgdiff & imgpatch" am: 3541934ff5 am: 91f8574061
am: dda128abbf

Change-Id: I4369d91759d40a1fb261766fb5b1e6aa0ecb36c4
2017-03-17 01:06:49 +00:00
Tianjie Xu
12b90553d7 More cleanup to imgdiff & imgpatch
Also remove the utils in applypatch and replace them with the
corresponding libbase functions.

Test: recovery tests pass.
Change-Id: I77254c141bd3e7d3d6894c23b60e866009516f81
2017-03-16 12:09:49 -07:00
Tao Bao
40e144dae8 applypatch: Drop the support for patching non-EMMC targets.
Patching regular files is used in file-based OTA only, which has become
obsolete.

Bug: 35853185
Test: Apply an incremental that patches the boot.img.
Test: /system/bin/install-recovery.sh works.
Test: recovery_component_test passes.
Change-Id: Id44e42c4bc63f2162ecc8a6df1cb528b7ae6b0a9
2017-03-16 00:49:49 -07:00
Tao Bao
175a033e80 Merge "updater: Remove some obsoleted functions for file-based OTA." am: 342717d148 am: 000f364c19
am: 1fc6e95672

Change-Id: I3e01f0bbcbe9233b2c0ed8088fc3cf1781a4baf3
2017-03-14 17:21:32 +00:00
Tao Bao
63d786cf22 updater: Remove some obsoleted functions for file-based OTA.
This CL removes the updater support for delete(), symlink(), rename(),
set_metadata() and set_metadata_recursive(). Such functions have been
removed from the generation script in commit
f388104eaacd05cfa075d6478369e1d0df5ddbf3 (platform/build).

Note: This CL also removes delete_recursive() which seems to have never
been supported in generation script.

Bug: 35853185
Test: recovery_component_test passes.
Change-Id: I51e1ec946fa73761118fa1eaa082423df6d588e9
2017-03-13 10:02:08 -07:00
Bowgo Tsai
1bd484f941 Merge "recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIs" am: 7a0dfec771 am: 1a23257214
am: 1a76f4a3bc

Change-Id: I8869ddf69589c2a1bb0e8dd493df67f9126db585
2017-03-10 16:17:39 +00:00
Bowgo Tsai
d13b6cf29c recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIs
The fstab settings of early-mounted partitions (e.g., /vendor) will be in
kernel device tree. Switch to the new API to get the whole settings with
those in device tree:

    fs_mgr_read_fstab_with_dt("/etc/recovery.fstab")

The original default /fstab.{ro.hardware} might be moved to
/vendor/etc/. or /odm/etc/. Use another new API to get the default fstab
instead of using the hard-coded /fstab.{ro.hardware}. This API also
includes the settings from device tree:

    fs_mgr_read_fstab_default()

Bug: 35811655
Test: boot sailfish recovery
Change-Id: Iaa56ac7f7b4c4dfc7180c65f03e9a37b94f1de09
2017-03-10 17:27:31 +08:00
Tianjie Xu
a4e0bb321b Merge "Refractor the code for imgdiff" am: a2e7a07031 am: 68571e27d8
am: 36ee8dd262

Change-Id: I8ce462fa0d6c9ea601e1e3d3c9386cc3fcaa7972
2017-03-07 03:14:43 +00:00
Treehugger Robot
a2e7a07031 Merge "Refractor the code for imgdiff" 2017-03-07 03:06:09 +00:00