Commit graph

6847 commits

Author SHA1 Message Date
Tom Cherry
990807a95f Merge "Add android::fs_mgr namespace for new Fstab code" 2019-01-31 19:35:54 +00:00
Tom Cherry
72a114a3e1 Add android::fs_mgr namespace for new Fstab code
Also add libfstab dependencies where needed.  Previously the
`typedef struct FstabEntry Volume;` line served to both define a
`struct FstabEntry` as well as alias Volume to it.  With the new
namespace for android::fs_mgr::FstabEntry, `struct FstabEntry` isn't
compatible anymore, so we need to alias Volume to the real
android::fs_mgr::FstabEntry.

In doing so, we need to include <fstab/fstab.h> and this requires
libfstab as a library, which a few modules did not have before.

Test: treehugger
Change-Id: I655209a0efb304b3e0568db0748bd5cf7cecbdb7
2019-01-31 09:00:40 -08:00
Tianjie Xu
9a54dd3bf9 Merge "Fix potential size overflow in blockimg.cpp" 2019-01-29 23:08:58 +00:00
Suren Baghdasaryan
5342de92e0 Merge "DO NOT MERGE: Revert "Revert "Add libprocessgroup dependency""" 2019-01-25 17:09:02 +00:00
Suren Baghdasaryan
0ca607c4cd DO NOT MERGE: Revert "Revert "Add libprocessgroup dependency""
This reverts commit 9ce1d14ef6.

Reason for revert: AOSP is fixed with new vendor image

Change-Id: Ie5a9748acdae22a2b9862cb2ecedda7031f77264
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-01-25 05:43:59 +00:00
Suren Baghdasaryan
7548e0d6fa Merge "DO NOT MERGE: Revert "Add libprocessgroup dependency"" 2019-01-24 06:57:55 +00:00
Treehugger Robot
05d48050c1 Merge "Check that install file exists before unlink" 2019-01-24 05:35:51 +00:00
Suren Baghdasaryan
9ce1d14ef6 DO NOT MERGE: Revert "Add libprocessgroup dependency"
This reverts commit 62d0c7873c.

Reason for revert: Broke AOSP

Change-Id: I88ef00ebce797f7fdca3678ab93fcae364453a8c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-01-23 20:46:46 -08:00
Ng Zhi An
14417a5d2a Check that install file exists before unlink
This will remove spurious error messages in logcat such as:

08-02 00:27:21.580   600   600 E /system/bin/recovery-persist: Failed to
unlink /data/misc/recovery/last_install: No such file or directory

since the install file doesn't exist in the first place.

Bug: None
Test: m
Change-Id: Ifaa95729c50efae4e641286dfbe1718aceb5f50a
2019-01-23 15:16:29 -08:00
Suren Baghdasaryan
4475f7330a Merge "Add libprocessgroup dependency" 2019-01-22 20:58:15 +00:00
Suren Baghdasaryan
62d0c7873c Add libprocessgroup dependency
Because set_sched_policy is moved into libprocessgroup an additional
dependency is requred for recovery_component_test to build.

Exempt-From-Owner-Approval: janitorial

Bug: 111307099
Test: builds, boots

Merged-In: I7cf75e473ee1e2837940606c71d15be26db0c3f2
Change-Id: I7cf75e473ee1e2837940606c71d15be26db0c3f2
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-01-20 22:04:43 +00:00
xunchang
53158e51d0 Fix potential size overflow in blockimg.cpp
Switch to 64 bit integers since the size of the entire src/tgt images may
not fit in size_t of ILP32.

There are other theoretical overflow cases in memory allocation and I/O
functions. However, they reside within a single transfer command and are
less likely to happen. I will evaluate and address them in separate
cls.

Test: unit tests pass
Bug: 122461124
Change-Id: Ib719ee695920877458fcfaa25c6ac058a5bbabf2
2019-01-17 09:26:12 -08:00
Treehugger Robot
725d7f8dfd Merge "e2fsck_static is no longer needed for remount" 2019-01-17 01:43:33 +00:00
Hridya Valsaraju
6f44c11357 e2fsck_static is no longer needed for remount
Remount will instead use overlayfs. If the device is not configured
to use overlayfs or if the device does not support dynamic partitions
but has chosed to setup an ext4-dedupe filesystem, e2fsck_static must
then be included in recovery.

Bug: 122115286
Test: fastboot flashall
Change-Id: I931282dbc67ff4ef53291bcbc5a078b500e5e807
2019-01-16 23:42:55 +00:00
Tao Bao
594a63cc9d Merge "screen_ui: Trivial fix to append newline when logging." 2019-01-16 23:14:09 +00:00
Tao Bao
a00b449e1f screen_ui: Trivial fix to append newline when logging.
Noticed while debugging other issues.

Test: Boot and check recovery.log.
Change-Id: Id92265cff287b9de89efe5eea85581e63e31aeb2
2019-01-16 09:31:12 -08:00
Yifan Hong
27aa9404fc Merge "updater: add functions to modify dynamic partition metadata" 2019-01-16 00:10:58 +00:00
Yifan Hong
8ff84d7cfb updater: add functions to modify dynamic partition metadata
Test: sideload full OTA on cuttlefish
Test: sideload incremental OTA on cuttlefish (that grows
      system, shrinks vendor, and move vendor to group foo)
Test: verify that /cache/recovery/cc46ebfd04058569d0c6c1431c6af6c1328458e4
      exists (sha1sum of "system")

Bug: 111801737

Change-Id: Ibdf6565bc1b60f3665c01739b4c95a85f0261ae5
2019-01-14 14:01:13 -08:00
Yifan Hong
7a0b65472b Merge "Create stash dir recursively." 2019-01-14 20:56:57 +00:00
Yifan Hong
63f5260c6c Create stash dir recursively.
When applying an OTA package onto the device in OTA mode,
if the recovery logs haven't been viewed, there is a chance
that /cache/recovery does not exist. Then, stash creation will
fail. Create stash directories recursively to avoid this error.

Test: without /cache/recovery, sideload the OTA on cuttlefish
Change-Id: I5cc01a067d866476a3594e795dcb5b15649e817b
2019-01-11 15:13:22 -08:00
Tao Bao
22a27f9965 Merge "Use dynamically linked f2fs executables." 2019-01-08 19:49:20 +00:00
Yifan Hong
08a8b40c91 Merge "updater: erase ignores EOPNOTSUPP for BLKDISCARD" 2019-01-08 00:06:40 +00:00
Yifan Hong
363d624d53 updater: erase ignores EOPNOTSUPP for BLKDISCARD
Test: sideload on cuttlefish
Bug: 111801737
Change-Id: I784a2142049054f38d6b70c7af7e88a451996d83
2019-01-04 15:24:52 -08:00
Tao Bao
72aa58dcf7 Merge "minadbd: daemon_service_to_fd takes std::string_view." 2019-01-02 21:13:14 +00:00
Tao Bao
5de19e2e02 minadbd: daemon_service_to_fd takes std::string_view.
The caller of daemon_service_to_fd() in core adb has switched to
std::string_view in [1]. The mismatch breaks the sideload service, as it
picks up the wrong daemon_service_to_fd() when serving sideload.

[1] https://android-review.googlesource.com/c/platform/system/core/+/850392

Bug: 122171762
Test: `adb sideload` on taimen.
Change-Id: Ie828400768523c35c5576e2c029e38fc0ad0aff9
2019-01-02 09:40:46 -08:00
Tianjie Xu
fc0665c701 Merge "Add a horizontal line at the end of the graphic menu" 2018-12-21 19:00:47 +00:00
Tao Bao
c674dfb584 Use dynamically linked f2fs executables.
It also reduces the space cost for devices using f2fs (e.g. crosshatch).
/sbin/mkfs.f2fs   722560 => /system/bin/make_f2fs   49568
/sbin/sload.f2fs 1182456 => /system/bin/sload_f2fs 150032

Test: Build and boot recovery on crosshatch. Factory reset.
Test: Install a non-A/B OTA package that formats a f2fs partition.
Change-Id: Ibe70c8d91a1d07e1c78ff9eac19b1f7955800161
2018-12-20 14:47:11 -08:00
Tao Bao
f0c03e62a2 Merge "Clean up the arg setup for exec(3)." 2018-12-20 22:10:07 +00:00
xunchang
c7dbc735d2 Add a horizontal line at the end of the graphic menu
This is in line with the old behavior and the UI of TextMenu.

Bug: 121280655
Test: check the menu
Change-Id: I4b82b93187b2d02cfe5b31a9a8fb621d10dd5d8a
2018-12-20 11:36:55 -08:00
Tao Bao
3d69f0df96 Clean up the arg setup for exec(3).
Test: Build and boot into recovery on marlin. Factory reset.
Test: Build and install a non-A/B OTA that calls format.
Change-Id: I72416e775e237fc15ca5eff1036175a9eef43b76
2018-12-20 10:46:06 -08:00
Yifan Hong
82fc6ae5b8 Merge changes from topic "vintf_object_recovery_mount"
* changes:
  roots.cpp: convert to C++ Fstab
  Move parts of roots.cpp to libfs_mgr
2018-12-19 22:19:52 +00:00
Yifan Hong
d81b8e3d77 roots.cpp: convert to C++ Fstab
Convert code to use C++ Fstab struct and C++ std::strings.

Bug: 62292478
Bug: 118634720
Test: boots
Change-Id: Ibdc1df5831bc885d7c1574419f41af026e49a137
2018-12-18 15:57:29 -08:00
Yifan Hong
0f339e27bb Move parts of roots.cpp to libfs_mgr
Move some mounting functionalities to libfs_mgr.

Test: run recovery tests

Bug: 118634720
Bug: 113182233

Change-Id: Ie59376664a744992429f0262ec96d13a1aed30f9
2018-12-18 15:57:29 -08:00
Zhomart Mukhamejanov
2e7393dbde Merge "Add verification before downloading whole package" 2018-12-18 06:19:59 +00:00
Zhomart Mukhamejanov
c18d488658 Add verification before downloading whole package
UpdateEngine has a feature that verifies
payload without downloading the whole update package.

If UpdateEngine detects invalid payload,
the sample app aborts the update.

No JUnit tests, because it accesses files on the
device and migrating tests to robolectric
is not worth for this sample app.

Bug: 77150191
Test: device
Change-Id: Ib8ce73508a02cf5fdcb326d8ba46c1d05ed5efe5
2018-12-17 14:24:25 -08:00
Zhomart Mukhamejanov
2e33cbeb20 Merge "Add PrepareUpdateService." 2018-12-17 22:19:25 +00:00
Treehugger Robot
a8d712ec50 Merge "use epoll_create1" 2018-12-17 21:57:27 +00:00
Tao Bao
dfbdaf3f1d Merge "applypatch: Fix comparison of integers of different signs." 2018-12-17 21:22:41 +00:00
Zhomart Mukhamejanov
bc07775393 Add PrepareUpdateService.
It's moved from PrepareStreamingService intent service.
Now PrepareUpdateService takes an UpdateConfig and
builds PayloadSpec for UpdateEngine for both streaming
and non-streaming update.

It allows us to do all preparations in intent service's
thread, without blocking UI.

We will also add checksum verification to
PrepareUpdateService.

Test: device, junit
Bug: 77150191
Change-Id: I15c0bc58e3238bea6ea1c4f13063575e2def89c1
Merged-In: Iea69acd9aa41e17538c26aff60f7598093ca7744
2018-12-17 10:56:28 -08:00
Tao Bao
7ebef8fd40 applypatch: Fix comparison of integers of different signs.
bootable/recovery/applypatch/imgpatch.cpp:57:3: error: comparison of integers of different signs: 'unsigned int' and 'int' [-Werror,-Wsign-compare]
  CHECK_GT(expected_target_length, 0);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bootable/recovery/applypatch/freecache.cpp:145:50: error: comparison of integers of different signs: 'long' and '__fsblkcnt64_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
  if (sf.f_bsize == 0 || free_space / sf.f_bsize != sf.f_bavail) {
                         ~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~
bootable/recovery/applypatch/freecache.cpp:190:16: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
  if (free_now >= bytes_needed) {
      ~~~~~~~~ ^  ~~~~~~~~~~~~
bootable/recovery/applypatch/freecache.cpp:233:18: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (free_now >= bytes_needed) {
        ~~~~~~~~ ^  ~~~~~~~~~~~~

Test: `mmma -j bootable/recovery/applypatch` with -Wsign-compare
Test: Run recovery_unit_test on marlin.
Change-Id: I4aa1fd0f9b7205b9e4e50874fc4bccb62951e7fe
2018-12-17 10:07:27 -08:00
Nick Kralevich
39c53c8ac9 use epoll_create1
epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC)
instead.

Bug: 120983106
Test: compiles and boots
Change-Id: I91f213ebb2dd05330dd25ec1ca1fec59b611e7f2
2018-12-17 08:51:38 -08:00
Tianjie Xu
c456aab7e2 Merge "Show wipe data confirmation text in recovery mode" 2018-12-11 23:24:05 +00:00
Tianjie Xu
1a0a30a16a Show wipe data confirmation text in recovery mode
After we generate the localized confirmation text images for certain dpi,
we can now load these images and display them under recovery. Devices that
cannot load the images will use the backup text strings as before.

Bug: 74397117
Test: check the menu with multiple locales, and check all the images locally
with locale test, check the fall back strings.
Change-Id: Ic31a55670026c909ec7a05cb0bb4a0fc1d5d15c7
2018-12-11 23:23:41 +00:00
Tao Bao
ceab300864 Merge "tests: Temporarily disable ScreenRecoveryUITest tests." 2018-12-07 16:31:18 +00:00
Tao Bao
f242a7ec2c tests: Temporarily disable ScreenRecoveryUITest tests.
Seems they're racing with SurfaceFlinger in acquiring the display, which
occasionally takes down the device and leads to test failures.

Bug: 120601844
Test: Run recovery_unit_test on marlin. ScreenRecoveryUITest not
      triggered.
Change-Id: I80b21595247a87fc1f2f95aa68df59f58bdf0257
2018-12-06 13:05:05 -08:00
Treehugger Robot
5de42a592a Merge changes Id946ab1c,Ifacd01d6
* changes:
  uncrypt: Fix the comparison in FindBlockDevice().
  uncrypt: Replace a few C-strings with std::string.
2018-12-06 17:47:46 +00:00
Tao Bao
bb134b2613 uncrypt: Fix the comparison in FindBlockDevice().
Previously it considered a match if the given path (i.e. path to an
update package) fully equals to a mount_point.  For example, `uncrypt
/data block.map` or `uncrypt /vendor block.map` would exit successfully,
without producing a block map.

Test: `uncrypt /path/to/package.zip block.map`
Test: `uncrypt /vendor block.map` fails.
Change-Id: Id946ab1c0b158b623013f89463cbb1960141d8b5
2018-12-05 14:44:32 -08:00
Tao Bao
d1670a064d uncrypt: Replace a few C-strings with std::string.
Also use android::base::{Dirname,Realpath,StartsWith}.

Test: Run uncrypt on device (`uncrypt package block.map`).
Change-Id: Ifacd01d6b35d85ea4afcb93a0dbc0235bb765a75
2018-12-05 14:44:24 -08:00
Tom Cherry
62040c53e0 Merge "Move some small users of fstab to new C++ Fstab" 2018-12-05 00:36:14 +00:00
Tom Cherry
772c93ca5c Move some small users of fstab to new C++ Fstab
Bug: 62292478
Test: tree-hugger
Change-Id: Ie2cc10e5168ef3b9dcc42f88e67a1ccd1175fcc5
2018-12-04 11:11:14 -08:00