Commit Graph

4891 Commits

Author SHA1 Message Date
Tao Bao ba30867b01 update_verifier: Fix the wrong computation with group_range_count.
'group_range_count' doesn't properly consider the pair-wise range
structure. It may split the ranges into wrong pairs if it evaluates to
an odd number.

For example, for an input range string of "6,0,2,10,12,20,22" with 4
threads, group_range_count becomes 1. It would then try to verify (0,2),
(2,10), (10,12) and (12,20). Note that (2,10) and (12,20) are not valid
ranges to be verified, and with (20,22) uncovered.

Bug: 68343761
Test: Trigger update_verifier verification. Check the number of verified
      blocks against the one in care_map.txt.
Change-Id: I7c5769325d9866be06c45e7dbcc0c8ea266de714
(cherry picked from commit 62caeb5f48c9d7b1a8ed97c4a021195b8499b804)
(cherry picked from commit 559a6d1d2a)
2017-11-02 04:42:49 +00:00
android-build-team Robot 43da853122 release-request-1f2fcfef-9736-44dc-8628-3ba96dac60db-for-git_oc-mr1-release-4343541 snap-temp-L73700000103533431
Change-Id: I53b93674a347f24620ce431ac12ac09230486e32
2017-09-17 07:33:08 +00:00
Bill Yi c9b0416842 Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Exempt-From-Owner-Approval: translation import

Bug: 64712476
Change-Id: Ia05d14ff5b7f6b283f46566c88a4edc4a89d5576
2017-09-16 05:39:19 -07:00
android-build-team Robot 739b576006 release-request-946c768b-83eb-4b7b-83e7-5737856fa8ec-for-git_oc-mr1-release-4326576 snap-temp-L80300000101054689
Change-Id: Ie2b658ebaabe2fdfb39b9443cd1d1b544a573faa
2017-09-10 07:28:56 +00:00
Tao Bao 17fa5c7cab ui: Manage menu_ with std::vector.
Prior to this CL, menu_ is allocated with a fixed length of text_rows_.
However, because we support scrollable menu in wear_ui, there might be
more menu entries than text_rows_, which would lead to out-of-bounds
array access. This CL addresses the issue by switching to std::vector.

Bug: 65416558
Test: Run 'View recovery logs' on angler.
Test: Set large margin height that leaves text_rows less than 21. Then
      run 'View recovery logs' with 21 menu entries.
Change-Id: I5d4e3a0a097039e1104eda7d494c6269053dc894
(cherry picked from commit e15d7a5104)
2017-09-08 15:28:04 -07:00
android-build-team Robot 3a3ccf8b0f release-request-81b48854-d0e0-49af-bcf2-857273cbb8dc-for-git_oc-mr1-release-4306444 snap-temp-L17300000097872583
Change-Id: I34720566a178fe123dbbd024b25396ddc80bec8c
2017-08-30 07:25:18 +00:00
Bill Yi c16d222593 Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Exempt-From-Owner-Approval: translation import

Bug: 64712476
Change-Id: Ife1e0455a5433bc0cb0e15b0aabf2beef1ba8827
2017-08-29 13:28:09 -07:00
android-build-team Robot f425b88b16 release-request-cff6d9b6-a564-4d17-99cb-c2d0bb282758-for-git_oc-mr1-release-4293817 snap-temp-L12800000095933585
Change-Id: I2c1af830f9b14fc851f8a170e6bd290d0067142a
2017-08-23 07:28:18 +00:00
Tao Bao 2e1b3a418e Merge changes from topic "bug-64307776" into oc-mr1-dev
* changes:
  wear_ui: Expose menu_unusable_rows via Makefile var.
  Allow customizing WearRecoveryUI via Makefile variables.
2017-08-22 17:36:06 +00:00
android-build-team Robot 153181045b release-request-edd71ba9-6f93-47be-957d-774c9d43a2dc-for-git_oc-mr1-release-4281935 snap-temp-L68100000094184972
Change-Id: If1a171a633ee60692c15ca81d99737148401521f
2017-08-17 07:32:27 +00:00
Tao Bao 2cf6fe2ced screen_ui: Fix a case that may truncate the last char.
ScreenRecoveryUI::DrawWrappedTextLines() should be called with
kMarginWidth only. Because it's using a line limit of text_cols_,
which is unaware of kMenuIdent.

Bug: 64293520
Test: No missing char with long header text.
Change-Id: Ib4d08de2c56473a483ff9964eb6cec31f8a74c9a
(cherry picked from commit 13aa4a902b)
2017-08-16 17:04:53 -07:00
Tao Bao ee6fefd2f2 screen_ui: Word-wrap menu headers.
This CL adds ScreenRecoveryUI::DrawWrappedTextLines() to better handle
long menu header texts. It does a word wrap at spaces, if available.
This avoids fixed-length menu headers being truncated on small screens.

Bug: 64293520
Test: On bullhead, boot into recovery with --prompt_and_wipe_data, and
      check the prompt texts.
Change-Id: Ia22746583516dd230567a267584aca558429395e
(cherry picked from commit 2bbc6d642d)
2017-08-16 11:03:31 -07:00
Bill Yi 20fa1a92cc Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Exempt-From-Owner-Approval: translation import

Bug: 64712476
Change-Id: I7e9049129d9a886cac53a1f6438d9c733fb3d3d8
2017-08-15 20:14:00 -07:00
Tao Bao f2be3bd74a wear_ui: Expose menu_unusable_rows via Makefile var.
This variable is useful on small screens (e.g. on watches) to handle
long menus. We should have better way to handle this value smartly.
Prior to that, expose the value to be overridable by using the generic
wearable UI module (librecovery_ui_wear).

Bug: 64307776
Test: Define the variable, build and boot into recovery image and check
      the UI menu.
Change-Id: I5d7a6baa8bb4cc852bfcc2a7b3cc9686c1c8817e
(cherry picked from commit eea3af3f91)
2017-08-13 11:24:56 -07:00
Tao Bao 016120f395 Allow customizing WearRecoveryUI via Makefile variables.
With the following Makefile variables, we can reduce the work of writing
(copy/pasting) device-specific WearRecoveryUI classes.

The list of Makefile variables (the ones useful for Wear devices):
- TARGET_RECOVERY_UI_MARGIN_HEIGHT (default: 0)
- TARGET_RECOVERY_UI_MARGIN_WIDTH (default: 0)
  Specify the margin space that we don't want to display texts. They
  replace the former outer_width and outer_height.

- TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD (default: 50)
- TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD (default: 90)
  Specify the sensitivity of recognizing a swipe. Devices give absolute
  positions, so for some devices we need to adjust the thresholds.

- TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE
  Specify the progress bar vertical position, which should be adjusted
  to the actual height of a device. It replaces the former
  progress_bar_y.

- TARGET_RECOVERY_UI_ANIMATION_FPS (default: 30)
  Specify the animation FPS if using device-specific animation images.
  It replaces the former animation_fps.

Devices can specify "TARGET_RECOVERY_UI_LIB := librecovery_ui_wear",
with optionally defined Makefile vars above, in BoardConfig.mk to
customize their WearRecoveryUI.

Also remove the obsolete wear_touch.{cpp,h}, which has been merged into
ui.cpp in commit 5f8dd9951d.

Bug: 64307776
Test: Change the device BoardConfig.mk and test recovery image.
Change-Id: Id0fb2d4e3977ab5ddd31e71f9535470cab70e41b
(cherry picked from commit 0470ceea38)
2017-08-13 11:24:33 -07:00
android-build-team Robot 52f0e206e2 release-request-68cc9b2a-98ae-4fbf-8b56-3e535855f399-for-git_oc-mr1-release-4269864 snap-temp-L25700000092502312
Change-Id: Id98067953ca0ac14a01276b2387aeaa6a7dfdef8
2017-08-13 07:34:31 +00:00
David Zeuthen 9cf2e9798f update_verifier: Support androidboot.veritymode being empty or 'disabled'.
am: 3222dc0d76

Change-Id: I20dc5fce9e5adf002acf0e918d843c681286a8fc
2017-08-10 20:53:08 +00:00
android-build-team Robot e6dd71bcdb release-request-7f84484c-eec6-4577-8d5a-55079be4f3c5-for-git_oc-mr1-release-4262309 snap-temp-L02100000091441105
Change-Id: I1acbef57e3d5e8dbe11e770522894543f5d06b08
2017-08-10 07:27:31 +00:00
Wei Wang 1f4229ff95 Merge "tests: Add the missing dependency on libhidlbase." into oc-mr1-dev 2017-08-10 02:32:47 +00:00
Tao Bao 102016ce1f tests: Add the missing dependency on libhidlbase.
It fails to build recovery_component_test with the following errors:

out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14:
error: undefined reference to 'android::hardware::hidl_string::hidl_string(android::hardware::hidl_string const&)'
out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14:
error: undefined reference to 'android::hardware::hidl_string::operator=(android::hardware::hidl_string
const&)'
out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14:
error: undefined reference to 'android::hardware::hidl_string::~hidl_string()'

libupdate_verifier includes <android/hardware/boot/1.0/IBootControl.h>,
which includes the 'types.h' above. In 'types.h', it defines struct
CommandResult that's using android::hardware::hidl_string.

Since libhidlbase doesn't have a static library target, remove
'LOCAL_FORCE_STATIC_EXECUTABLE := true', which isn't required for
running tests.

Test: mmma -j bootable/recovery
Bug: 64538692
Change-Id: Iaa7c08adc241128d787274fcaea9b363e7ff93f4
2017-08-09 16:41:48 -07:00
Wei Wang bd9664b5a0 update_verifier: verify blocks in parallel
This CL is to change update_verifier to verify blocks in parallel to
maximize storage bandwidth, it also preallocate the buffer to avoid
vector allocation within reading loop.

Test:
care_map.txt:
system
16,0,517,556,32770,33084,98306,98620,163842,164156,229378,229692,294914,295228,483544,524288,524296
vendor
8,0,119,135,32770,32831,96150,98304,98306

With CL:
init: Service 'update_verifier_nonencrypted' (pid 711) exited with status 0 waiting took 2.978424 seconds

Without CL:
init: Service 'update_verifier_nonencrypted' (pid 695) exited with status 0 waiting took 4.466320 seconds

Bug: 63686531
Test: reboot with manual insert care_map.txt
Change-Id: Idf791865f15f6ff6cad89bf7ff230ee46c6adccc
2017-08-09 19:57:17 +00:00
David Zeuthen 3222dc0d76 update_verifier: Support androidboot.veritymode being empty or 'disabled'.
Bootloaders using libavb will set androidboot.veritymode=disabled if
the "disable dm-verity" flag has been set. Additionally if the
"disable verification" flag is set androidboot.veritymode will not be
set at all. Handle both cases.

Without this fix we'll end up in a bootloop.

Test: Manually tested on a device using AVB.
(cherry-picked from commit 1a0929cc8a)
Bug: 64404283
Change-Id: I3adf93f8dfd528fe9b869a63afa775f5730a3f69
2017-08-09 14:23:20 -04:00
android-build-team Robot a8c2f0de01 release-request-d642586e-3e25-49f4-8b4c-acad0e3f63d8-for-git_oc-mr1-release-4249777 snap-temp-L81500000089724408
Change-Id: I6a93d96f305ef42af2d26578b72ed9e508583289
2017-08-06 07:35:10 +00:00
Bill Yi 5c2bc51bf2 Import translations. DO NOT MERGE
Change-Id: Ia215c30c6912ffa1e3270543f6ff4fc27f4260e4
Auto-generated-cl: translation import
Exempt-From-Owner-Approval: translation import
2017-08-05 18:24:07 -07:00
Tao Bao 937e884ca1 ui: Check for bootreason=recovery_ui.
Some wear bootloaders are passing bootreason=recovery_ui when booting
into recovery from fastboot, or via 'adb reboot recovery'. Allow turning
on text mode with a swipe for such a bootreason. Since we will turn on
text mode automatically for debuggable builds, this bootreason mainly
handles the case for user builds.

Note this change only applies to devices that allow touch screen inputs.

Bug: 36169090
Bug: 64307776
Test: Build and boot into user build recovery image. Toggle on text mode
      with a swipe.
Change-Id: I55f19aed7b210352f8370de19935b4772cc12095
(cherry picked from commit 046aae29d9)
2017-08-03 14:52:06 -07:00
Tao Bao af9f8b4d97 ui: Move the support for touch inputs into RecoveryUI.
- Added detection for EV_ABS events in minui/events.cpp, if it's
  allowed;
- Added listening and processing touch inputs in ui.cpp;
- Fixed an issue in recognizing swipe with multi-touch protocol A;
- Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It
  now allows turning on text mode with <power> + <swipe-up>.

The last change also fixed an issue on devices with protocol A: prior
to this CL, user may accidentally toggle the text mode during an OTA.
Because it was considered as a single-button device, a long tap that
sent BTN_TOUCH event would turn on text mode.

Test: Allow detecting touch inputs. Swiping (up, down, enter) works on
      angler, angelfish, dorado respectively.
Bug: 36169090
Bug: 64307776
Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd
(cherry picked from commit 5f8dd9951d)
2017-08-03 11:10:28 -07:00
android-build-team Robot 70ec0b3cc1 release-request-08461da0-a262-4ebb-8c32-784b60a151df-for-git_oc-mr1-release-4216972 snap-temp-L74000000086000437
Change-Id: I5fc9273d564fea92f473c4941bccee266feb7699
2017-07-26 07:26:20 +00:00
Jin Qian e2d31361ef recovery: handle security footer before passing size to mke2fs
am: 5e47d5161a

Change-Id: Iaf9b1b1138425101fa10946a215462ada4700433
2017-07-25 23:35:14 +00:00
Jin Qian 5e47d5161a 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
Merged-In: Iac4e143bd26a70cfc81eb52a399d687e19b1049c
Change-Id: Iac4e143bd26a70cfc81eb52a399d687e19b1049c
(cherry picked from commit f3ccad58dd)
2017-07-25 21:09:02 +00:00
Tao Bao fda6ee7d61 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
(cherry picked from commit 7022f33ec8)
2017-07-25 10:16:48 -07:00
android-build-team Robot fd98c139bd release-request-2b6c1b3d-5e73-4d4a-9a8d-92acb8a1483b-for-git_oc-mr1-release-4212424 snap-temp-L13800000085536241
Change-Id: I9a6e4dc2bb8359230d4ce1e9e12eae9a8878bb2f
2017-07-25 07:25:08 +00:00
Tao Bao 5cee24f4f1 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
(cherry picked from commit c319613e06)
2017-07-24 12:51:19 -07:00
TreeHugger Robot 71b8103bf1 Merge "update_verifier: Handle legacy care_map.txt gracefully." into oc-mr1-dev 2017-07-24 19:50:18 +00:00
Tianjie Xu 92aef7fa88 Merge "Fix a case when brotli writer fails to write last few blocks of data" into oc-mr1-dev 2017-07-24 18:31:54 +00:00
Tao Bao 5fb9f532f0 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
(cherry picked from commit 5a1dee01df)
2017-07-24 09:14:15 -07:00
android-build-team Robot a187538c37 release-request-e64ca0c4-2b43-4758-b238-0b8c6fabc365-for-git_oc-mr1-release-4207446 snap-temp-L19600000085022555
Change-Id: I7579fd758d239dc485d7a61f3cf24381b408bb3a
2017-07-23 07:31:42 +00:00
Tao Bao 329fe83509 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
(cherry picked from commit ec57903a7e)
2017-07-21 19:12:02 -07:00
Tianjie Xu d9759e8a7b 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: Id429b2c2f31951897961525609fa12c3657216b7
(cherry picked from commit 6ed175d541)
2017-07-21 22:18:34 +00:00
Jiyong Park d774ff247e Build libminui with BOARD_VNDK_VERSION
Use libdrm_platform which is a platform variant of libdrm.

Bug: 63741047
Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j libminui
Test: ryu recovery graphics test shows various graphics
Change-Id: Ifd2c1432781a96538585cdf818aa728d628a2f5a
Merged-In: Ifd2c1432781a96538585cdf818aa728d628a2f5a
(cherry picked from commit a48c494f13)
2017-07-21 00:45:21 +00:00
android-build-team Robot 9030a47ab4 release-request-d8901a87-7dd0-4cc8-a44e-d04982e429da-for-git_oc-mr1-release-4198291 snap-temp-L50900000084068812
Change-Id: I1f54fbfc485d7f06464d84f7cdace9442387d91c
2017-07-20 07:27:35 +00:00
Tianjie Xu 3a3019199c Merge "Fix the android-cloexec-* warnings in bootable/recovery" am: 94a8ea1797 am: 6d8827e0d3 am: 96b5bb9601
am: f2a279adb5

Change-Id: I85c1b30fe78f99a935a19ba28d02841f68216226
2017-07-19 23:14:51 +00:00
Tianjie Xu f2a279adb5 Merge "Fix the android-cloexec-* warnings in bootable/recovery" am: 94a8ea1797 am: 6d8827e0d3
am: 96b5bb9601

Change-Id: I55911c112a34797d7c7098e5e325145667b46715
2017-07-19 23:12:20 +00:00
Tianjie Xu 96b5bb9601 Merge "Fix the android-cloexec-* warnings in bootable/recovery" am: 94a8ea1797
am: 6d8827e0d3

Change-Id: I0c150dc44b70353f1c4b6ef7dd65b1f601e2ec4b
2017-07-19 23:09:20 +00: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
Tianjie Xu de6735e80c Fix the android-cloexec-* warnings in bootable/recovery
Add the O_CLOEXEC or 'e' accordingly.

Bug: 63510015
Test: recovery tests pass
Change-Id: I7094bcc6af22c9687eb535116b2ca6a59178b303
2017-07-19 12:17:41 -07:00
android-build-team Robot 3925d88c79 release-request-05263112-375a-4b1f-a657-a14bb2a5c5a3-for-git_oc-mr1-release-4185249 snap-temp-L63000000082739046
Change-Id: If5b820c31fd15c067850d75cdb9d9518e1e1b666
2017-07-16 07:28:18 +00:00
Tao Bao f7cc0e0cfb Merge "Remove the obsolete reference to /file_contexts." 2017-07-14 00:04:12 +00:00
Tao Bao 0d24d9cbed Merge "Fix the missing char when showing recovery logs." am: 8155a8ba74 am: c61bbe158e am: 762c42d6f6
am: 1a4f9e37dd

Change-Id: I733b98ea22719db36e3bca71cc083be5df403288
2017-07-13 20:52:18 +00:00
Tao Bao 1a4f9e37dd Merge "Fix the missing char when showing recovery logs." am: 8155a8ba74 am: c61bbe158e
am: 762c42d6f6

Change-Id: I8dd98865f38e0cc328f5a908a2c7c092d73e3a61
2017-07-13 20:50:17 +00:00