Commit graph

4733 commits

Author SHA1 Message Date
Tianjie Xu
fbd4b10310 Merge "Add implemention of SortedRangeSet"
am: 64cba55fbc

Change-Id: I2174e4f55c85fe57014b31625dbc2d06e41350be
2017-08-01 00:31:20 +00:00
Tianjie Xu
64cba55fbc Merge "Add implemention of SortedRangeSet" 2017-08-01 00:22:33 +00:00
Tianjie Xu
b9e7fc7fa9 Add implemention of SortedRangeSet
This is useful in imgdiff to maintain the block ranges of
splitted source image.

Bug: 34220646
Test: mma && unit tests pass
Change-Id: I6427f2ea50f0e3b0aa3dd01880ec0206679b7429
2017-07-31 15:13:55 -07:00
Tao Bao
5507c3d63c Merge "otautil: Clean up dirCreateHierarchy()."
am: 610712101b

Change-Id: I95350c4b2aab36dd89ea7813f2eb63d407b5f8ac
2017-07-31 00:15:43 +00:00
Treehugger Robot
610712101b Merge "otautil: Clean up dirCreateHierarchy()." 2017-07-31 00:10:34 +00:00
Tianjie Xu
6f30535229 Merge "Add more specific error codes for uncrypt failures"
am: 3ff8a5e2a4

Change-Id: Iee5b01f59b2e0532232393c0133f0bd3b11d9ccd
2017-07-27 21:31:52 +00:00
Tianjie Xu
3ff8a5e2a4 Merge "Add more specific error codes for uncrypt failures" 2017-07-27 21:29:17 +00:00
Tianjie Xu
8b8e23d5cc Add more specific error codes for uncrypt failures
Add the error codes when we fail to find the realpath, or fail to find
the block_device.

Bug: 63737759
Test: mma
Change-Id: Icf15368ad3e7345c747d9083da2f049cc8acd571
2017-07-27 21:28:18 +00:00
Tao Bao
dcd272fbb1 Merge "roots.cpp: Clean up format_volume()."
am: 8eef26cf3d

Change-Id: I0cf7d7cf82f4e14567b585b2603ba387a8f94231
2017-07-27 17:38:45 +00:00
Tao Bao
8eef26cf3d Merge "roots.cpp: Clean up format_volume()." 2017-07-27 17:33:48 +00:00
Tao Bao
ac3d1edca0 otautil: Clean up dirCreateHierarchy().
- Changed to std::string based implementation (mostly moved from the
  former make_parents() in updater/install.cpp);
- Removed the timestamp parameter, which is only neeed by file-based OTA;
- Changed the type of mode from int to mode_t;
- Renamed dirCreateHierarchy() to mkdir_recursively().

Test: recovery_unit_test passes.
Test: No external user of dirCreateHierarchy() in code search.
Change-Id: I71f8c4b29bab625513bbc3af6d0d1ecdc3a2719a
2017-07-27 10:33:07 -07:00
Tao Bao
3c00facb3d roots.cpp: Clean up format_volume().
Test: m -j bootable/recovery
Test: Wipe data/cache in recovery
Change-Id: I11a4bf34015e903992ae2fb100d0b59a9fb75e03
2017-07-25 15:26:32 -07:00
Tao Bao
1d510671c7 Merge "Remove LOCAL_CLANG"
am: 231c627a55

Change-Id: Idfd30503b9ebd8e3d59af7ab703911a500ad6c09
2017-07-25 21:58:22 +00:00
Tao Bao
231c627a55 Merge "Remove LOCAL_CLANG" 2017-07-25 21:46:36 +00:00
Lennart Wieboldt
5e5e334b3b Remove LOCAL_CLANG
clang is the default compiler since Android nougat

Change-Id: I930bba431dc49970cb4491ed5fcf44b5e00e97df
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-07-25 21:48:39 +02:00
Jin Qian
786177f7e6 Merge "recovery: handle security footer before passing size to mke2fs"
am: 539ed9acb1

Change-Id: Iba9eab601be27fe68c6895ca09f4ff2ee3957501
2017-07-25 19:23:40 +00:00
Treehugger Robot
539ed9acb1 Merge "recovery: handle security footer before passing size to mke2fs" 2017-07-25 19:16:01 +00:00
Tao Bao
ac634e3c9d Merge "updater: Remove dead make_parents()."
am: f5396eb8b2

Change-Id: Ief0557813324d49c5da64265dc49ab757ed3ae3f
2017-07-25 19:09:40 +00:00
Treehugger Robot
f5396eb8b2 Merge "updater: Remove dead make_parents()." 2017-07-25 19:02:44 +00:00
Tao Bao
276ff4cc33 Merge "recovery: Fix the flickering when turning on text mode."
am: 771dfb0016

Change-Id: Ic85356b782c6b83725d85f2104fb30fc81ad2ed1
2017-07-25 18:57:38 +00:00
Treehugger Robot
771dfb0016 Merge "recovery: Fix the flickering when turning on text mode." 2017-07-25 18:51:33 +00:00
Tao Bao
7022f33ec8 recovery: Fix the flickering when turning on text mode.
When there's no command specified when booting into debuggable builds
(such as using `adb reboot recovery`), we turn on the text mode (i.e.
recovery menu) directly. This CL fixes the issue to avoid showing the
background image in a flash while turning on the text mode.

Bug: 63985334
Test: `fastboot boot $OUT/recovery.img` and it shows the recovery menu
      directly without the no command image in a flash.
Change-Id: Id86bbe346ab76c8defc95e2b423e695a86774b09
2017-07-25 09:59:31 -07:00
Jin Qian
f3ccad58dd recovery: handle security footer before passing size to mke2fs
mke2fs doesn't take negative size as reserved size. If footer is
specified, compute fs size to be
(max partition size - reserved footer size) / block_size

Bug: 23686092
Bug: 63968011
Change-Id: Iac4e143bd26a70cfc81eb52a399d687e19b1049c
2017-07-25 09:11:09 -07:00
Tao Bao
5902691764 updater: Remove dead make_parents().
Its former callers in RenameFn() and SymlinkFn() have been removed in
commit 63d786cf22.

Test: mmma -j bootable/recovery
Change-Id: I26ed126202554fc5840811ec7ae162da70593213
2017-07-25 08:42:52 -07:00
Tao Bao
993cec5cc9 Merge "otautil: Delete dirUnlinkHierarchy()."
am: 031661d4a9

Change-Id: I33a793646f6f11757afc20f16fd3a0f700dd09fb
2017-07-25 14:28:52 +00:00
Tao Bao
031661d4a9 Merge "otautil: Delete dirUnlinkHierarchy()." 2017-07-25 14:11:28 +00:00
Tao Bao
922a310d36 Merge "roots.cpp: Reformatting the file."
am: ac70ffcc85

Change-Id: Ia658b14b12286a07c878f639763d9d83fa48fabf
2017-07-25 08:09:13 +00:00
Tao Bao
7934985e0c otautil: Delete dirUnlinkHierarchy().
This function has become obsolete since we've removed file-based OTA
support (it was needed by 'delete_recursive' edify function earlier).

Test: mmma -j bootable/recovery
Test: Code search shows no active user of the function.
Change-Id: If6faaa759d4c849b79acba4e6adb82baadc89f7a
2017-07-24 20:35:48 -07:00
Treehugger Robot
ac70ffcc85 Merge "roots.cpp: Reformatting the file." 2017-07-25 03:19:39 +00:00
Tao Bao
bb10e58eb1 roots.cpp: Reformatting the file.
Mostly cosmetic changes. Removed the use of errno, and added constness
to a few pointers.

format_volume() and exec_cmd() will be cleaned up in a separate CL.

Test: mmma -j bootable/recovery
Change-Id: Ia12ce25a91c0bdd0e319f6da02ce1dc8377f265d
2017-07-24 17:15:41 -07:00
Tao Bao
dbe9da5331 Merge "tests: Add a test to cover legacy care_map.txt handling."
am: 6eb23c594c

Change-Id: Iaad43cb44f4c406e4c07c9399e70e96cbaa4db7b
2017-07-24 18:27:00 +00:00
Tao Bao
6eb23c594c Merge "tests: Add a test to cover legacy care_map.txt handling." 2017-07-24 18:23:52 +00:00
Tao Bao
c319613e06 tests: Add a test to cover legacy care_map.txt handling.
This is to cover the code added by commit
5a1dee01df, where an O update_verifier
should not reject N care_map.txt.

Bug: 63544345
Test: recovery_component_test passes on marlin.
Change-Id: Ia944e16cba3cc635098b3ffd92842d725b570fec
2017-07-24 09:34:06 -07:00
Tao Bao
fdb5d1cd8c Merge "update_verifier: Handle legacy care_map.txt gracefully."
am: 15ae0f01c3

Change-Id: I7a175533cd3710d978b20245817a01a73a3f575d
2017-07-24 16:22:32 +00:00
Tao Bao
15ae0f01c3 Merge "update_verifier: Handle legacy care_map.txt gracefully." 2017-07-24 16:13:14 +00:00
Tao Bao
248b4f9dca Merge "Remove the obsolete reference to /file_contexts."
am: 6b09b895be

Change-Id: I2b26ced9ffeb278ce01ff2ca7be4057b0ab6c61c
2017-07-23 04:03:34 +00:00
Treehugger Robot
6b09b895be Merge "Remove the obsolete reference to /file_contexts." 2017-07-23 03:56:42 +00:00
Tao Bao
338be53ed3 Remove the obsolete reference to /file_contexts.
This file no longer exists:
- /file_contexts has been split into plat_file_contexts and
  nonplat_file_contexts since commit
  b236eb6ca204cefcb926e19bd5682f9dcad4021d (system/sepolicy).
- It was named /file_contexts.bin prior to the split.

'-S file_contexts' is also no longer required by e2fsdroid, since commit
2fff6fb036cbbb6dedd7da3d208b312a9038a5ce (external/e2fsprogs). It will
load the file contexts via libselinux.

Test: Trigger the path by performing a data wipe for converting to FBE.
Change-Id: I179939da409e5c0415ae0ea0bf5ddb23f9e6331e
(cherry picked from commit 7af933b6a6)
2017-07-22 16:16:21 -07:00
Tao Bao
5a1dee01df update_verifier: Handle legacy care_map.txt gracefully.
update_verifier should be backward compatible to not reject legacy
care_map.txt from old releases, which could otherwise fail to boot into
the new release.

For example, we've changed the care_map format between N and O. An O
update_verifier would fail to work with an N care_map.txt - a) we have
switched update_verifier to read from device mapper in O; b) the last
few blocks that contain metadata can't be read via device mapper. This
could be a result of sideloading an O OTA while the device having a
pending N update.

Bug: 63544345
Test: As follows on sailfish:
 1. Flash the device with this CL;
 2. Put a copy of N care_map.txt at /data/ota_package/. Restore the
    permissions properly ('cache' group);
 3. `adb reboot bootloader`;
 4. `fastboot set_active <current_slot>`
 5. Device boots up into home screen, with a warning in logcat that says
    it has skipped legacy care_map.txt.
Change-Id: I6acc88c9e655a9245e6531f176fef7953953935f
2017-07-21 17:17:03 -07:00
Tao Bao
4fb2825dc2 Merge "Avoid crashing recovery with unwritable /cache."
am: 9187f1cc51

Change-Id: Ie5708c2f703aefbfcad85ad0d2d24ae36b725c78
2017-07-21 23:22:31 +00:00
Treehugger Robot
9187f1cc51 Merge "Avoid crashing recovery with unwritable /cache." 2017-07-21 23:14:08 +00:00
Tianjie Xu
80acaab52f Merge "Fix a case when brotli writer fails to write last few blocks of data"
am: e45c8f0057

Change-Id: I337e8ec26f59a5245ab299080d7251331823e2da
2017-07-21 21:04:17 +00:00
Tianjie Xu
e45c8f0057 Merge "Fix a case when brotli writer fails to write last few blocks of data" 2017-07-21 20:59:24 +00:00
Tao Bao
ec57903a7e Avoid crashing recovery with unwritable /cache.
When /cache is unwritable, recovery hits a crash loop. Because it
passes nullptr to fileno(3) when writing back the locale file. This
prevents user from recovering a device - it cannot boot far enough to
recovery menu which allows wiping /cache.

Bug: 63927337
Test: Corrupt /cache and boot into recovery on bullhead:
 1. m -j recoveryimage
 2. fastboot erase cache
 3. fastboot boot $OUT/recovery.img
 4. recovery menu shows up.
Change-Id: I1407743f802049eb48add56a36298b665cb86139
2017-07-21 13:40:56 -07:00
Jin Qian
9203641742 Merge "recovery: replace make_ext4 with e2fsprogs"
am: f7c00ddaf6

Change-Id: I17167b59242c709b18d09fccb52058b0bc25bf09
2017-07-21 19:06:06 +00:00
Treehugger Robot
f7c00ddaf6 Merge "recovery: replace make_ext4 with e2fsprogs" 2017-07-21 19:00:46 +00:00
Tianjie Xu
6ed175d541 Fix a case when brotli writer fails to write last few blocks of data
receive_new_data may exit too early if the zip processor has sent all
the raw data. As a result, the last few 'new' commands will fail even
though the brotli decoder has more output in its buffer.

Restruct the code so that 'NewThreadInfo' owns the decoder state solely;
and receive_brotli_new_data is responsible for the decompression.

Also reduce the test data size to 100 blocks to avoid the test timeout.

Bug: 63802629
Test: recovery_component_test. on bullhead, apply full updates with and
w/o brotli compressed entries, apply an incremental update.

Change-Id: I9442f2536b74e48dbf7eeb062a8539c82c6dab47
2017-07-21 11:44:00 -07:00
Jin Qian
ded2dac082 recovery: replace make_ext4 with e2fsprogs
Execute mke2fs to create empty ext4 filesystem.
Execute e2fsdroid to add files to filesystem.

Test: enter recovery mode and wipe data
Bug: 35219933
Change-Id: I10a9f4c1f4754ad864b2df45b1f879180ab33876
(cherry picked from commit ac31808cd3)
2017-07-20 11:42:17 -07:00
Tianjie Xu
6d8827e0d3 Merge "Fix the android-cloexec-* warnings in bootable/recovery"
am: 94a8ea1797

Change-Id: I57ae57bab58f603540654bb24df9facca9a7d625
2017-07-19 23:06:50 +00:00
Tianjie Xu
94a8ea1797 Merge "Fix the android-cloexec-* warnings in bootable/recovery" 2017-07-19 23:00:19 +00:00