Commit graph

3128 commits

Author SHA1 Message Date
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
Treehugger Robot
a2e7a07031 Merge "Refractor the code for imgdiff" 2017-03-07 03:06:09 +00:00
Tianjie Xu
1ea84d6da9 Refractor the code for imgdiff
Put ImageChunk and some helper functions into a class. Also switch to
using std::vector instead of malloc.

Bug: 18606652
Test: imgdiff_test passed on host. Also generate a complete incremental OTA package.
The file content is the same and time consumption is similar.

Change-Id: Id603ada4e130ef521218400761a119001a86ca79
2017-03-06 15:41:02 -08:00
Tianjie Xu
b694ba8aab Merge "Fix an error on bootloadermessager test teardown" 2017-03-03 21:43:14 +00:00
Tianjie Xu
cace743c4d Fix an error on bootloadermessager test teardown
The test should not clear bcb during teardown on devices without
/misc.

Bug: 35712836
Test: The test tears down without errors after /misc removed from the fstab.
Change-Id: I42df89feb18fac5a435cd17eef97a6bad0f44545
2017-03-03 11:59:28 -08:00
Treehugger Robot
53feebea4f Merge "Recovery Test: add SideloadTest to test FUSE support on target" 2017-03-03 01:10:55 +00:00
Wei Wang
b72a15a2ab Recovery Test: add SideloadTest to test FUSE support on target
FUSE FS is required in recovery sideload functionalites.
This CL is to add a native test to flag when FUSE is not
supported in the device kernel.

Bug: 35768196
Test: mma, run recovery_component_test on marlin and pass all
Change-Id: I43b6dbee658010df56ba4d4b0e91baa7fd1c4480
2017-03-02 15:38:22 -08:00
Treehugger Robot
0f26468eda Merge "Skip BootloaderMessageTest, UncryptTest for devices without /misc" 2017-03-01 03:25:02 +00:00
Tao Bao
d549616b24 Merge "recovery: Remember the last log position." 2017-03-01 02:26:46 +00:00
Tianjie Xu
ca94856416 Skip BootloaderMessageTest, UncryptTest for devices without /misc
Skip these two tests if /misc partition is not found in fstab.

Bug: 35712836
Test: Both test skip correctly if there's no /misc in fstab.${hardware}.
Change-Id: I38417a8677030229a335e43eaef85ae70c4e0845
2017-02-28 17:55:27 -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
Treehugger Robot
021304503a Merge "recovery: Don't show "No /cache partition found" on screen." 2017-02-24 19:54:19 +00: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
Elliott Hughes
3ac0dd2a56 Merge "Add a missing #include for openat(2)." 2017-02-24 16:55:25 +00:00
Elliott Hughes
25a29d452e Add a missing #include for openat(2).
Bug: https://code.google.com/p/android/issues/detail?id=64374
Test: builds
Change-Id: I7d7650463197710657820a1adce51f71c1b01415
2017-02-23 10:45:42 -08:00
Sen Jiang
f9962dbfe2 Merge "Use bspatch from external/bsdiff." 2017-02-16 21:14:10 +00:00
Tao Bao
635eb1c83e Merge "recovery: Clean up browse_directory()." 2017-02-14 01:56:24 +00:00
Tao Bao
0d14cc279c Merge "minui: Move graphics_{adf,drm,fbdev} into classes." 2017-02-13 18:25:06 +00: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
557fa1f45e minui: Move graphics_{adf,drm,fbdev} into classes.
This CL defines minui_backend as an interface, and expresses the three
backends (adf, drm and fbdev) as subclasses to the interface.

Test: 'Run graphics test' on N9, Pixel C and N5X.
Change-Id: I0e23951c7b2e2ff918957a8d9fc8b0085b6e5952
2017-02-10 17:05:15 -08:00
Treehugger Robot
df464dbe79 Merge "minui: Save errno before calling close()." 2017-02-09 23:17:59 +00:00
Tao Bao
f04592ba23 minui: Save errno before calling close().
Otherwise errno would be overwritten when calling close(2).

Test: mmma bootable/recovery
Change-Id: I661e46b1b040f550639a728aa2683e91621b4307
2017-02-09 12:59:19 -08:00
Treehugger Robot
5121961421 Merge "minui: Clean up graphics_fbdev.cpp." 2017-02-09 20:31:02 +00:00
Tao Bao
d592e1d5e1 Merge "minui: Clean up graphics_adf.cpp." 2017-02-09 20:07:09 +00:00
Treehugger Robot
648f252c71 Merge "minui: Clean up graphics_drm.cpp." 2017-02-09 19:43:20 +00:00
Tao Bao
76be34cb34 minui: Clean up graphics_drm.cpp.
Remove unneeded header includes. Switch a few memset() to '= {}'
style. Otherwise mostly cosmetic changes like reformatting.

Test: 'Run graphics test' on ryu (which is a DRM device).

Change-Id: I4b0ab2dc0da69a690f09e4f0674b8377de662962
2017-02-07 14:47:59 -08:00
Tao Bao
acf4dd157a minui: Clean up graphics_fbdev.cpp.
Remove unneeded header includes. Otherwise mostly cosmetic changes like
reformatting.

Test: 'Run graphics test' on bullhead (which uses fbdev).

Change-Id: I9b92c96128fa332ac940f73764f9c5fc93ff6c8c
2017-02-07 14:46:31 -08:00
Tao Bao
8f0e21b271 minui: Clean up graphics_adf.cpp.
Remove unneeded header includes. Switch a few memset() to '= {}' style.
Otherwise mostly cosmetic changes like reformatting.

Test: 'Run graphics test' on N9 (which is an ADF device).

Change-Id: If008af18ddae9521f53216b581d882d5eed76d41
2017-02-07 13:20:55 -08:00
Treehugger Robot
95bcbfdd4e Merge "Replace _exit(-1) with _exit(EXIT_FAILURE)." 2017-02-03 23:40:06 +00: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
Treehugger Robot
0f275ae56e Merge "Avoid to call UI functions in child process" 2017-02-03 22:06:50 +00:00
Tianjie Xu
c44c479197 Merge "update_verifier should read dm wrapped partition" 2017-02-03 21:50:07 +00:00
Tao Bao
b04bc0540d Merge "minui: Minor clean up to graphics.cpp." 2017-02-03 20:48:47 +00:00
Tianjie Xu
ab1abae59c Avoid to call UI functions in child process
ui_print uses a mutex to protect the critical section. And a forked
child process may intialize the mutex inappropriatly, which leads to a
hanging child process. So we shall avoid to call the UI functions in
child process.

Bug: 34769056
Test: fake ota on fugu failed as expected due to updater format mismatch.
Change-Id: I81bc942a796878fac19cf712512092c2b0d807c9
2017-02-03 20:35:40 +00:00
Tao Bao
e8020f4fa3 minui: Minor clean up to graphics.cpp.
Remove unneeded header includes.

Remove the dead code in gr_test() (already commented out). Similar tests
have been covered by the "Run graphics test" from recovery menu.

Test: mmma -j32 bootable/recovery
Change-Id: If977c1b780602f5c5054469a3dae4fd85f34ab1a
2017-02-03 09:33:36 -08:00
Sen Jiang
25c56979dd Use bspatch from external/bsdiff.
Now ApplyBSDiffPatch() will stream the output to sink as we go instead
of sinking everything at the end.

Test: recovery_host_test
Bug: 26982501

Change-Id: I05b6ed40d45e4b1b19ae72784cf705b731b976e3
2017-02-02 14:41:05 -08:00
Tao Bao
7f38fbf976 Merge "Fix a log issue in ui.cpp." 2017-02-01 16:39:13 +00:00
Tao Bao
8eec37330b Fix a log issue in ui.cpp.
It's a copy/paste error when addressing reviewer's comment for commit
6278bdf349.

Test: recovery gives the right message (e.g. "Permission denied") when
      it fails to read max_brightness.

Change-Id: I10372c82595bdc00a6f6725f036c02721b19a1aa
2017-01-31 21:27:27 -08:00
Tao Bao
7ab9c3812d Merge "bootable/recovery: cleanup compiler warnings (potential leak of memory)" 2017-02-01 05:10:15 +00:00
Tao Bao
389a29193c Merge "recovery: Add screensaver mode." 2017-01-31 06:11:37 +00:00
Tao Bao
6278bdf349 recovery: Add screensaver mode.
While it's waiting for user input, dim or turn off the backlight to
avoid OLED burn-in. The backlight brightness will be reduced after the
first timeout (default 120s), and then turned off after the second.
Pressing any key will take it back to the normal brightness. While the
display is off, the first key input will only turn on the backlight.

The most common case that triggers the screensaver is under text mode,
such as waiting for menu selection or viewing recovery logs.

This CL doesn't change the brightness while it's installing updates or
performing wipes under UI mode.

When it encounters any install error under UI mode (user builds):
 - If it's NOT USB connected, it will reboot automatically after the
   first timeout (same as before);
 - If it's USB connected, it will dim and turn off the display per the
   change in this CL.

Bug: 34077703
Test: Boot a device with the new recovery image. Wait for timeout.

Change-Id: I0c14907e60340a7f037adb6e464942d099ada08b
2017-01-30 16:12:30 -08:00
Tianjie Xu
b0ac872014 update_verifier should read dm wrapped partition
update_verifier used to read from system_block_device, which bypasses
dm-verity check completely. Switch update_verifier to read the corresponding
'/dev/block/dm-X' instead. U_v gets the verity block device number by
comparing the contents in '/sys/block/dm-X/dm/name'.

Bug: 34391662
Test: update_verifier detects the corrupped blocks and dm-verity trigger the reboot on Sailfish.
Change-Id: Ie5c50c23410bd29fcc6e733ba29cf892e9a07460
2017-01-26 11:08:03 -08:00
Alex Deymo
56ff8061b1 Merge "Remove '_static' suffix from libext2* references." 2017-01-25 23:48:43 +00:00
Treehugger Robot
c8f7b5bad7 Merge "Use flash erase & logical block size for userdata wipe" 2017-01-25 04:14:00 +00:00
Connor O'Brien
98a658bb54 Use flash erase & logical block size for userdata wipe
If flash erase and logical block size are available, then pass them
to libext4_utils when rebuilding userdata.

Test: Factory reset marlin in recovery, confirmed params passed correctly
Bug: 33243520
Change-Id: I6bed976a73e7a64a80eaac50f48fbacb6d812517
Signed-off-by: Connor O'Brien <connoro@google.com>
2017-01-24 18:04:02 -08:00
Tao Bao
a476312714 Merge "minui: Move callback functions to std::function." 2017-01-25 00:49:48 +00:00
Tao Bao
42906e06b3 Merge "update_verifier: Move property_get() to android::base::GetProperty()." 2017-01-24 23:37:22 +00:00
Tao Bao
90deaf9ab7 Merge "Print with newline for ui_print." 2017-01-24 04:54:52 +00:00
Alex Deymo
7c5dbd6751 Remove '_static' suffix from libext2* references.
Bug: 34220783
Test: make checkbuild
Change-Id: Iceea20e440a4bb6a3b254486a65a86401a2241ef
2017-01-23 15:18:29 -08:00
Chris Phoenix
cf1af460d5 Merge "bootctrl HAL uses "default" service name" 2017-01-23 20:48:32 +00:00