Commit graph

6943 commits

Author SHA1 Message Date
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
Treehugger Robot
8fc15c02bd Merge "C++17 is the default now." 2018-12-03 20:42:40 +00:00
Elliott Hughes
31b92a5d75 C++17 is the default now.
Test: builds
Change-Id: I91923da25f470621189589711c50f3d67e435c68
2018-12-03 09:27:17 -08:00
Treehugger Robot
a37aa092c7 Merge "Fix ensure_path_mounted_at for fsck_unshare_blocks" 2018-12-01 06:00:32 +00:00
Tianjie Xu
7846823125 Merge "ImageGenerator: ignore the duplicate locales" 2018-12-01 03:56:10 +00:00
Yifan Hong
d7b6858045 Fix ensure_path_mounted_at for fsck_unshare_blocks
Test: pass
Bug: 118634720
Change-Id: Icb2540892bd35659462f56c3883a39759f29eeab
2018-11-30 15:22:19 -08:00
Yifan Hong
cbfeb7f6af Merge "SYSTEM_ROOT -> get_system_root" 2018-11-30 22:07:24 +00:00
Tom Cherry
1f66578d6f Merge "Update for long long -> off64_t for fstab.length" 2018-11-30 16:33:54 +00:00
Tom Cherry
45e505a4e9 Update for long long -> off64_t for fstab.length
Test: boot
Change-Id: I755a5dd48f1d5be2cbd8e494b9c405674b12cebb
2018-11-29 13:33:07 -08:00
xunchang
a48f00a5e8 ImageGenerator: ignore the duplicate locales
Some language variants have the duplicated translations. Therefore,
we can compare the translated string for each locale to the default
text string for that language. And the duplicated ones will be skipped
to save some space.

Bug: 74397117
Test: generate and check the image
Change-Id: If51fa8fe700350c06f084f0e74d3698b82d6f177
2018-11-29 12:13:02 -08:00
Tianjie Xu
697003dbce Merge "ImageGenerator: Handle special characters in xml files" 2018-11-29 18:28:44 +00:00
xunchang
1eeee45a7d ImageGenerator: Handle special characters in xml files
In specific, the apostrophe appears as "\'"; and a new line appears as
"\n\n". We need to handle these two cases accordingly.

Bug: 74397117
Test: generate and check the image
Change-Id: I67b1ebce7494e4a685a0c7334da58dc6df2ccb29
2018-11-29 18:28:13 +00:00
Tianjie Xu
86936c46a8 Merge "ImageGenerator: switch to BreakIterator from icu library" 2018-11-28 18:27:58 +00:00
Jaegeuk Kim
4cd38430d7 Merge "make_f2fs: use -g android by default" 2018-11-28 00:57:25 +00:00
Treehugger Robot
c075d688fd Merge "Update README.md." 2018-11-28 00:50:44 +00:00
Yifan Hong
4932780606 SYSTEM_ROOT -> get_system_root
Add a get_system_root() function in roots.cpp
which returns / or /system based on fstab.
This factors out the 'if' check from recovery.cpp
and fsck_unshare_blocks.cpp.

Test: boot recovery, mount system
Bug: 118634720
Change-Id: If4947cba3a3f08dbe695fd2b50a9354cd302ee03
2018-11-27 15:57:47 -08:00
Tao Bao
a54b883607 Merge "minui: GRSurface::Create() computes data_size on its own." 2018-11-27 23:21:50 +00:00
xunchang
acacc9d30f ImageGenerator: switch to BreakIterator from icu library
The icu library takes care of the line boundary, so that we don't need
to worry about if the given language is logogram.

Bug: 74397117
Test: Generate and check the image
Change-Id: I1447f51b178c0fca83c5497d2f5b8e4009ca7f64
2018-11-27 15:11:04 -08:00
Tao Bao
2abb9fdc54 Update README.md.
The `ResourceTest` mentioned in the doc has been moved into
recovery_component_test in commit
6b28f05c5b.

Since Q, `/sbin/adbd` has been relocated to `/system/bin/adbd`. And `adb
shell` no longer requires mounting /system first, because
`/system/bin/sh` has been included in recovery image.

Test: N/A
Change-Id: I72029a6c8bfaac7a17c0a526a3c511de19356baa
2018-11-27 13:47:13 -08:00
Tao Bao
dd78982d58 minui: GRSurface::Create() computes data_size on its own.
GRSurface::Create() doesn't need to rely on caller specifying the buffer
size, as it can compute that info based on the given args.

This CL also uses `size_t` for all the parameters in
GRSurface::Create().

Test: Run recovery_unit_test on marlin.
Test: Build and boot into blueline recovery. `Run graphics test`.
Test: Build and boot into blueline charger mode.
Change-Id: Idec9381079196abf13553a475006fefcfca10950
2018-11-26 22:46:19 -08:00
Tao Bao
ea4ec3149b Merge "minui: Fix a wrong arg in calling GRSurface::Create()." 2018-11-27 04:52:56 +00:00
Tao Bao
2201d08f8d minui: Fix a wrong arg in calling GRSurface::Create().
This is a bug introduced while refactoring init_display_surface(), in
[1]. As a result, user of res_create_multi_display_surface(), which is
effectively `charger` right now, crashes due to buffer overrun.

This CL fixes the wrong arg and adds a sanity test for
res_create_multi_display_surface(). The testdata (battery_scale.png) is
copied from system/core/healthd/images/battery_scale.png.

[1] commit 44820ac1e3.

Bug: 119122296
Test: Run recovery_unit_test on marlin.
Test: Build and boot into charger mode on blueline. Verify that
      `charger` no longer crashes.
Change-Id: Ib6d083e1512a9c3c6eb63874d26d22658921d693
2018-11-26 17:06:53 -08:00
Tianjie Xu
fb8a636a2d Merge changes I7b7cee68,I07d22c0d
* changes:
  ImageGenerator: add an option to specify the supported locales
  Handle rendering problem for the word "Android" and punctuations
2018-11-26 22:03:29 +00:00
Tianjie Xu
7b636b64a1 ImageGenerator: add an option to specify the supported locales
A smaller list of locales helps to reduce the size of the generated
images; and mitigate the additional space requirement on the tight boot
image for some devices. The caller of the program will be responsible
for providing the locale list.

Also add a verbose option and switch to logger.

Bug: 74397117
Test: generate and check the image
Change-Id: I7b7cee681ccdc6e13fdd0575cf02f8add2ad9a2d
2018-11-26 10:44:24 -08:00
Tianjie Xu
542c617883 Handle rendering problem for the word "Android" and punctuations
The word "Android" is not translated. As a result, some locales fail to
render this word and some punctuations, leading to holes in the middle
of the text. In these cases, we will need to fall back to the default font
and re-measure the text width.

For now, we haven't handled the mix of latin and logogram languages; and
we can blacklist the problematic ones first.

Bug: 74397117
Test: generate and inspect the image
Change-Id: I07d22c0dae2e31eb74f2954e354cd39a42c22f14
2018-11-26 10:44:24 -08:00
Jaegeuk Kim
d65cde7c5a Merge "uncrypt: write permission for f2fs_pin_file" 2018-11-22 09:34:33 +00:00
Jaegeuk Kim
91e631d4dd make_f2fs: use -g android by default
Bug: 119875846
Change-Id: Ibff18ea6f92620852222fff4073379ec8afd0e10
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-11-21 12:53:09 -08:00
Jaegeuk Kim
051b9d87e2 uncrypt: write permission for f2fs_pin_file
We need a write permission to set a flag in the file.

Change-Id: I4896ecbe0fc04374e01d006b1c8acdb932e5d16d
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-11-21 12:52:29 -08:00
Tianjie Xu
14d5540426 Merge "Delete the dumpkey host tool" 2018-11-21 01:45:39 +00:00
Tianjie Xu
d01f664cae Merge "Import translations. DO NOT MERGE" 2018-11-21 01:45:22 +00:00
Treehugger Robot
b22bd959e5 Merge "logical -> dynamic partitions." 2018-11-16 23:35:28 +00:00
Yifan Hong
d17174c3e5 logical -> dynamic partitions.
Reflect a name change.
Test: boots
Test: boot into recovery
Bug: 119286600

Change-Id: I7c323f27574ce033b8fc1750aab00f7300c5cc84
2018-11-16 12:56:44 -08:00