Commit graph

352 commits

Author SHA1 Message Date
android-build-prod (mdb)
6fc9795fbe Merge "screen_ui: Drop the parameter in CheckBackgroundTextImages." am: 1f3a9c0a43
am: 730d541588

Change-Id: I6b5f29414be17ec8814c8729add689f0672270f0
2018-05-08 11:24:42 -07:00
Tao Bao
0a2c4e260f Merge "recovery: Remove unneeded include of minui.h." 2018-05-08 18:21:00 +00:00
Tao Bao
e5caa4095b Merge "recovery: Get UI and locale from device." am: d8abd2bd70
am: 07bf50a51d

Change-Id: Ia362ec6f81d04502be6cb0212b655577bbd33bb8
2018-05-08 10:46:01 -07:00
Tao Bao
39c4918a40 screen_ui: Drop the parameter in CheckBackgroundTextImages.
ScreenRecoveryUI already has the info in locale_.

Also when showing "Current locale: X/Y" on screen, use 1-based index for
X, so that we have 1 <= X <= Y.

Test: Build anf flash recovery image on aosp_bullhead-userdebug. Choose
      `Run locale test` from UI.
Change-Id: I5dd4de82e63890ddf755f4e23cd2290ad5d50ece
2018-05-07 23:50:50 -07:00
Jerry Zhang
2dea53ef2b recovery: Get UI and locale from device.
This removes some reliance on the global
locale and ui variables.

Test: Recovery works
Bug: 78793464
Change-Id: I78f1a2b321f5d50aa58b10735a73ae137283353a
2018-05-08 06:09:54 +00:00
Tao Bao
83ff1f0b05 recovery: Remove unneeded include of minui.h.
Test: mmma -j bootable/recovery
Change-Id: I1a79fa6386d56bf5e20ee074352d287403d2d745
2018-05-07 20:31:26 -07:00
Jerry Zhang
152933a28e recovery: Refactor logging code into logging.cpp
Move common logging related functions to
rotate_logs.cpp, and rename that to logging.cpp.

Test: Recovery works
Bug: 78793464
Merged-In: I00f20a79a296680122b8437d54a87897c5cb2fc7
Change-Id: I00f20a79a296680122b8437d54a87897c5cb2fc7
2018-05-07 14:14:17 -07:00
Jerry Zhang
cadf4ed451 recovery: Refactor logging code into logging.cpp
Move common logging related functions to
rotate_logs.cpp, and rename that to logging.cpp.

Test: Recovery works
Bug: 78793464
Change-Id: I00f20a79a296680122b8437d54a87897c5cb2fc7
(cherry picked from commit 3c3f211d1e)
2018-05-07 19:25:03 +00:00
android-build-prod (mdb)
13415d9138 Merge changes I1cc5d702,I32ab9854 am: 420f7f8df4
am: c4ba6b738f

Change-Id: I7696fb68e13e214ee830b9de1bf66dc6f1cac691
2018-05-04 10:43:36 -07:00
Tao Bao
2c52639d01 Move reboot() from common.h into otautil/sysutil.h.
This breaks the dependency on common.h (which belongs to
recovery/librecovery) from librecovery_ui. reboot() is now owned by
libotautil, which is expected to be a leaf node to be depended on.

With the change, recovery and updater also share the same reboot() code
now.

Test: mmma -j bootable/recovery
Change-Id: I1cc5d702cfe49302048db33d31c9c87ddc97ac71
2018-05-03 23:18:38 -07:00
Tao Bao
17054c051a otautil: Rename dir/sys/thermal utils.
Test: mmma -j bootable/recovery
Change-Id: I32ab98549e91f993364306e4a88dc654221b3869
2018-05-03 23:17:29 -07:00
Tao Bao
3777c4b859 Merge "Move menu headers/items to std::vector<std::string>." am: fb86bb2a07
am: 0d9ed29541

Change-Id: I7428f86e9bc3e46c5bcf0afeb3cf5608be31e470
2018-05-03 16:27:28 -07:00
Tao Bao
1fe1afe863 Move menu headers/items to std::vector<std::string>.
Test: mmma -j bootable/recovery
Test: Run recovery_unit_test on marlin.
Test: Build and boot into recovery image on angler. Check the UI that
      shows menu ('View recovery log', 'Wipe data', 'Run locale test').
Test: Start recovery with '--prompt_and_wipe_data'. Check the UI.
Change-Id: If8a4209e0bb4ca64f719f9f9465d3b3589a69cdc
2018-05-03 12:31:18 -07:00
Tao Bao
1875991c71 Merge "screen_ui: Drop the dependency on common.h." am: 738a4258d8
am: 30f2775b37

Change-Id: Id553c1f1de86fa292c0327f6fcc00fb8cd17bec3
2018-05-02 14:49:56 -07:00
Tao Bao
1d156b9882 screen_ui: Drop the dependency on common.h.
Remove the use of fopen_path() in screen_ui.cpp, as this is the only
place that requires the dependency on common.h. The mounting work should
be done by the caller.

Also change the parameter in RecoveryUI::ShowFile() from const char* to
const std::string&.

Test: mmma -j bootable/recovery
Test: Build and boot into recovery image on angler. Choose 'View
      recovery logs'.
Change-Id: I8e63f14a8e2b12b856e5a92476e4226cd6ea39fb
2018-05-02 12:46:21 -07:00
Tao Bao
f0fd4f5983 Merge "Add ScreenRecoveryUI::ShowMenu()." am: cac3ec3513
am: a2f44ebd09

Change-Id: Ifd9b438412fa2c2ca6d3bfcbfe3d620b15663070
2018-05-01 13:46:04 -07:00
Tao Bao
3aec6965bf Add ScreenRecoveryUI::ShowMenu().
From caller's PoV, RecoveryUI::{Start,Select,End}Menu should always be
used together, i.e. to show a menu and get user's selection. This CL
provides ShowMenu() as one-stop service (which is based on
get_menu_selection() from recovery.cpp).

Also move RecoveryUI::{Start,Select,End}Menu into ScreenRecoveryUI, with
a dropped access level from public to protected.

Due to the dependency on recovery / librecovery refactoring, will add
testcases in follow-up CLs.

Test: Build and boot into recovery image. Check the menus (main menu,
      'View recovery logs', 'Wipe data/factory reset').
Change-Id: Ie17aa78144871a12affd6f9075e045f76608a0ba
2018-05-01 10:27:40 -07:00
Tao Bao
6d99d4b457 recovery: Split main() into recovery_main.cpp.
This prepares for moving more codes from recovery into librecovery, so
that they will become more easily testable. recovery_main.cpp will be
the source code for recovery module, with the rest moved into
librecovery. recovery_main.cpp mainly does the initializations, such as
setting up the logger.

Test: mmma -j bootable/recovery
Test: recovery_component_test
Test: Build and boot into recovery image on marlin.
Change-Id: I8e846524546b6f3f0e32ed869e851f62261eef23
Merged-In: I8e846524546b6f3f0e32ed869e851f62261eef23
2018-05-01 09:48:00 -07:00
Tao Bao
2ac56afc7b recovery: Split main() into recovery_main.cpp.
This prepares for moving more codes from recovery into librecovery, so
that they will become more easily testable. recovery_main.cpp will be
the source code for recovery module, with the rest moved into
librecovery. recovery_main.cpp mainly does the initializations, such as
setting up the logger.

Test: mmma -j bootable/recovery
Test: recovery_component_test
Test: Build and boot into recovery image on marlin.
Change-Id: I8e846524546b6f3f0e32ed869e851f62261eef23
(cherry picked from commit c241cb662440551eb0d2f42345f7ee08cf60a7dd)
2018-04-30 21:04:55 -07:00
Tao Bao
c3674ab1b2 Merge changes I78839ed4,I75ac0e26 am: e4d65b681a
am: 040674586b

Change-Id: I27548f7aa4871b50584a0c88d33e6383755f648e
2018-04-30 12:58:47 -07:00
Tao Bao
aac9d9fcf8 recovery: Move a few constants closer to their uses.
Test: mmma -j bootable/recovery
Change-Id: I78839ed487ef41b4eaa3787cb7b4bf33fb0d164a
2018-04-30 10:57:36 -07:00
Tao Bao
406a6ff5e6 recovery: Fix the return value when failing to convert to FBE.
Test: Build and flash aosp_angler-userdebug. Choose 'Convert to file
      encryption' from Developer Options. Converting to FBE still works.
Change-Id: I75ac0e266af2d00bfaff0664f8bcee74a5f16b41
2018-04-30 10:55:59 -07:00
Tao Bao
5d096631ac Merge "recovery: Revoke (most of) short options." am: 3de3756081
am: 29c9690864

Change-Id: I25522cc339a561129e3a933c1c1c8a13e2caf44a
2018-04-27 16:20:02 -07:00
Tao Bao
f9f17347c8 recovery: Revoke (most of) short options.
`recovery` is not a command line tool, and these short options don't
have the common meanings that are used elsewhere.

In the platform code, we're not actively using the short forms.
 - bootable/recovery/uncrypt/uncrypt.cpp
 - bootable/recovery/updater/install.cpp
 - frameworks/base/core/java/android/os/RecoverySystem.java
 - system/core/adb/services.cpp
 - system/core/init/builtins.cpp
 - system/update_engine/hardware_android.cc
 - system/vold/cryptfs.cpp
(Callers must have used libbootloader_message.)

'--show_text' and '--just_exit' are not that obvious from the initial
commit messages. They appear to be used by vendor code (e.g.
'--show_text' is optionally used by bootloader, as in the noted bug). So
this CL keeps them as is for now.

Test: `mmma -j bootable/recovery`
Test: Check the code search for possible callers to recovery.
Change-Id: I8a87f5fb50131d647dfc8290381ca47a60f543fa
2018-04-27 12:34:14 -07:00
Tao Bao
6d90a9d4a0 recovery: Print the actually required battery level.
It should be one of BATTERY_OK_PERCENTAGE (20) and
BATTERY_WITH_CHARGER_OK_PERCENTAGE (15), depending on the charger state.

Also move the battery level related constants next to their users.

Test: mmma -j bootable/recovery
Test: Build and boot into recovery with a pending OTA. Check the log.
Change-Id: I7513f59c4718ec8e2db16c5266928470c2308648
(cherry picked from commit f2ea6d7999)
2018-04-26 15:30:14 -07:00
Tao Bao
f2ea6d7999 recovery: Print the actually required battery level.
It should be one of BATTERY_OK_PERCENTAGE (20) and
BATTERY_WITH_CHARGER_OK_PERCENTAGE (15), depending on the charger state.

Also move the battery level related constants next to their users.

Test: mmma -j bootable/recovery
Test: Build and boot into recovery with a pending OTA. Check the log.
Change-Id: I7513f59c4718ec8e2db16c5266928470c2308648
Merged-In: I7513f59c4718ec8e2db16c5266928470c2308648
2018-04-26 15:21:34 -07:00
Tao Bao
aae7efd7a2 Mark ui_print with __printflike.
And fix an issue as a result of the change.

Test: mmma -j bootable/recovery
Change-Id: I94e6384a1f39e9c37a8ed029d235142738d6e5d3
Merged-In: I94e6384a1f39e9c37a8ed029d235142738d6e5d3
2018-04-26 13:42:42 -07:00
android-build-prod (mdb)
7acf21c34a Merge "Rename CacheLocation to Paths." am: 49c7f1cec3
am: ce562bacfd

Change-Id: I5b084052f3f84a6e58e1267e58a125a7ed47080e
2018-04-26 09:43:25 -07:00
Tao Bao
641fa97def Rename CacheLocation to Paths.
We have a general need for overriding more paths (e.g. "/tmp"), mostly
for testing purpose. Rename CacheLocation to Paths, and use that to
manage TEMPORARY_{INSTALL,LOG}_FILE.

Test: mmma -j bootable/recovery
Test: recovery_component_test
Change-Id: Ia8ce8e5695df37ca434f13ac4d3206de1e8e9396
2018-04-25 21:46:00 -07:00
Paul Crowley
bd56ab163a Merge "Wipe the metadata partition when we wipe data." am: 897385bfe2
am: 62fd21b9bb

Change-Id: I338d7882e63abe9e78c2566b32c0fe28e2272614
2018-04-24 19:54:43 -07:00
Paul Crowley
3b4d516151 Wipe the metadata partition when we wipe data.
Bug: 78469201
Test: Wipe from recovery menu, check that wipe is logged correctly
    and boot works as expected.
Change-Id: I5bc8ef1b83d78de8b5edba6cc17882edcc744356
2018-04-24 17:08:22 -07:00
Tianjie Xu
f533e4adfd Merge "Do not skip the update installation if it's a retry" am: e566168c94
am: 2e0ac38d40

Change-Id: I6d9407a9a445643086caf2fd56cfbf7518524c0f
2018-04-02 23:49:58 +00:00
Tianjie Xu
a6f49bd952 Do not skip the update installation if it's a retry
We used to skip the update installation if the battery doesn't reach the
threshold or the boot reason is in blacklist. Afterwards, we just cleared
the BCB and reboot/shutdown the device. However, this leaves the device
in a brick state if the update is a retry; because a subsequent reboot
won't resume the update after the BCB gets cleared.

This CL skips the battery and bootreason check on retries. An alternative
solution is to conduct the check and shutdown the device without clearing the
BCB on INSTALL_SKIPPED; but users who don't have context may reboot the
device manually anyway.

Bug: 65288661
Test: Trigger the INSTALL_SKIPPED with insufficient battery, and check
the behavior with retry_count.

Change-Id: I0bd8ae9cee0e35aeeec3df469a78cec9ee1b8db8
2018-04-02 13:32:02 -07:00
Tianjie Xu
1ab7bf47a6 Merge "Detect interrupted update due to power off" am: d8fadfb606 am: d9caba2bbe
am: db20e41b0c

Change-Id: Ibd568f8881e3c9dd16c1567857d49badf9d4cdc2
2017-12-01 03:02:14 +00:00
Tianjie Xu
99b73be3a8 Detect interrupted update due to power off
An interrupted update may stash extra blocks in /cache, leading to a
failure when checking the cache size. We can save the incremented
retry_count in the BCB before installing the update; and distinguish
a fresh update from an interrupted one this way.

Bug: 68679601
Test: An interrupted update reapplies successfully.
Change-Id: Ic1403e1fd25a937c91ef34c14b92a0f6c8f1c0f4
2017-11-30 16:25:47 -08:00
Yifan Hong
e8e4c40246 is_battery_ok use health 2.0 HAL
Test: call is_battery_ok in graphics test, and test manually
Bug: 69268160
Bug: 63702641

Change-Id: Ifcf4d2e2cb459689c11fc5d1b880bb053aaae8ae
2017-11-14 11:29:53 -08:00
Tao Bao
99f0d9e52b Drop -Wno-unused-parameter.
The only one left is libedify. Will handle that in a separate CL.

Test: mmma bootable/recovery
Change-Id: I732a5f85229da90fd767bee2e46c5c95f529c396
2017-10-11 16:56:12 -07:00
Tao Bao
1fc5bf353a Revert "Revert "Move error_code.h into otautil.""
This reverts commit 26436d6d60 to re-land
"Move error_code.h into otautil.".

This way it stops requiring relative path ".." in LOCAL_C_INCLUDES
(uncrypt and edify). Soong doesn't accept non-local ".." in
"local_include_dirs".

This CL needs to land with device-specific module changes (e.g. adding
the dependency on libotautil).

Test: lunch aosp_{angler,bullhead,dragon,fugu,sailfish}-userdebug;
      mmma bootable/recovery
Change-Id: If193241801af2dae73eccd31ce57cd2b81c9fd96
2017-10-09 14:07:54 -07:00
Tao Bao
26436d6d60 Revert "Move error_code.h into otautil."
This reverts commit 623fe7e701.

Reason for revert: Need to address device-specific modules.

Change-Id: Ib7a4191e7f193dfff49b02d3de76dda856800251
2017-10-05 17:16:31 +00:00
Tao Bao
623fe7e701 Move error_code.h into otautil.
This way it stops requiring relative path ".." in LOCAL_C_INCLUDES
(uncrypt and edify). Soong doesn't accept non-local ".." in
"local_include_dirs".

Test: mmma bootable/recovery
Change-Id: Ia4649789cef2aaeb2785483660e9ea5a8b389c62
2017-10-04 08:55:24 -07:00
Tao Bao
3e18f2bf40 roots: Fix an issue with volume_for_path().
The earlier commit in 2dfc1a3898
unintentionally changed the behavior. It gives a different result when
looking up non-existent mount points (e.g. /cache on marlin).

The logic behind volume_for_path("/xyz") is unclear:
- It's fine to return non-null value if it's called by
  ensure_path_mounted() before accessing that file "/xyz". (Just based
  on the function name, we're not actually having this case.)
- It should return nullptr if the caller is interested in the existence
  of that particular mount point "/xyz".

This CL renames the function to volume_for_mount_point(), which does an
exact match by querying the given mount point from libfs_mgr. The former
volume_for_path() has been moved down to function scope for serving
ensure_path_mounted() only.

Test: Build and boot into recovery on bullhead and marlin respectively.
      'View recovery logs'.
Test: 'Mount /system'
Test: 'Apply update from ADB'
Change-Id: I1a16390f57540cae08a2b8f3d439d17886975217
2017-10-02 11:18:13 -07:00
Tianjie Xu
29d5575fa8 Add a new option in recovery menu to test the background texts
Add a new option "Run locale test" to check the background text
images (i.e. texts for "erasing", "error", "no_command" and "installing"
with different locales.)

Use volume up/down button to cycle through all the locales embedded in
the png file, and power button to go back to recovery main menu.

Test: Run locale test with bullhead.
Change-Id: Ib16e119f372110cdb5e611ef497b0f9b9b418f51
2017-09-27 00:27:38 -07:00
Tao Bao
bd0ddcd5e8 Remove EXPAND/STRINGIFY macros.
This reverts commit 8be0f39fec to reland
the change that removes EXPAND/STRINGIFY macros.

It's error-prone by putting anything into a string (e.g.
EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we
forgot to pass -DRECOVERY_API_VERSION=3).

The initial attempt put RECOVERY_API_VERSION into common.h, which might
be included by device-specific codes but without defining that when
compiling the module. This CL avoids the issue by using a constant
in the header, with a static_assert in recovery.cpp that guards the
consistency.

Test: recovery_component_test
Test: Sideload OTAs on bullhead and sailfish respectively.
Change-Id: I12af3f73392a85554ba703f04970ec9d984ccbaa
2017-09-13 10:51:09 -07:00
Tao Bao
623bac4ed9 Merge "screen_ui: Word-wrap menu headers."
am: 162b92323b

Change-Id: I93c959422c5b56a15875580159ecfc1a1d44087d
2017-08-16 05:07:55 +00:00
Tao Bao
2bbc6d642d 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
2017-08-15 15:10:21 -07:00
Tao Bao
5507c3d63c Merge "otautil: Clean up dirCreateHierarchy()."
am: 610712101b

Change-Id: I95350c4b2aab36dd89ea7813f2eb63d407b5f8ac
2017-07-31 00:15:43 +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
276ff4cc33 Merge "recovery: Fix the flickering when turning on text mode."
am: 771dfb0016

Change-Id: Ic85356b782c6b83725d85f2104fb30fc81ad2ed1
2017-07-25 18:57:38 +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
Tao Bao
4fb2825dc2 Merge "Avoid crashing recovery with unwritable /cache."
am: 9187f1cc51

Change-Id: Ie5708c2f703aefbfcad85ad0d2d24ae36b725c78
2017-07-21 23:22:31 +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
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
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
Jeff Vander Stoep
eba11fa574 Fix "No file_contexts" warning
am: e35926e1af

Change-Id: Ia050561286c30d8198f3185da9e3cd31372b1d79
2017-06-16 02:57:57 +00:00
Jeff Vander Stoep
e35926e1af Fix "No file_contexts" warning
Fixed by Loading the file_contexts specified in libselinux, whereas
previously recovery loaded /file_contexts which no longer exists.

Bug: 62587423
Test: build and flash recovery on Angler. Warning is gone.
Test: Wipe data and cache.
Test: sideload OTA
Change-Id: I11581c878b860ac5f412e6e8e7acde811f37870f
(cherry picked from commit 2330dd8733)
2017-06-15 21:24:29 +00:00
Tianjie Xu
6957555e29 Retry the update if ApplyBSDiffPatch | ApplyImagePatch fails
We have seen one case when bspatch failed likely due to patch
corruption. Since the package has passed verification before, we want
to reboot and retry the patch command again since there's no
alternative for users.

We won't delete the stash before reboot, and the src has passed SHA1
check. If there's an error on the patch, it will fail the package
verification during retry.

Bug: 37855643
Test: angler reboots and retries the update when bspatch fails.
Change-Id: I2ebac9621bd1f0649bb301b9a28a0dd079ed4e1d
2017-05-23 17:36:56 -07:00
Tianjie Xu
539b08cfcf Fix the input parameter for "set_retry_bootloader_message"
We're not updating argc & argv during get_args(), so some boot
arguments missed when we set the boot message for retry.

Bug: 38383406
Test: boot command sets correctly during retry attempt.
Change-Id: Ie8583a22fad5e0084245e3431d4018518d508dfd
(cherry picked from commit 72449c9f99)
2017-05-17 11:52:17 -07:00
Tianjie Xu
72449c9f99 Fix the input parameter for "set_retry_bootloader_message"
We're not updating argc & argv during get_args(), so some boot
arguments missed when we set the boot message for retry.

Bug: 38383406
Test: boot command sets correctly during retry attempt.
Change-Id: Ie8583a22fad5e0084245e3431d4018518d508dfd
2017-05-17 18:09:35 +00:00
Tao Bao
8be0f39fec Revert "Remove EXPAND/STRINGIFY macros."
This reverts commit ec9706738f.

Reason for revert: It's not a good idea to put RECOVERY_API_VERSION in
common.h, which might be included by device-specific codes (but with
RECOVERY_API_VERSION undefined).

Change-Id: I9feb9c64a5af3e9165164622a59b043aa28a8b8c
2017-05-04 00:31:11 +00:00
Tao Bao
ec9706738f Remove EXPAND/STRINGIFY macros.
They are error-prone by putting anything into a string (e.g.
EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we
forgot to pass -DRECOVERY_API_VERSION=3).

RECOVERY_API_VERSION is the only user (in bootable/recovery) that gets
stringified. Assign it to a typed var and sanity check the value.

Don't see other reference to the macros from device-specific recovery
directories (they can still define that locally if really needed).

Test: recovery_component_test
Test: Sideload an OTA on angler and marlin respectively.
Change-Id: I358bbdf8f0a99db5ce4c7bc2fdcafe8013501b64
2017-05-03 11:26:00 -07:00
Tao Bao
0150d013eb adb_install: Stop passing RecoveryUI as a parameter.
It's already a global declared in common.h which is included by
adb_install.cpp.

Remove '#include "minadbd/fuse_adb_provider.h"' that's not needed by
adb_install.cpp (minadbd takes care of that).

Test: mmma bootable/recovery
Change-Id: I6d08b7abc706b4b05de2ef46a57ced2204ad297e
2017-05-01 11:47:43 -07:00
Dmitri Plotnikov
ed9db0fd73 Adding support for quiescent reboot to recovery
Bug: 37401320
Test: build and push OTA and hit adb reboot recovery,quiescent. The screen should remain off throughout the upgrade process.

(cherry picked from commit 8706a98aa6)

Change-Id: I79789a151f6faafda8ecc6198c2182cc2a91da70
2017-04-27 16:31:11 -07:00
Treehugger Robot
0481faef77 Merge "Adding support for quiescent reboot to recovery" 2017-04-27 22:34:16 +00:00
Tao Bao
d8039acce6 recovery: Remove the include of adb.h.
recovery.cpp doesn't have a direct dependency on adb.h (only minadbd
does). 'adb.h' was once needed for DEFAULT_ADB_PORT, until being killed
by commit acb2a2fa4c.

Test: mmma bootable/recovery
Change-Id: I84f87988d01c3f0c3d1383cc3cffde2e7d5e7aea
2017-04-24 12:22:44 -07:00
Tianjie Xu
d9d16297dd Reboot the device on user build after the install fails
Users can't do much after the install fails with the device showing
"error" under recovery. So our best choice is to reboot the device
since sometimes the system image is still bootable (i.e. on package
verification failure). At worst the device would stuck in a boot loop
where the users need the same professional knowledge to recover as
before.

Behaviors after installation failure (including data wipe):
If recovery text is visible:
No change.

If recovery text is not visible:
Old behavior: Wait under "error" screen. Reboot after UI timeout (120s)
              if not connected to usb charger.
New behavior: Wait for 5s (shortens from the 120s timeout) under "error"
              screen and reboot (w or w/o charger).

sideload-auto-reboot (only available for userdebug):
Old behavior: Reboot immediately after installation failure.
New behavior: Wait for 5s under "error" screen and reboot.

Bug: 35386985
Test: On angler user, device auto reboots 5s after a failing OTA.

Change-Id: I3ff0ead86e2ccec9445d6a2865bc2c463855f23c
2017-04-21 22:49:30 +00:00
Dmitri Plotnikov
8706a98aa6 Adding support for quiescent reboot to recovery
Bug: 37401320
Test: build and push OTA and hit adb reboot recovery,quiescent. The screen should remain off throughout the upgrade process.
Change-Id: Ibed3795c09e26c4fa73684d40b94e40c78394d3f
2017-04-19 14:43:08 -07:00
Tianjie Xu
0a599567ce Merge "Add the missing sr-Latn into png files and rename the png locale header" am: 713d915636 am: dc235b5ab9
am: 5ec12126f0

Change-Id: Ia6b861c91958d3be23a4a7456d6d5d8e4a1607c8
(cherry picked from commit 9166f66eee)
2017-03-28 22:23:40 +00:00
Tianjie Xu
713d915636 Merge "Add the missing sr-Latn into png files and rename the png locale header" 2017-03-28 19:42:54 +00:00
Tianjie Xu
2078b22e41 Add the missing sr-Latn into png files and rename the png locale header
Switch the locale header in the png files from Locale.toString() to
Locale.toLanguageTag(). For example, en_US --> en-us and sr__#Latn
--> sr-Latn. Also clean up recovery a bit to expect the new locale
format.

Bug: 35215015
Test: sr-Latn shows correctly under graphic tests && recovery tests pass
Change-Id: Ic62bab7756cdc6e5f98f26076f7c2dd046f811db
2017-03-24 16:54:52 -07:00
Tao Bao
6014db5da6 Merge "Fix the wrong parameter when calling read_metadata_from_package()." 2017-03-24 20:11:53 +00:00
Tao Bao
1b2a98bda3 Fix the wrong parameter when calling read_metadata_from_package().
The call to read_metadata_from_package() is broken due to being passed
an invalid pointer (ZipArchiveHandle vs ZipArchiveHandle*). It's
introduced when switching from minzip to libziparchive. Compiler didn't
complain, because ZipArchiveHandle is typedef'd as void*, which legitly
accepts a void**.

Also clean up secure_wipe_partition() logs a bit by using android-base
logging.

Bug: 36427762
Test: Send a wipe package.
Change-Id: I791a0f09a066f1c257dae890e7ae13d02a02e78b
2017-03-24 11:02:05 -07:00
Paul Crowley
31ac0c61fe Reword the wipe warning message to be more comprehensible.
Test: My device was crashing anyway, so observed message on crash.
Bug: 34669779
Change-Id: Ib85d1d137139f5e14f735c972c2312acce2caf5f
2017-03-23 14:54:20 -07:00
Tao Bao
e1905adf66 recovery: Replace the hard-coded 1000 with AID_SYSTEM.
Test: mmma bootable/recovery
Change-Id: Icea5bd91a976957e8b6ab46e367345ff69a53ca4
2017-03-22 14:58:58 -07:00
Tao Bao
50dd532934 recovery: Fix the FIXME in get_menu_selection().
It used to return a REBOOT action on timeout, until the CL in commit
daefc1d442 that redefined the return value
of get_menu_selection() (changing from action to a menu index).

Prior to this CL, it was returning 0 (i.e. the value of Device::REBOOT)
to trigger the reboot. This CL specifies a return value of -1 to
indicate the timeout.

Test: Boot into a user build recovery; it reboots automatically on
      timeout (120 sec).
Change-Id: I4aedb7a4628bf258017078fe73eb8b48a21d0ea8
2017-03-07 15:35:17 -08:00
Tao Bao
fc5499f22b recovery: Move a few int to bool.
Most of the changes are trivial.

Also update a dead reference to device_handle_key() in device.h comment,
and add some comments to get_menu_selection() function.

Test: `mmma bootable/recovery`
Change-Id: I59ef9213ec88ab35c0e7b8a7813ccf9c56dbd5c5
2017-03-07 15:35:12 -08:00
Tao Bao
9bd1dced90 Merge "recovery: Drop the "--stages" / '-g' argument." 2017-03-07 20:28:06 +00:00
Tao Bao
1a575f8d5f Merge "recovery: Add SetStage() into 'Run graphics test'." 2017-03-07 20:02:15 +00:00
Tao Bao
08fc6beef8 recovery: Minor clean up to choose_recovery_file().
Test: 'View recovery logs' on bullhead and sailfish.
Change-Id: I53272b121e3e55e6fe4c77b71e3c2e819e72cb64
2017-03-07 00:57:08 -08:00
Tao Bao
a8d72bc3b4 recovery: Drop the "--stages" / '-g' argument.
This was introduced in commit c87bab1018.
But the stage info should be passed through BCB only (there's a
dedicated field in struct bootloader_message).

This CL removes it from recovery arguments, and also moves 'stage'
variable to std::string.

Test: 'stage' variable is not used by any device-specific recovery code.
Test: Code search shows no hit of '--stages' use.
Change-Id: Iccbde578a13255f2b55dd4a928e9ecf487f16b97
2017-03-07 00:12:06 -08:00
Tao Bao
db7e898080 recovery: Add SetStage() into 'Run graphics test'.
This allows a quicker test for stage UI.

Bug: 27804510
Test: 'Run graphices test' with the new recovery image.
Change-Id: I47689ae8e4cac6d7e5d1f6a10b9e393d50d713f3
2017-03-06 23:53:16 -08:00
Tao Bao
c9447cc505 recovery: Remember the last log position.
After reading one log entry, it should stay at the same menu position.

Test: 'View recovery logs' -> Read -> Exit
Change-Id: I4b579be4c2fe1e3a1dcc4873e128fd0b2d619ba3
2017-02-28 15:27:08 -08:00
Tao Bao
f7f1da3fb5 recovery: Don't show "No /cache partition found" on screen.
People have been confused by the message and thought that's an error.

Test: Boot recovery on sailfish; choose 'View recovery logs'.
Change-Id: I2c540f18d6493c1a129233d10ecbc96823dd3601
2017-02-24 10:16:18 -08:00
Tao Bao
c4a18efa84 recovery: Clean up browse_directory().
Get rid of the malloc/realloc/free'd menus.

browse_directory() will only be called on devices with SD card. Tested
the CL by temporarily setting SDCARD_ROOT to a different location.

Test: See above.
Change-Id: I935e1bf4bad0273e3dff87fa2536924f1219adb5
2017-02-10 21:21:52 -08:00
Tao Bao
3da880156b Replace _exit(-1) with _exit(EXIT_FAILURE).
-1 is not a valid exit status.

Also replace a few exit(1) with exit(EXIT_FAILURE).

Test: mmma bootable/recovery
Change-Id: I4596c8328b770bf95acccc06a4401bd5cabd4bfd
2017-02-03 14:11:11 -08:00
Tao Bao
efc35594dd recovery: Move property_get() to android::base::GetProperty().
Test: Apply two A/B incremental OTAs with the new recovery image. The
      one with incorrect pre-build should be blocked, while the other
      works fine.

Change-Id: I94d97eb8798599da1630f66343fb603e87464187
2017-01-13 12:08:34 -08:00
Tao Bao
570af9dca3 recovery: Fix the argument parsing.
Commit f0ed159f48 unintentionally changed
the behavior when parsing the arguments from BCB and command file. It
should only parse the command file for arguments if BCB doesn't supply
any.

As a result, it shows the following from the log:
I:Got 2 arguments from boot message
I:Got 3 arguments from /cache/recovery/command

Test: Set arguments in BCB and command file both. It should only use the
      arguments from BCB.

Change-Id: Idf371137aa9177f1b2dfdfecf0c9f46959d2ee76
2017-01-09 10:35:42 -08:00
Tao Bao
736d59c567 recovery: Fix the broken UI text.
UI text is broken (doesn't show any text during FDR) due to commit
d530449e54, which reordered the calls to
RecoveryUI::SetLocale() and RecoveryUI::Init().

Because Init() uses the locale info to load the localized texts (from
images), the locale must be set prior to that via SetLocale(). This CL
refactors Init() to take the locale parameter, and removes the odd
SetLocale() API.

Bug: 34029338
Test: 'Run graphics test' under recovery.
Change-Id: I620394a3d4e3705e9af5a1f6299285d143ae1b01
2017-01-03 22:40:03 -08:00
Paul Crowley
08404b48f7 Support a "ask before wiping" boot flag.
In the event of a catastrophic data error which should never happen,
ask the user before wiping the device.

Test: Cause an init builtin to fail and generate this error, observe.
Bug: 28693324
Change-Id: I38a2b815157d816cba1f30ad37eb4cdcc01db582
2016-12-21 13:38:48 -08:00
Tao Bao
2292db819b Add update_bootloader_message() to fix two-step OTAs.
This is a retry of commit 7e31f421a5.

Commit bd56f1590c switches to calling
write_bootloader_message(<options>) in get_args(), which
unintentionally resets the stage field thus breaks two-step OTAs.

This CL adds update_bootloader_message(<options>), which only sets
the command field (to "boot-recovery") and the recovery field (with
the specified options).

Bug: 33534933
Test: Apply a two-step package.
Test: recovery_component_test passes.
Change-Id: Ie0b1ed4053d2d3c97d9cb84310d616b28fcfc72e
2016-12-15 12:36:26 -08:00
Sen Jiang
8c1584feaf Merge "Add a stub recovery UI." 2016-12-14 21:50:49 +00:00
Tao Bao
c0336399ae Remove the obsolete comments for firmware update.
The corresponding code was removed in commit
e08991e02a in 2010 (Froyo).

Test: N/A
Change-Id: I2b296e1b07d54232bade79fda7501387d65a4c37
2016-12-13 22:36:02 -08:00
Sen Jiang
d530449e54 Add a stub recovery UI.
This allows recovery to work on devices without screen.
The stub recovery UI does nothing except print to stdout.

Test: write 'recovery\n--wipe_data\n--reason=wipe_data_from_ota\n'
      to misc and boot to recovery on a device without screen.
Bug: 33175036

Change-Id: Icde698aa2e2e29f4b3d0532dfd3c6a939ac2bc63
2016-12-13 13:29:33 -08:00
Tao Bao
3f5a3821be recovery: Clean up the log saving while wiping.
Test: Wipe /cache and check the logs.
      Wipe /data and check the logs.
Change-Id: I1968e3a0a9ed80134811a91508c4473f1dcdf953
2016-12-13 11:47:46 -08:00
Tao Bao
f038ca00f4 recovery: Remove obsolete code that supports "CACHE:foo" format.
The passing of "--update_package=CACHE:foo" format has been removed
in Gingerbread, with commit 4baf641e7d96375eba3f9a3aff5400b9e3d28cd6
in frameworks/base (core/java/android/os/RecoverySystem.java).

Test: Recovery image with --update_package still works.
Change-Id: I37b56ccf98f62cadf2a3975bbc38b16fea6fe9a1
2016-12-10 09:29:16 -08:00
Tao Bao
7d34fa17ab recovery: Fix the argument parsing from COMMAND_FILE.
Commit f0ed159f48 didn't ensure mounting
COMMAND_FILE (i.e. /cache) prior to reading. Also the first argument in
COMMAND_FILE should not be dropped (unlike the first "recovery" argument
in BCB message).

Bug: 33431888
Test: Push /cache/recovery/command and recovery imag parses the
      arguments successfully.

Change-Id: Ica3157a0bb03a2355315123354617eaf3fff15a4
2016-12-08 18:15:29 -08:00
Tao Bao
f0ed159f48 recovery: Clean up get_args().
Test: Boot into new recovery image, verify the parsed parameters.
Change-Id: Ieefafb26cc4147ce4cb9ced4297cdb3b5d1d3789
2016-12-05 11:39:46 -08:00
Tianjie Xu
e2d05c5658 Merge "Cleanup the duplicates of logs rotation functions" 2016-11-04 18:07:08 +00:00
Tianjie Xu
e113e4d67f Cleanup the duplicates of logs rotation functions
Bug: 32067516
Test: Logs rotated successfully on angler, recovery-refresh/persist tests
passed on an a/b device.

Change-Id: Ie80adf0fa958ad3d7869d2d17f49489666b86c29
2016-11-03 18:16:33 -07:00
Tao Bao
ac9d94d19c Revert "Revert "Some cleanups to recovery.""
This reverts commit 8584fcf677.

This CL re-lands commit c0319b60f5.
The "stage" and "reason" variables are now declared as global by
dropping the static qualifier, because they may be used by vendor
recovery libraries.

Test: lunch aosp_angler-userdebug; mmma bootable/recovery
Test: lunch aosp_dragon-userdebug; mmma bootable/recovery

Change-Id: I252c346f450079478cff22bbff01590b8ab2e2b3
2016-11-03 11:57:46 -07:00
Dan Albert
8584fcf677 Revert "Some cleanups to recovery."
This reverts commit c0319b60f5.

Reason for revert: Broke builds.

Change-Id: I82aa880b83de5ae6c36fd7567cb001920559a972
2016-10-27 03:08:08 +00:00
Tao Bao
c0319b60f5 Some cleanups to recovery.
- Remove the duplicate gCurrentUI variable in recovery.cpp;
- Refactor the load/save of locale functions;
- Clean up ui_print() to get rid of 256-byte buffer limit;
- Declare ui in common.h;
- Move the typedef of Volume into roots.h.

Test: Build and boot into recovery image.

Change-Id: Ia28c116858ca754133127a5ff9c722af67ad55b7
2016-10-26 14:36:42 -07:00
Tianjie Xu
06e57acf35 Skip update-on-boot for bootreason in blacklist
Skip the OTA installation when bootreason is 'kernel_panic',
'Panic' etc.

Change-Id: Ic1202492bffefa1a9d8d0e691b5af979285e552c
Test: On angler, ota installation skips for one bootreason in the blacklist.
Bug: 29978689
(cherry picked from commit 27b9fc8a36)
2016-10-25 22:32:19 -07:00
Yabin Cui
fd99a318fe Verify wipe package when wiping A/B device in recovery.
To increase the security of wiping A/B devices, let uncrypt write
wipe package in misc partition. Then recovery verifies the wipe
package before wiping the device.

Based on the original cherrypick, this CL also has additional changes to
address the LOG statements and libziparchive changes.

Bug: 29159185
Test: Build and boot into recovery.

Change-Id: I186691bab1928d3dc036bc5542abd64a81bc2168
(cherry picked from commit 6faf0265c9)
2016-10-19 11:19:15 -07:00
Tianjie Xu
bd56f1590c Clean up bootloader_message usage in recovery
Switch to using vector and string.

Test: bootloader message writes correctly on angler.
Change-Id: I95d5a1e584630db326bb4400f3a149b59ad30a9e
2016-10-19 00:50:56 +00:00
Yabin Cui
8b309f6970 Create bootloader_message static library.
bootloader_messages merges bootloader_message_writer
and bootloader.cpp, so we can use the same library to
manage bootloader_message in normal boot and recovery mode.

Bug: 29582118

Change-Id: I9efdf776ef8f02b53911ff43a518e035e0c29618
(cherry picked from commit 2f272c0551)
2016-10-18 11:37:05 -07:00
Tianjie Xu
8cf5c8f60f Replace minzip with libziparchive
Clean up the duplicated codes that handle the zip files in
bootable/recovery; and rename the library of the remaining
utility functions to libotautil.

Test: Update package installed successfully on angler.
Bug: 19472796

Change-Id: Iea8962fcf3004473cb0322b6bb3a9ea3ca7f679e
2016-10-17 17:41:51 -07:00
Mark Salyzyn
df1b6947ec No longer need android/log.h
Test: compile
Bug: 31992412
Change-Id: I5156590bfc94e46e9d282c197c3dd8c4bbd9e855
2016-10-07 14:19:48 -07:00
Tianjie Xu
7aa88748f6 Turn on -Werror for recovery
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.

Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
2016-09-29 19:21:24 -07:00
Tao Bao
95afc912fb Merge "Duplicate the last_install content into last_log." 2016-09-27 01:38:53 +00:00
Tao Bao
f4885adc18 Duplicate the last_install content into last_log.
Currently we save the OTA metrics in last_install, which keeps the data
for the _last_ install only. This CL logs the same content into last_log
so that we keep the metrics for every install.

Bug: 31607469
Test: Apply an update (via OTA and sideload) and check last_log and last_install.

Change-Id: Id8f174d79534fddc9f06d72a4e69b2b1d8ab186c
2016-09-26 14:46:12 -07:00
Elliott Hughes
cb22040c63 Switch to <android-base/properties.h>.
Bug: http://b/23102347
Test: boot into recovery.
Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e
Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e
2016-09-26 09:51:37 -07:00
Tianjie Xu
7b0ad9c638 Switch recovery to libbase logging
Clean up the recovery image and switch to libbase logging.

Bug: 28191554
Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35
Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
2016-09-01 18:33:25 +00:00
Josh Gao
acb2a2fa4c minadbd: rename adb_server_main to minadbd_main.
adb_server_main in adb refers to the adb server on the host, not adbd.
Since there doesn't seem to be a good reason to reuse the declaration
from adb's headers, give minadbd a main function of its own.

Change-Id: I748f1a6822dc14c726cb73ef3b533c57a6615608
2016-08-30 13:15:12 -07:00
Tianjie Xu
4e4474c9c5 Merge ""view recovery logs" will show /tmp/recovery.log"
am: c158cf0a14

Change-Id: I1485c1c84a7caa20b11da4fd2561e0dba95fc39b
2016-08-17 22:07:44 +00:00
Tianjie Xu
a54f75ede8 "view recovery logs" will show /tmp/recovery.log
For A/B devices, "view recovery logs" doesn't work due to the lack
of cache partition. To help debugging, we'll show /tmp/recovery.log
instead if /cache is not found.

Change-Id: Idb77c3a4c30388148a210b38d732a7b27e757bba
Test: Tested on an A/B device and /tmp/recovery.log showed up.
Bug: 30905700
2016-08-17 12:35:22 -07:00
Johan Harvyl
a550ee0df7 Merge "Handle error from fopen_path in finish_recovery"
am: 8a4333f3b9

Change-Id: I9225bcbe1ed82a63f70c7c6a984fd043ac77100b
2016-08-09 19:50:15 +00:00
Johan Harvyl
8569142147 Handle error from fopen_path in finish_recovery
The fopen_path will fail here e.g. if /cache is corrupt and could
not be mounted. Not properly handling an error code from
fopen_path() results in a boot loop into recovery as fwrite() on
a NULL FILE object will crash the recovery app.

Change-Id: I1ccff5a8cb620a32f32adfe97a3fae8e5e908f39
2016-08-08 08:28:30 +02:00
Chih-Hung Hsieh
977903da49 Merge \"Fix clang-tidy performance warnings.\"
am: 2a3b695168

Change-Id: I55cadf517ec612f1b03de71ce7ca5cff69bc80d0
2016-07-27 20:49:34 +00:00
Chih-Hung Hsieh
23abfd37a5 Fix clang-tidy performance warnings.
* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.

Bug: 30407689
Bug: 30411878
Change-Id: Iefab05c077367f272abf545036b853e8a295c8cd
Test: build with WITH_TIDY=1
2016-07-27 10:19:47 -07:00
Tianjie Xu
e5c6d47f52 Increase EIO retry count
am: c37c5c3410

Change-Id: Idfc957d24e6f5efe32cf68dc696355c456ffde34
2016-06-24 00:26:36 +00:00
Tianjie Xu
c37c5c3410 Increase EIO retry count
Increase the number of attempts of an OTA update from 3 to 5 in case
an I/O error happened. This should increase the success rate of the
update.

Bug: 29619468
Change-Id: I88a067d9debd55a07be22ed981f395f6e47ec28f
2016-06-23 17:15:25 -07:00
Tao Bao
ba33da2884 resolve merge conflicts of fe8e356 to nyc-dev-plus-aosp
Change-Id: I18ecc333a76860405028b90b0baf2fba78d3942e
2016-06-03 14:57:34 -07:00
Tao Bao
862a4c1119 recovery: Add support to brick a device.
When recovery starts with --brick, it tries to brick the device by
securely wiping all the partitions as listed in /etc/recovery.brick.

This is designed to support bricking lost devices.

Bug: 27253717
Change-Id: Ib0bd4f0a3bdaca4febc91fce6b682e3ec74354e2
2016-06-03 11:01:41 -07:00
Tianjie Xu
84478e8823 resolve merge conflicts of 50f6417 to nyc-dev-plus-aosp
Change-Id: I42c127f7946e678acf6596f6352f090abc0ca019
2016-05-23 12:24:28 -07:00
Tianjie Xu
162558382b Allow recovery to return error codes
Write error code, cause code, and retry count into last_install. So we
can have more information about the reason of a failed OTA.

Example of new last_install:
@/cache/recovery/block.map     package name
0                              install result
retry: 1                       retry count (new)
error: 30                      error code (new)
cause: 12                      error cause (new)

Details in:
go/android-ota-errorcode

Bug: 28471955
Change-Id: I00e7153c821e7355c1be81a86c7f228108f3dc37
2016-05-20 13:56:53 -07:00
Tao Bao
37c45027bb recovery: Always log the update attempt.
An OTA may be skipped due to low battery. But we should always log it to
understand why an update _fails_ to apply.

Bug: 27893175
Change-Id: I50a3fbbb3e51035e0ac5f1cca150e283852825c3
(cherry picked from commit 5687001895)
2016-05-02 21:27:43 -07:00
Tianjie Xu
cacb47b2a3 resolve merge conflicts of 5823dd4 to nyc-dev-plus-aosp
Change-Id: I4ec33904a6af38d81b422c7be6f40b828fbc7525
2016-05-02 18:09:26 +00:00
Tianjie Xu
5823dd46df Merge "Add ability to show "installing security update"" into nyc-dev 2016-05-02 17:38:17 +00:00
Tao Bao
e0c8a9bb02 recovery: Always log the update attempt.
am: 5687001895

* commit '568700189528c69a6cdd7a246127ce01463e033d':
  recovery: Always log the update attempt.

Change-Id: Ibf0d564c26bb5045fe24466a415dea13cd3a5a18
2016-05-02 16:32:41 +00:00
Tao Bao
5687001895 recovery: Always log the update attempt.
An OTA may be skipped due to low battery. But we should always log it to
understand why an update _fails_ to apply.

Bug: 27893175
Change-Id: I50a3fbbb3e51035e0ac5f1cca150e283852825c3
2016-04-29 15:41:25 -07:00
Tianjie Xu
35926c4b89 Add ability to show "installing security update"
Add a new command "--security" to boot commands. If this command is
observed as part of BCB, choose a different background text picture
for installing stage in recovery UI. As a result, users will see
"installing security update" instead of "installing system update"
when applying a security update package.

Bug: 27837319
Change-Id: I2e2253a124993ecc24804fa1ee0b918ac96837c5
2016-04-29 12:19:43 -07:00
Chih-hung Hsieh
0231e7016d Merge "Fix google-runtime-int warnings." am: a1f4a1e
am: bcad1d1

* commit 'bcad1d1ced730478c94f951034d252e777661332':
  Fix google-runtime-int warnings.

Change-Id: Ifad31026502e3375f4833899056662da540319b5
2016-04-18 22:34:41 +00:00
Chih-Hung Hsieh
54a2747ef3 Fix google-runtime-int warnings.
Bug: 28220065
Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592
2016-04-18 12:29:30 -07:00
Elliott Hughes
4846bc461c Merge "Update the system update animation." into nyc-dev
am: e8d0ecc

* commit 'e8d0ecccf7e54e73418cac94b0b136bfed94d51a':
  Update the system update animation.

Change-Id: I5d0ad44b13a505bca62a5316447603fab4d280aa
2016-04-15 20:00:26 +00:00
Elliott Hughes
498cda6ef6 Update the system update animation.
Switch to a Wear-like intro/loop system. We don't have an intro yet,
but hopefully this will let Wear delete more code when they move to N.
Unlike them, we don't hard-code the number of frames: we just look to
see what we have available. We do hard-code the fps though.

Also add a graphics test mode so you can see a demo of the UI components
without having to actually apply an OTA.

Also fix a bug where default locale is null rather than en-US: it's
more useful to show _some_ text if we don't have a locale (which should
only be during development anyway).

Bug: http://b/26548285
Change-Id: I63422e3fef3c41109f924d96fb5ded0b3ae7815d
2016-04-14 22:44:23 -07:00
Elliott Hughes
5c23b801e5 Merge "Move selinux dependencies out of header files." am: 8124750
am: dc91161

* commit 'dc91161a56c74bb6c73560d728d92b115f0f6e75':
  Move selinux dependencies out of header files.

Change-Id: I439d352c9366dbed201a5592059b886968324633
2016-04-02 16:06:57 +00:00
Elliott Hughes
4bbd5bf8a6 Move selinux dependencies out of header files.
Bug: http://b/27764900
Change-Id: Ib62a59edcb13054f40f514c404d32b87b14ed5f1
2016-04-01 18:24:39 -07:00
Mark Salyzyn
9b9e5843d2 Merge "recovery: use __android_log_pmsg_file_write for log files" am: 75da771
am: 6f83130

* commit '6f83130d7acd85df89a80e691d3aa63bd2ceda39':
  recovery: use __android_log_pmsg_file_write for log files

Change-Id: Id2e7a76bae8eb061f6f57249dd912f25cd6332c6
2016-03-31 21:00:59 +00: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
Mark Salyzyn
a4f701af93 recovery: use __android_log_pmsg_file_write for log files
- 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-28 11:07:00 -07:00
Tianjie Xu
180de7a58c Merge "Clean up intent_file related code in recovery.cpp"
am: 7e18ce2

* commit '7e18ce221fac387d5f08da2519879c1fc2046a4a':
  Clean up intent_file related code in recovery.cpp
2016-03-25 21:21:11 +00:00
Tianjie Xu
c14d95da58 Clean up intent_file related code in recovery.cpp
No one in recovery or framework is utilizing intent file. Clean
up the code.

Bug:27725880
Change-Id: I78b37ff94261793e0d6a86a0fa6d27dcfe3f4783
2016-03-24 12:49:46 -07: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
Tianjie Xu
9a83ca02a3 Merge "Reboot and retry on I/O errors" am: 94dc34148c
am: 90f01a4203

* commit '90f01a4203de453a2c6b940c39289b629ae3b654':
  Reboot and retry on I/O errors
2016-03-08 07:44:47 +00:00
Tianjie Xu
94dc34148c Merge "Reboot and retry on I/O errors" 2016-03-07 23:47:14 +00:00
Tao Bao
c36b919525 Merge "recovery: Handle devices without /cache partition." am: 479d9dc2f2
am: f2726712ea

* commit 'f2726712ea1e02fdabf595ece1cfeab9a6147386':
  recovery: Handle devices without /cache partition.
2016-03-04 20:28:38 +00: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
Tianjie Xu
3c62b67faf 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
2016-03-02 17:31:05 -08:00
Tao Bao
26112e5870 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
2016-03-02 15:33:32 -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