Commit graph

75 commits

Author SHA1 Message Date
Elliott Hughes
20531ef605 Switch minadb over to C++.
Change-Id: I5afaf70caa590525627c676c88b445d3162de33e
2015-04-10 13:59:19 -07:00
Elliott Hughes
642aaa7a3e Fix ScreenRecoveryUI to handle devices without power/up/down.
Currently fugu has a custom subclass to handle this. The default code
supports devices with trackballs but not all shipping Nexus devices?
That's just silly.

Change-Id: Id2779c91284899a26b4bb1af41e7033aa889df10
2015-04-10 12:47:46 -07:00
Elliott Hughes
ec28340cf3 Move "Mount /system" to the main menu.
Everyone's adding secret key combinations for this anyway, and it's
very useful when debugging.

Change-Id: Iad549452b872a7af963dd649f283ebcd3ea24234
2015-04-10 10:01:53 -07:00
Elliott Hughes
bb78d6286d Move the recovery image version out of the menu header.
Rather than add code to wrap menu items, let's just put output the
recovery version to the log. It'll be visible at the bottom of the
screen and automatically wrap.

Change-Id: I158fe2d85bc56b195e00619fba455321743923bd
2015-04-09 20:51:08 -07:00
Elliott Hughes
8de52078a4 Move file paging into ScreenRecoveryUI.
This fixes the N9 performance problem.

Change-Id: I00c10d4162ff266a6243285e5a5e768217f6f799
2015-04-08 20:06:50 -07:00
Elliott Hughes
018ed31c51 Enable printf format argument checking.
The original attempt missed the fact that Print is a member function,
so the first argument is the implicit 'this'.

Change-Id: I963b668c5432804c767f0a2e3ef7dea5978a1218
2015-04-08 16:56:17 -07:00
Tao Bao
682c34bbc3 Rotate logs only when there are actual operations
Currently it rotates the log files every time it boots into the recovery
mode. We lose useful logs after ten times. This CL changes the rotation
condition so that it will rotate only if it performs some actual
operations that modify the flash (installs, wipes, sideloads and etc).

Bug: 19695622
Change-Id: Ie708ad955ef31aa500b6590c65faa72391705940
2015-04-07 22:02:27 -07:00
Tao Bao
e39a9bc722 Refactor the codes to call wipe_data/wipe_cache functions
It also changes the return type of wipe_data/wipe_cache to bool, so the
caller can get the status accordingly.

Change-Id: I3022dcdadd6504dac757a52c2932d1176ffd1918
2015-03-31 12:45:12 -07:00
Andres Morales
c277762de1 Revert "Erase PST partition if its marked to be erased."
This now gets done at the framework level.
Doing it here breaks the signature on the partition.

This reverts commit ee19387905.

Bug: 19967123
Change-Id: I2a977cb0f0ba94defa1bf9091219398ddc1d3528
(cherry picked from commit 037444642b)
2015-03-31 09:48:50 -07:00
Tao Bao
c679f93da3 Add support to enter sideload mode directly
When the command file contains "--sideload" (as a result of 'adb reboot
sideload'), it goes into sideload mode directly. Text display will be
turned on by default. It waits for user interaction upon finishing.

When the command file contains "--sideload_auto_reboot", it enters
sideload mode silently. And it will reboot after the installation
regardless of its result, which is designed for automated testing purpose.

Change-Id: Ifdf173351221c7bbf635cfd32463b48e1fff5740
2015-03-30 14:13:18 -07:00
Elliott Hughes
30694c9e2f Factor out the "yes/no" menu and use it for "Wipe cache" too.
It's surprising that only one of the wipe options asks for confirmation.
This change makes it easier to add confirmation to any action.

I've also removed the version information from all but the main menu,
because I find I'm not really reading the red text because there's
so much of it all the time.

(Given that fingerprints are long and menu items aren't wrapped, we
might want to go with an actual "About" menu item instead.)

Change-Id: I7d809fdd53f9af32efc78bee618f98a69883fffe
2015-03-25 16:49:01 -07:00
Tao Bao
145d861460 Factor out option variables from int to bool types
Change-Id: Ia897aa43e44d115bde6de91789b35723826ace22
2015-03-25 15:56:15 -07:00
Christian Poetzsch
4ec58a4ee5 Fix wipe command when using sideload in recovery
Add support for the wipe command when using sideload within the
recovery. All the support for this command is in place, only the
execution of the actual wipe command itself was missing.

Change-Id: Ia9cdfc912bfb9f558fa89b9f0ed54e843ede41f2
Signed-off-by: Christian Poetzsch <christian.potzsch@imgtec.com>
2015-03-24 11:26:42 -07:00
Elliott Hughes
c51ac89f0e Add "Apply update from sdcard" to default recovery image.
At the moment, this is the only difference in the sprout recovery
image. That's silly. Let's just improve the error handling slightly
and always have this option present.

Also make the obscure "<3e>" less unclear.

Also use "power button" as the default text rather than "enter button",
because it's been years since anyone had one of those. (Longer term we
should let subclassers tell us the keycode and we translate it to the
correct string.)

Also move the two "Reboot" options together, put "Power off" at the
bottom (and use that terminology, like the real UI, rather than
"Power down"), and use capitals throughout.

Finally, add a README.md with some useful instructions.

Change-Id: I94fb19f73d79c54fed2dda30cefb884426641b5c
2015-03-22 18:16:31 -07:00
Dan Albert
552fceb85c am 2d102225: Merge "Kill of most of the remainder of minadbd."
* commit '2d1022250941873f8748e6a159d4e5bf976e511f':
  Kill of most of the remainder of minadbd.
2015-02-20 00:05:30 +00:00
Dan Albert
f3a5726919 Kill of most of the remainder of minadbd.
I think everything left now is here to stay (services.c might get
massaged in to libadbd if it gets refactored).

Bug: 17626262
Change-Id: I01faf8b277a601a40e3a0f4c3b8206c97f1d2ce6
2015-02-19 15:41:35 -08:00
Elliott Hughes
dcbf4fc571 resolved conflicts for merge of 35efcd27 to lmp-mr1-dev-plus-aosp
Change-Id: I6f2ea07df2ab80a44301d9c3a2a8841c40a46002
2015-02-10 16:20:53 -08:00
Elliott Hughes
f14af80a14 recovery: Properly detect userdebug or eng builds
The recovery system behaves a little bit differently on userdebug or
eng builds by presenting error reports to the user in the ui.
This is controlled by checking the build fingerprint for the string
:userdebug/ or :eng/. But with AOSP version numbers most AOSP
builds blows the 92 char limit of ro.build.fingerprint and therefore
the property is not set, so this condition will always be evaluated
to false, for most builds.

Instead of depending on the flaky ro.build.fingerprint this change
uses ro.debuggable.

Change-Id: I74bc00c655ac596aaf4b488ecea58f0a8de9c26b
2015-02-10 14:46:14 -08:00
Patrick Tjin
f59b994264 Add basic navigation controls to log viewer.
Bug: 18642766

Change-Id: I95a6c8edf83513d421a041e79c15111b5c991dde
Signed-off-by: Patrick Tjin <pattjin@google.com>
2014-12-10 05:18:05 +00:00
Patrick Tjin
cd055ee72a Save kernel logs to /cache/recovery
Bug: 18642766

Change-Id: I6c8b7d8f9ffb688d3afdfe0d47c4142e711e421d
Signed-off-by: Patrick Tjin <pattjin@google.com>
2014-12-10 05:17:14 +00:00
Nick Kralevich
a9ad0324d1 Make /cache/recovery/last_log available in recovery
Create a new recovery UI option to allow the user to view
/cache/recovery/last_log for their device. This gives enhanced
debugging information which may be necessary when a failed
OTA occurs.

Bug: 18094012
Change-Id: Ic3228de96e9bfc2a0141c7aab4ce392a38140cf3
2014-10-22 21:43:08 -07:00
Jeff Sharkey
a6e13ae01b Include reason when wiping data.
This will help us track down who requested a data wipe.

Bug: 17412160
Change-Id: I1c439fbd29f96b9851810baca9101f683a0f18d8
2014-09-24 11:46:17 -07:00
Andres Morales
ee19387905 Erase PST partition if its marked to be erased.
We need to wipe the challenges on this partition
if OEM unlock is enabled, as this is a signal that
the user has opted out of factory reset protection.

go/factory-reset

Bug: 16633064
Change-Id: Icb8f1433bf99ca57813f5b72d5a3dd15fa94a263
2014-08-06 09:58:55 -07:00
Doug Zongker
945fc68c62 do sdcard sideloading through the fuse filesystem
Make a fuse filesystem that sits on top of the selected package file
on the sdcard, so we can verify that the file contents don't change
while being read and avoid copying the file to /tmp (that is, RAM)
before verifying and installing it.

Change-Id: Ifd982aa68bfe469eda5f839042648654bf7386a1
2014-07-10 10:58:35 -07:00
Doug Zongker
93950229cf drop APPLY_CACHE and refactor APPLY_EXT
Drop support for sideloading OTA packages of the cache partition (a
half-solution that's long since been deprecated by "adb sideload").
Refactor the code to sideload OTA packages from SD cards: remove the
installation code from the file browser.

Change-Id: Id0dff6b27c4a5837546f174f50e2e1d0379c43db
2014-07-08 14:10:23 -07:00
Doug Zongker
075ad800c5 sideload without holding the whole package in RAM
Implement a new method of sideloading over ADB that does not require
the entire package to be held in RAM (useful for low-RAM devices and
devices using block OTA where we'd rather have more RAM available for
binary patching).

We communicate with the host using a new adb service called
"sideload-host", which makes the host act as a server, sending us
different parts of the package file on request.

We create a FUSE filesystem that creates a virtual file
"/sideload/package.zip" that is backed by the ADB connection -- users
see a normal file, but when they read from the file we're actually
fetching the data from the adb host.  This file is then passed to the
verification and installation systems like any other.

To prevent a malicious adb host implementation from serving different
data to the verification and installation phases of sideloading, the
FUSE filesystem verifies that the contents of the file don't change
between reads -- every time we fetch a block from the host we compare
its hash to the previous hash for that block (if it was read before)
and cause the read to fail if it changes.

One necessary change is that the minadbd started by recovery in
sideload mode no longer drops its root privileges (they're needed to
mount the FUSE filesystem).  We rely on SELinux enforcement to
restrict the set of things that can be accessed.

Change-Id: Ida7dbd3b04c1d4e27a2779d88c1da0c7c81fb114
2014-07-02 12:16:36 -07:00
Doug Zongker
8d9d3d5cbe add reboot-to-bootloader and power down options to recovery menu
Useful when debugging or developing for recovery.

Change-Id: Ic3ab42d5e848ad3488f1c575339b55e45c8a024b
2014-04-01 13:20:23 -07:00
Doug Zongker
a898c52b64 am b4bbf887: resolved conflicts for merge of 708aa238 to klp-modular-dev-plus-aosp
* commit 'b4bbf8878c3a6b2a17a3a96f1a23300748dbd81a':
  add --shutdown_after option to recovery
2014-03-18 20:52:43 +00:00
Doug Zongker
b4bbf8878c resolved conflicts for merge of 708aa238 to klp-modular-dev-plus-aosp
Change-Id: I3d00437d519f93652ccae6b361e89e853ccae9b3
2014-03-18 10:56:32 -07:00
Doug Zongker
b1d1263453 add --shutdown_after option to recovery
The "--shutdown_after" option causes recovery to power down the device
on completion rather than rebooting.

Removes the last vestiges of the "--previous_runs" argument, which
doesn't seem to be used for anything.

Change-Id: I465eda2ef59d367e2b1c79a8dc69831263c69a4d
2014-03-18 10:32:12 -07:00
Doug Zongker
a68c517c62 am 80c1a386: resolved conflicts for merge of d90da130 to klp-modular-dev-plus-aosp
* commit '80c1a386d3f614919708b37986919ecaf74ee738':
  refactor image resource loading code in minui
2014-03-17 23:33:14 +00:00
Doug Zongker
80c1a386d3 resolved conflicts for merge of d90da130 to klp-modular-dev-plus-aosp
Change-Id: Ib95b5bcd8d24014e1f2a956d2f31c99a471d3e30
2014-03-17 16:11:02 -07:00
Doug Zongker
a418aa7dd5 refactor image resource loading code in minui
Reduce the number of copies of libpng boilerplate.  Rename
res_create_* functions to be more clear.  Make explicit the use of the
framebuffer pixel format for images, and handle more combinations of
input and output (eg, loading a grayscale image for display rather
than use as a text alpha channel).

Change-Id: I3d41c800a8f4c22b2f0167967ce6ee4d6b2b8846
2014-03-17 12:27:08 -07:00
Mark Salyzyn
679baa06b7 am 4b6de1ba: am 026ebe02: Merge "Recovery 64-bit compile issues"
* commit '4b6de1ba1ce0fff95c18a8abb7ba6e5762006d49':
  Recovery 64-bit compile issues
2014-03-14 21:35:41 +00:00
Mark Salyzyn
4b6de1ba1c am 026ebe02: Merge "Recovery 64-bit compile issues"
* commit '026ebe0214d6c1c9b3ddc22c35e9ac37e5f622bc':
  Recovery 64-bit compile issues
2014-03-14 20:59:56 +00:00
Mark Salyzyn
f3bb31c32f Recovery 64-bit compile issues
Change-Id: I92d5abd1a628feab3b0246924fab7f97ba3b9d34
2014-03-14 13:51:39 -07:00
Doug Zongker
0d32f259cd clean up some warnings when building recovery
Change-Id: I1541534ee6978ddf8d548433986679ce9507d508
2014-02-13 15:34:18 -08:00
Doug Zongker
19a8e2463c log extra info for debugging
Make recovery log its PID, and when we use a block map file, log how
many ranges it contains.

Change-Id: I1b4299f8163af68a770b48c029ae25e6cb45d26b
2014-01-21 09:25:41 -08:00
Doug Zongker
c87bab1018 add the functions for multi-stage packages to updater
In order to support multi-stage recovery packages, we add the
set_stage() and get_stage() functions, which store a short string
somewhere it can be accessed across invocations of recovery.  We also
add reboot_now() which updater can invoke to immediately reboot the
device, without doing normal recovery cleanup.  (It can also choose
whether to boot off the boot or recovery partition.)

If the stage string is of the form "#/#", recovery's UI will be
augmented with a simple indicator of what stage you're in, so it
doesn't look like a reboot loop.

Change-Id: I62f7ff0bc802b549c9bcf3cc154a6bad99f94603
2013-11-26 15:46:57 -08:00
Doug Zongker
3b5a987cd7 recovery: fix use of init reboot method
We need to set the system property to "reboot,", not an empty string.

Bug: 10605007
Change-Id: I776e0d273764cf254651ab2b25c2743395b990e0
2013-09-03 14:29:54 -07:00
Doug Zongker
77ea71d6a8 recovery: fix rebooting
Change I84c0513acb549720cb0e8c9fcbda0050f5c396f5 moved reboot
functionality into init but did not update the recovery partition; so
"adb reboot" and /system/bin/reboot in recovery are both broken.

Change-Id: Ie2d14627a686ffb5064256b6c399723636dff116
2013-08-30 12:20:16 -07:00
Doug Zongker
239ac6abac recovery: install packages in a known mount environment
When installing a package, we should have /tmp and /cache mounted and
nothing else.  Ensure this is true by explicitly mounting them and
unmounting everything else as the first step of every install.

Also fix an error in the progress bar that crops up when you do
multiple package installs in one instance of recovery.

Change-Id: I4837ed707cb419ddd3d9f6188b6355ba1bcfe2b2
2013-08-21 13:44:35 -07:00
Doug Zongker
c0441d1719 notify about pending long press
Recovery changes:

- add a method to the UI class that is called when a key is held down
  long enough to be a "long press" (but before it is released).
  Device-specific subclasses can override this to indicate a long
  press.

- do color selection for ScreenRecoveryUI's menu-and-log drawing
  function.  Subclasses can override this to customize the colors they
  use for various elements.

- Include the value of ro.build.display.id in the menu headers, so you
  can see on the screen what version of recovery you are running.

Change-Id: I426a6daf892b9011638e2035aebfa2831d4f596d
2013-07-31 11:35:12 -07:00
Doug Zongker
a4ee1f8b76 Merge "recovery: preserve recovery logs across cache wipes" 2013-07-09 21:16:53 +00:00
Doug Zongker
6d0d7ac051 recovery: preserve recovery logs across cache wipes
When doing a cache wipe or a factory reset (which includes a cache
wipe), save any last* log files in the /cache/recovery directory and
write them back after reformatting the partition, so that wiping data
doesn't lose useful log information.

Change-Id: I1f52ae9131760b5e752e136645c19f71b7b166ee
2013-07-09 13:34:55 -07:00
Doug Zongker
fafc85b4ad recovery: move log output to stdout
Recovery currently has a random mix of messages printed to stdout and
messages printed to stderr, which can make logs hard to read.  Move
everything to stdout.

Change-Id: Ie33bd4a9e1272e731302569cdec918e0534c48a6
2013-07-09 12:50:24 -07:00
Doug Zongker
f24fd7e847 recovery: copy logs to cache more aggressively
Copy logs to /cache immediately upon a package installation failure;
don't wait for recovery to finish.  (If the user reboots without
exiting recovery the "right" way, the logs never get copied at all.)

Change-Id: Iee342944e7ded63da5a4af33d11ebc876f6c0835
2013-07-02 11:43:25 -07:00
Doug Zongker
8cd12112e4 am d51bfc9b: Merge "Fix the potential segmentation fault"
* commit 'd51bfc9b1fe89321af3c629e7b23a747050332e1':
  Fix the potential segmentation fault
2013-06-04 12:10:28 -07:00
Jin Feng
93ffa7579c Fix the potential segmentation fault
Extral newline can trigger recovery segmentation fault
Test case:
host$ adb shell 'echo -en "--update_package=ota_update.zip\n--show_text\n\n" > /cache/recovery/command'
host$ adb reboot recovery

Change-Id: If1781c1f5ad94a273f1cb122b67cedd9fb562433
Signed-off-by: Jin Feng <jin88.feng@gmail.com>
2013-06-04 17:46:24 +08:00
Doug Zongker
da1ebaef0a recovery: save logs from the last few invocations of recovery
Extends the last_log mechanism to save logs from the last six
invocations of recovery, so that we're more likely to have useful logs
even if the device has repeatedly booted into recovery.

Change-Id: I08ae7a09553ada45f9e0733fe1e55e5a22efd9f9
2013-05-21 11:19:15 -07:00