Commit graph

3204 commits

Author SHA1 Message Date
Dan Shi
7368316de1 Add test config to minadbd_test
Design doc:
Generalized Suites & the Unification of APCT & CTS Workflows Design/Roadmap
https://docs.google.com/document/d/1eabK3srlBLouMiBMrNP3xJPiRRdcoCquNxC8gBWPvx8/edit#heading=h.78vup5eivwzo

Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

Bug: 35882476
Test: local test
Change-Id: I51e1b410536469d254ae7a353bc61a7df06c8324
2017-03-28 22:13:38 -07:00
Tao Bao
b4c4f8c494 Merge "applypatch: Drop the support for patching non-EMMC targets." 2017-03-26 18:00:20 +00:00
Tianjie Xu
f4c949a41e Merge "Don't fail ReadArgs if length to parse is 0" 2017-03-25 23:53:31 +00:00
Tao Bao
5212a00588 Merge "updater: Remove some redundant arguments." 2017-03-25 23:11:37 +00:00
Treehugger Robot
5f98326c1e Merge "libbootloader_message: use different fstab paths for normal/recovery boot" 2017-03-25 17:06:33 +00:00
Bowgo Tsai
37bd44174b libbootloader_message: use different fstab paths for normal/recovery boot
libbootloader_message is used by both normal boot and recovery boot.
It needs to use different fstab paths, respectively. Otherwise, factory
reset will fail when we move /fstab.{ro.hardware} to /vendor/etc/.

  Recovery boot: fs_mgr_read_fstab_with_dt("/etc/recovery.fstab")
  Normal boot: fs_mgr_read_fstab_default()

Bug: 35811655
Bug: 36502022

Test: normal boot sailfish, go to Settings > System & tap on
      "Factory Data reset"
Test: recovery boot sailfish

Change-Id: I253f5bdfb9be8a01f80856eb1194f85cdf992bbd
2017-03-25 19:25:43 +08:00
Tao Bao
5479506c9c Merge "updater: Drop the support for BBOTA v1 and v2." 2017-03-24 23:06:56 +00:00
Tao Bao
4efd353d8f Merge "Const modifiers" 2017-03-24 20:28:09 +00:00
Tao Bao
110155a604 Merge "Removed C-style casts" 2017-03-24 20:28:00 +00:00
Tao Bao
6014db5da6 Merge "Fix the wrong parameter when calling read_metadata_from_package()." 2017-03-24 20:11:53 +00:00
Tao Bao
1b2a98bda3 Fix the wrong parameter when calling read_metadata_from_package().
The call to read_metadata_from_package() is broken due to being passed
an invalid pointer (ZipArchiveHandle vs ZipArchiveHandle*). It's
introduced when switching from minzip to libziparchive. Compiler didn't
complain, because ZipArchiveHandle is typedef'd as void*, which legitly
accepts a void**.

Also clean up secure_wipe_partition() logs a bit by using android-base
logging.

Bug: 36427762
Test: Send a wipe package.
Change-Id: I791a0f09a066f1c257dae890e7ae13d02a02e78b
2017-03-24 11:02:05 -07:00
Tao Bao
bcf464988e updater: Remove some redundant arguments.
Clean up a few functions that take CommandParameters& as the first
parameter. We don't need to take duplicate arguments if they always come
from CommandParameters. This redundancy came from the point we replaced
strtok()s (commit baad2d454d).

Test: Apply an incremental update with the new updater.
Change-Id: I2912b8ce6bc7580bf7f566e125f12270e679e155
2017-03-24 00:34:36 -07:00
Tao Bao
3356777cae updater: Drop the support for BBOTA v1 and v2.
The script support for BBOTA v1 and v2 has been dropped in commit
8fad03e7712082eb880ffaaffb69eb13252ce220 (platform/build).

Bug: 33694730
Test: Apply an incremental with the new updater.
Test: recovery_component_test
Change-Id: I038b1bf8d10f030cab8ec0aa6ee565c5a9545dfd
2017-03-23 23:58:02 -07:00
Treehugger Robot
f09efaff89 Merge "Reword the wipe warning message to be more comprehensible." 2017-03-23 23:36:42 +00:00
Tianjie Xu
bf607c4a28 Don't fail ReadArgs if length to parse is 0
Test: recovery component tests pass
Change-Id: I0946ba498d845ec552ae7e4c79dc94618b2fdf6d
2017-03-23 15:12:22 -07:00
Paul Crowley
31ac0c61fe Reword the wipe warning message to be more comprehensible.
Test: My device was crashing anyway, so observed message on crash.
Bug: 34669779
Change-Id: Ib85d1d137139f5e14f735c972c2312acce2caf5f
2017-03-23 14:54:20 -07:00
Tao Bao
b56a3c2e3a Merge "Redundant checking of STL container element" 2017-03-23 21:13:47 +00:00
Mikhail Lappo
b49767c0ba Const modifiers
This functions do not change class variables
Would be good to mark them as const, so
class variables are not changed by coincidence

Change-Id: Iea34f6d26dbd1bde813035160e07ff2a681989e6
2017-03-23 21:52:30 +01:00
Mikhail Lappo
20791bdcd7 Removed C-style casts
In c++ code would be cleaner to use
c++ retinterpret cast instead of old
c-style notation

Change-Id: Ibeef5e0c374addf108c0a8876a6be45063d8e396
2017-03-23 21:52:04 +01:00
Tao Bao
0d264bf088 Merge "Checking unsigned variable less than zero" 2017-03-23 19:55:35 +00:00
Tao Bao
577c668861 Merge "Fixed scanf modifier" 2017-03-23 19:55:25 +00:00
Tao Bao
9f2062657d Merge "updater: Fix the broken case for apply_patch_check()." 2017-03-23 17:03:43 +00:00
Tao Bao
833442cf4e Merge "recovery: Replace the hard-coded 1000 with AID_SYSTEM." 2017-03-23 16:47:24 +00:00
Mikhail Lappo
bb8bce932e Redundant checking of STL container element
As of C++ specification size_type erase( const key_type& key );
removes the element (if one exists). There is no need to perform
the check twice.

Change-Id: I4b057c08526abc7c2a483a60f9e166e4d8f56a74
2017-03-23 17:20:47 +01:00
Mikhail Lappo
8524faddd3 Checking unsigned variable less than zero
Unsinged variable can not be less than zero
Makes sense only to check if it is equal
2017-03-23 17:07:39 +01:00
Mikhail Lappo
17e6d3f3bc Fixed scanf modifier
Scanf expectation is to have same type
of pointer to store parsed value and
modifier in format string
2017-03-23 16:58:53 +01: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
1ea869b0c6 Merge "Remove malloc in edify functions" 2017-03-23 00:20:53 +00:00
Tao Bao
e1905adf66 recovery: Replace the hard-coded 1000 with AID_SYSTEM.
Test: mmma bootable/recovery
Change-Id: Icea5bd91a976957e8b6ab46e367345ff69a53ca4
2017-03-22 14:58:58 -07: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
Tianjie Xu
d882b8892a Merge "Fix the permission of stashed blocks created by updater" 2017-03-22 18:32:57 +00:00
Tao Bao
ea3d0b923d Merge "Refactor asn1_decoder functions into a class." 2017-03-22 17:01:44 +00:00
Treehugger Robot
6d0262218a Merge "Fix updater include generation w/installclean" 2017-03-22 01:28:04 +00:00
Tianjie Xu
a946b9e241 Fix the permission of stashed blocks created by updater
Our updater created the stashes with root permission. This causes an
access denial when the RecoverySystem service tries to clean up these
blocks after a failing update. As a result, the subsequent OTA updates
may fail due to insufficient cache space.

Bug: 36457133
Test: stashed blocks cleaned successfully after reboot
Change-Id: If0ca99638cdfa1033646f29d9cc92b5ff1bacac1
2017-03-21 17:40:01 -07:00
Dan Willemsen
edec27a5bd Fix updater include generation w/installclean
Since this was putting the intermediate file in obj/PACKAGING, every
installclean was removing it and triggering updater to rebuild. Instead,
use the standard generated-sources-dir. The dep file can also be removed
now that ninja will re-run the generator if the command line changes.

Test: m -j updater; m installclean; m -j updater
Test: Only change to aosp_fugu updater before/after is the debug info
Change-Id: I20928bd2049d4a3d4e21f83fd64d16cfdc541958
2017-03-21 16:46:24 -07: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
5b2bf90e13 Merge "verify_file: Add constness to a few addresses." 2017-03-21 19:01:23 +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
110102f37e Merge "Add testcases for load_keys()." 2017-03-20 19:24:23 +00:00
Tao Bao
64d25024b9 Merge "Remove the dead #include's in verifier.cpp." 2017-03-20 16:20:46 +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
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
73cb75b46c Merge "Revert "Revert "Print SHA-1 in hex for corrupted blocks""" 2017-03-17 19:06:38 +00:00
Tianjie Xu
881b08ecd2 Merge "Add a test to perform block_image_update" 2017-03-17 18:22:11 +00:00
Tao Bao
dd553d280f Merge "Add the missing #include of <functional>." 2017-03-17 15:35:54 +00:00
Tao Bao
9468fc0429 Add the missing #include of <functional>.
For the use of std::function and std::bind. They were relying on the
transitive inclusion from <minui/minui.h>.

Test: mmma bootable/recovery
Change-Id: Ia138e1cbdd035b11d6cdca9e16c5591303b6ee13
2017-03-17 01:00:25 -07:00
Tianjie Xu
2cd36ba522 Revert "Revert "Print SHA-1 in hex for corrupted blocks""
This reverts commit 90eff6a340.
Also fix the bug where stashed blocks are not freed.

Bug: 21124445
Test: Previous failed update succeeded on bullhead
Change-Id: I23d232331a2beb51b6dcc82c957c87bc247d0268
2017-03-16 23:33:01 -07: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