Commit graph

2112 commits

Author SHA1 Message Date
Elliott Hughes
8febafa67e Use BoringSSL instead of mincrypt to speed up package verification.
This changes the verification code in bootable/recovery to use
BoringSSL instead of mincrypt.

Cherry-pick of 452df6d99c, with
merge conflict resolution, extra logging in verifier.cpp, and
an increase in the hash chunk size from 4KiB to 1MiB.

Bug: http://b/28135231
Change-Id: I1ed7efd52223dd6f6a4629cad187cbc383d5aa84
2016-04-13 16:39:56 -07:00
Yabin Cui
a58a6dbe3d uncrypt: split libbootloader_message_writer for reuse.
init and vold also need to write bootloader message, so
split this function from uncrypt into a separate library.

Bug: 27176738
Change-Id: If9b0887b4f6ffab6162d9cb47a6ceb7eedd60b4d
2016-04-08 11:46:56 -07:00
Bill Yi
b162551a30 Merge "Import translations. DO NOT MERGE" into nyc-dev 2016-04-05 18:44:50 +00:00
Bill Yi
c1afe830cf Import translations. DO NOT MERGE
Change-Id: Ic643d0e2d39e45d772ffb25001de45afdf923579
Auto-generated-cl: translation import
2016-04-05 11:13:59 -07:00
Mark Salyzyn
a569727609 recovery-persist: pick up both pstore console files
(cherry pick from commit 5f7111ff4d)

- Volantis console-ramoops-0 (upstream correct)
- Angler console-ramoops
- Bullhead console-ramoops
- Shamu console-ramoops

NB: Shamu also has kernel crashes in other pstore files,
    not merging them in.

Bug: 27176738
Change-Id: Ib6eef3e25475935b89252f51c960719c7860511a
2016-04-05 07:46:34 -07:00
Bill Yi
f75b6e47de Import translations. DO NOT MERGE
Change-Id: Ia0012b89f00c65ec6056d29612748e60564bab32
Auto-generated-cl: translation import
2016-04-04 17:59:17 -07:00
Mark Salyzyn
13aca598f8 recovery: use __android_log_pmsg_file_write for log files
(cherry-pick from commit a4f701af93)

- Add call to __android_log_pmsg_file_write for recovery logging.
- Add call to refresh pmsg if we reboot back into recovery and then
  allow overwrite of those logs.
- Add a new one-time executable recovery-refresh that refreshes pmsg
  in post-fs phase of init. We rely on pmsg eventually scrolling off
  to age the content after recovery-persist has done its job.
- Add a new one-time executable recovery-persist that transfers from
  pmsg to /data/misc/recovery/ directory if /cache is not mounted
  in post-fs-data phase of init.
- Build and appropriately trigger the above two as required if
  BOARD_CACHEIMAGE_PARTITION_SIZE is undefined.
- Add some simple unit tests

NB: Test failure is expected on systems that do not deliver either
the recovery-persist or recovery-refresh executables, e.g. systems
with /cache. Tests also require a timely reboot sequence of test
to truly verify, tests provide guidance on stderr to direct.

Bug: 27176738
Change-Id: I17bb95980234984f6b2087fd5941b0a3126b706b
2016-03-31 13:52:54 -07:00
Bill Yi
f1b2785129 Import translations. DO NOT MERGE
Change-Id: Id992a2cff5d431b5862f7c27f3823dbffe52f5c7
Auto-generated-cl: translation import
2016-03-30 22:15:27 -07:00
Yabin Cui
912e87e91d Merge "uncrypt: fix call to close()." into nyc-dev 2016-03-29 22:48:08 +00:00
Yabin Cui
ffa3a1c222 uncrypt: fix call to close().
Bug: 27897229
Change-Id: Iab5e829af1676f7fcd8a4b00a194aa679ed4e372
2016-03-29 15:35:58 -07:00
Yabin Cui
61799baba3 uncrypt: remove --read-bcb option.
Bug: 27897241
Change-Id: I4f52ada58e8f204dba8c974ea0ae03876411ecf0
2016-03-29 14:33:35 -07:00
Tianjie Xu
1ee0ff3d78 Add string for Installing_security_update
Bug: 27837319
Change-Id: I037158697a294c3e03f186f3b4207ea700321a8a
2016-03-28 18:16:15 -07:00
Elliott Hughes
cc79490fa8 Move recovery_l10n here from development/tools.
Bug: http://b/27837319

(cherry picked from commit 3d0153a807)

Change-Id: Iec2cd10fa77ed1881d55ac4e0ab48e45172f0cf7
2016-03-26 08:45:51 -07:00
Tianjie Xu
adca297943 Merge "Skip stashing source blocks in verify mode" into nyc-dev 2016-03-24 00:33:46 +00:00
Tianjie Xu
0188935d55 Skip stashing source blocks in verify mode
Currently block_image_verify() stashes source blocks to /cache and
in some case triggers I/O errors. To avoid this risk, We create
a map from the hash value to the source blocks' range_set. When
executing stash command in verify mode, source range is saved but block
contents aren't stashed. And load_stash could get its value from
either the stashed file from the previous update, or the contents on
the source partition specified by the saved range.

Bug: 27584487
Bug: 25633753
Change-Id: I775baf4bee55762b6e7b204f8294afc597afd996
2016-03-23 15:19:18 -07:00
Jed Estep
88dd7796a1 Correct caching behavior for should_inject_cache
Bug: 27800498
Change-Id: I5255283c1d04a385ed719c5bc2be461cae9f3648
2016-03-22 17:57:23 -07:00
Jed Estep
ff6df890a2 Control fault injection with config files instead of build flags
Bug: 27724259
Change-Id: I65bdefed10b3fb85fcb9e1147eaf0687d7d438f4
2016-03-18 17:58:25 -07:00
Prashant Malani
9020e0f141 recovery: Move SwipeDetector into common location
The SwipeDetector class is used almost unchanged in all locations.

This patch moves it into the recovery module, from which devices can
reference it if required.

The class is now renamed to WearSwipeDetector.

Bug: 27407422
Change-Id: Ifd3c7069a287548b89b14ab5d6d2b90a298e0145
2016-03-18 06:03:21 +00:00
Tao Bao
ce5868862a Revert "DO NOT MERGE Control fault injection with config files instead of build flags"
This reverts commit f73abf36bc.

Bug: 27724259
Change-Id: I1301fdad15650837d0b1febd0c3239134e2b94fb
2016-03-17 22:29:23 +00:00
Jed Estep
f73abf36bc DO NOT MERGE Control fault injection with config files instead of build flags
Bug: 26570379
Change-Id: I76109d09276d6e3ed3a32b6fedafb2582f545c0c
2016-03-16 12:36:57 -07:00
Greg Kaiser
0222db01fd Merge "otafault: Fix setting of have_eio_error." into nyc-dev 2016-03-14 20:44:36 +00:00
Greg Kaiser
f4300bc126 otafault: Fix setting of have_eio_error.
There was one case (ota_fsync, under TARGET_SYNC_FAULT, when the
filename was cached) where we were not setting have_eio_error
prior to returning.  We fix that.

Change-Id: I2b0aa61fb1e821f0e77881aba04db95cd8396812
2016-03-14 12:15:24 -07:00
Jed Estep
761653a4ad Merge "Port applypatch.sh tests to recovery_component_tests" into nyc-dev 2016-03-12 02:44:26 +00:00
Jed Estep
b8a693bbc7 Port applypatch.sh tests to recovery_component_tests
Bug: 27135282
Change-Id: If53682b591397ddfdb84860a3779b612904d4489
2016-03-11 18:37:34 -08:00
Prashant Malani
20df4adead Merge "recovery: Remove SetColor, and other refactoring for WearUI" into nyc-dev 2016-03-12 00:36:33 +00:00
Prashant Malani
7a491225bb recovery: Remove SetColor, and other refactoring for WearUI
The only difference from SetColor in ScreenRecoveryUI is the that the
LOG messages have slightly different colors. That's not enough to
warrant a duplicate function. So this patch removes SetColor and uses
the parent class version.

This patch also moves the DrawTextLine* functions into ScreenRecoveryUI
since they're mostly the same. It also moves char_width and char_height
into the class instead of keeping them as static variables.

Bug: 27407422
Change-Id: I30428c9433baab8410cf710a01c9b1c44c217bf1
2016-03-11 15:22:20 -08:00
Yabin Cui
1c522df25f applypatch: use vector to store data in FileContents.
Cherry pick this patch because it fixes the problem that
a newed Value is released by free().

Bug: 26906416
Change-Id: Ib53b445cd415a1ed5e95733fbc4073f9ef4dbc43
(cherry picked from commit d6c93afcc2)
2016-03-11 11:11:11 -08:00
Prashant Malani
0ba21cff07 recovery: Remove duplicate variables and functions
The function that modifies rtl_locale exists only in the base class,
and so the variable should not have a duplicate in the derived class,
otherwise there may be incosistent values when it is read by the derived
class (the thinking being that invoking the function will modify the
base class version of the variable, and not the derived class version).

Remove the updateMutex variable, and instead re-use the one in the base
class.

Also remove LoadBitmap from WearUI since it is identical to the one in
ScreenRecoveryUI.

Bug: 27407422
Change-Id: Idd823fa93dfa16d7b2c9c7160f8d0c2559d28731
2016-03-10 15:36:31 -08:00
Tianjie Xu
d345de66ef Merge "Reboot and retry on I/O errors" into nyc-dev 2016-03-10 21:27:26 +00:00
Tianjie Xu
fa12b9737d Reboot and retry on I/O errors
When I/O error happens, reboot and retry installation two times
before we abort this OTA update.

Bug: 25633753
Change-Id: Iba6d4203a343a725aa625a41d237606980d62f69
(cherry picked from commit 3c62b67faf)
2016-03-10 11:50:28 -08:00
Prashant Malani
f7f9e50528 Revert "recovery: More refactoring of WearUI"
This reverts commit 1c7b2230d8.

This change can lead to the derived class indirectly (and incorrectly) calling some functions from the base class, which can lead to unpredictable behavior.

Bug: 27407422
Change-Id: I126a7489b0787dc195e942e2ceea6769de20d70c
2016-03-10 03:40:20 +00:00
Prashant Malani
1c7b2230d8 recovery: More refactoring of WearUI
This patch performs the following modifications:
- Remove setBackground function, and currentIcon member variable.
- Remove common Progress*, Redraw and EndMenu functions.

Bug: 27407422
Change-Id: Ic3c0e16b67941484c3bc1d04c9b61288e8896808
Signed-off-by: Prashant Malani <pmalani@google.com>
2016-03-08 15:56:54 -08:00
Prashant Malani
7d9fd96dc9 recovery: Begin refactor of WearUI to use ScreenRecoveryUI
This is the first of a series of changes which move WearUI to subclass
ScreenRecoveryUI, to take advantage of several functions which are
common between the two recovery UI implementations, and already defined
in ScreenRecoveryUI.

This patch changes the base class of WearUI, removes redundant
header includes, and also removes a common function.

Bug: 27407422

Change-Id: I8fd90826900f69272a82e23bd099790e8004d511
2016-03-08 14:37:49 -08:00
Alex Deymo
1731f2980b Merge "Restore labels on /postinstall during recovery." into nyc-dev 2016-03-05 00:03:47 +00:00
Alex Deymo
080f522fb9 Restore labels on /postinstall during recovery.
This patch mirrors what was done in the main init.rc to relabel
/postinstall.

Bug: 27178350
Bug: 27177071

(cherry picked from commit 6bcc8af6e5)

Change-Id: I8320559f014cfb14216dcc350e016fc1db05cb14
2016-03-04 15:50:27 -08:00
Tao Bao
ae6408d1a2 recovery: Handle devices without /cache partition.
Since we may not have /cache partition on A/B devices, let recovery
handle /cache related operations gracefully if /cache doesn't exist.

(1) Disable the wipe for /cache partition.

(2) Skip wiping /cache while wiping /data (i.e. factory reset).

(3) Disable logging-related features, until we figure out better
ways / places to store recovery logs (mainly for factory resets on A/B
devices).

Bug: 27176738
Change-Id: I7b14e53ce18960fe801ddfc15380dac6ceef1198
(cherry picked from commit 26112e5870)
2016-03-04 12:23:10 -08:00
Tao Bao
3a2bb594df uncrypt: Communicate via /dev/socket/uncrypt.
We used to rely on files (e.g. /cache/recovery/command and
/cache/recovery/uncrypt_status) to communicate between uncrypt and its
caller (i.e. system_server). Since A/B devices may not have /cache
partitions anymore, we switch to socket communication instead.

We will keep the use of /cache/recovery/uncrypt_file to indicate the OTA
package to be uncrypt'd though. Because there is existing logic in
ShutdownThread.java that depends on the existence of the file to
detect pending uncrypt works. This part won't affect A/B devices without
/cache partitions, because such devices won't need uncrypt service (i.e
the real de-encrypt work) anyway.

Bug: 27176738
Change-Id: I481406e09e3ffc7b80f2c9e39003b9fca028742e
2016-03-02 23:23:32 -08:00
Prashant Malani
9db7964834 Merge "Fixes to wear recovery for N" into nyc-dev 2016-02-29 22:56:30 +00:00
Tao Bao
65f35b5c35 Merge "uncrypt: Retire pre-recovery service." into nyc-dev 2016-02-28 18:44:38 +00:00
Prashant Malani
0eb41c3f37 Fixes to wear recovery for N
Bug: 27336841

Change-Id: If4632e9791cce2c39590a4012687271f59a60af1
2016-02-26 17:01:37 -08:00
Paul Lawrence
661f8a69f2 Move recovery's convert_fbe folder to /tmp
The cache folder is no longer available at this time

Bug: 27355824
Change-Id: I74e33266c1ff407364981b186613f81319dd22dc
2016-02-25 13:07:16 -08:00
Josh Gao
0757a093c1 Merge "minadbd: update for adb_thread_create signature change." into nyc-dev 2016-02-24 00:50:36 +00:00
Yabin Cui
99281df8e2 recovery: check battery level before installing package.
Bug: 26879394

Change-Id: I63dce5bc50c2e104129f1bcab7d3cad5682bf45d
(cherry picked from commit 53e7a0628f)
2016-02-23 11:03:10 -08:00
Yabin Cui
089fe38ac5 Fix integer overflows in recovery procedure. am: 1273956e69 am: 5978a71d29 am: 877dcba47a am: f4ee1720f3 am: cae056f219 am: 682d691052 am: ae68f02272
am: a3604da6e1

* commit 'a3604da6e17afbf5b98f1eb2c5fc16bde1731b85':
  Fix integer overflows in recovery procedure.
2016-02-23 06:56:27 +00:00
Yabin Cui
a3604da6e1 Fix integer overflows in recovery procedure. am: 1273956e69 am: 5978a71d29 am: 877dcba47a am: f4ee1720f3 am: cae056f219 am: 682d691052
am: ae68f02272

* commit 'ae68f0227262d08f250e4cccda6f03b9981bf56d':
  Fix integer overflows in recovery procedure.
2016-02-23 06:53:47 +00:00
Yabin Cui
ae68f02272 Fix integer overflows in recovery procedure. am: 1273956e69 am: 5978a71d29 am: 877dcba47a am: f4ee1720f3 am: cae056f219
am: 682d691052

* commit '682d6910526a55e6a20e27cde3cf7515fa07a97b':
  Fix integer overflows in recovery procedure.
2016-02-23 06:50:58 +00:00
Yabin Cui
682d691052 Fix integer overflows in recovery procedure. am: 1273956e69 am: 5978a71d29 am: 877dcba47a am: f4ee1720f3
am: cae056f219

* commit 'cae056f21908173bcf2fa9a1724e46f16abb3258':
  Fix integer overflows in recovery procedure.
2016-02-23 06:47:37 +00:00
Yabin Cui
cae056f219 Fix integer overflows in recovery procedure. am: 1273956e69 am: 5978a71d29 am: 877dcba47a
am: f4ee1720f3

* commit 'f4ee1720f33a01518f79a2bf8df4664dab3564d4':
  Fix integer overflows in recovery procedure.
2016-02-23 06:44:46 +00:00
Yabin Cui
f4ee1720f3 Fix integer overflows in recovery procedure. am: 1273956e69 am: 5978a71d29
am: 877dcba47a

* commit '877dcba47ac311aa65b27e42b3625bcb58d84e47':
  Fix integer overflows in recovery procedure.
2016-02-23 06:42:07 +00:00
Yabin Cui
877dcba47a Fix integer overflows in recovery procedure. am: 1273956e69
am: 5978a71d29

* commit '5978a71d2954c7df02cbd0c51582ce4063346f77':
  Fix integer overflows in recovery procedure.
2016-02-23 06:35:46 +00:00