Commit Graph

7641 Commits

Author SHA1 Message Date
android-build-team Robot
0bb08ac13d Snap for 5652689 from e3cc180d31 to qt-c2f2-release
Change-Id: I4ef136cf474919ebe95fcadc3867272cf0d1fcbc
2019-06-12 03:06:21 +00:00
Tao Bao
e3cc180d31 minadbd: adb rescue getprop returns newline-terminated result.
This change addresses the comment in [1], which makes the results of
`adb shell getprop foo` and `adb rescue getprop foo` more consistent.
That is, both will return newline-terminated results now.

[1] https://r.android.com/c/platform/bootable/recovery/+/976340/3/minadbd/minadbd_services.cpp#188

Fixes: 134027350
Test: Run the following commands on taimen (under rescue mode):
    `adb rescue getprop ro.build.fingerprint`
    `adb rescue getprop ro.nonexistent`
    `adb rescue getprop`
Change-Id: I5af47f8ea4d569b8507e259daef87749c0945f47
Merged-In: I5af47f8ea4d569b8507e259daef87749c0945f47
(cherry picked from commit 57a27890ce)
2019-06-11 12:55:34 -07:00
Tao Bao
5359d777e6 minadbd: Support adb rescue getprop.
It dumps all the allowed properties, similar to `adb shell getprop`.

Bug: 134027350
Test: Run the command under rescue mode.
Change-Id: Ic0864ca0fb51505ec1e4f38af2464591aa576201
Merged-In: Ic0864ca0fb51505ec1e4f38af2464591aa576201
(cherry picked from commit d8db81a014)
2019-06-05 23:28:25 -07:00
Tao Bao
7a31ab675e minadbd: More allowed properties.
Most of these properties are already part of the fingerprint. This CL
allows querying them directly, instead of encouraging users to decode
from fingerprints.

Bug: 134027350
Test: Boot into rescue mode on taimen. Run `adb rescue getprop` with new
      props.
Change-Id: Id4667fcaf0e908c391085b22e22c957acd01d9c4
Merged-In: Id4667fcaf0e908c391085b22e22c957acd01d9c4
(cherry picked from commit 3b9ef341be)
2019-06-05 23:28:10 -07:00
android-build-team Robot
3ad8e569de Snap for 5606075 from af0a76d1c5 to qt-c2f2-release
Change-Id: I1fe793c932f605c790bf4633260ef17b3bc20244
2019-05-25 23:18:25 +00:00
Tao Bao
af0a76d1c5 Add misc_writer.
am: 35e0f6d290

Change-Id: I4c9c9db09280a0e492cf832489b48511728413b4
2019-05-23 13:26:11 -07:00
Tao Bao
35e0f6d290 Add misc_writer.
bootloader_message.h currently divides /misc into four segments. The
space between 2K and 16K is reserved for vendor use (e.g. bootloader
persists flags). This CL adds a vendor tool "misc_writer", to allow
writing data to the vendor space in /misc, before getting a dedicated
HAL for accessing /misc partition (b/131775112).

Targets need to explicitly include the module, then invoke the
executable to write data. For example, the following command will write
3-byte data ("0xABCDEF") to offset 4 in vendor space (i.e. 2048 + 4 in
/misc).
$ /vendor/bin/misc_writer --vendor-space-offset 4 --hex-string 0xABCDEF

Bug: 132906936
Test: Run recovery_unit_test on crosshatch.
Test: Call the command via init.hardware.rc on crosshatch. Check that
      the call finishes successfully. Then check the contents written to
      /misc (`dd bs=1 skip=2048 if=/dev/block/sda2 count=32 | xxd`).
Change-Id: I79548fc63fc79b705a0320868690569c3106949f
Merged-In: I79548fc63fc79b705a0320868690569c3106949f
(cherry picked from commit 7ae0169842)
2019-05-20 15:58:53 -07:00
Bill Yi
9681eef5ff Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 64712476
Change-Id: I4933222253f1bde2daab4726be971c6d7008a0e4
2019-05-04 18:39:11 -07:00
xunchang
5a1916b9be Support wipe command in rescue mode
Bug: 131037235
Test: unit tests pass, run `adb rescue wipe`
Change-Id: I22668f2c98fe2d9195d2561f961c28a7c08e712c
(cherry picked from commit fedeef6f6d)
2019-04-29 15:21:23 -07:00
Tao Bao
75321ade87 Parse BCB command to enter rescue mode.
bootloader will set `boot-rescue` in BCB command field to indicate
booting into rescue mode. This CL adds the matching parsing code.

This CL changes the on-screen UI to display the default image while
waiting for each sideload / rescue command.

It also changes the minadbd reboot handlers to use REBOOT_ instead of
the previous ENTER_ actions. This ensures a reboot going through
bootloader, which may load a newly installed bootloader/recovery.

Bug: 128505466
Bug: 128415917
Test: Boot into rescue mode. Run `adb rescue getprop` and `adb rescue
      install`. Check the UI. Then run `adb reboot rescue`.
Change-Id: I5b7de9dfd898ed8e14bea0d4ad7385a9bae26e94
Merged-In: I5b7de9dfd898ed8e14bea0d4ad7385a9bae26e94
(cherry picked from commit d9cb014d43)
2019-04-28 12:14:16 -07:00
Tao Bao
7b9b7db877 minadbd: Support adb reboot under sideload/rescue modes.
Bug: 128415917
Test: Run the following commands under sideload and rescue modes
      respectively.
$ adb reboot
$ adb reboot bootloader
$ adb reboot recovery
$ adb reboot rescue
$ adb reboot invalid
Change-Id: I84daf63e3360b7b4a0af5e055149a4f54e10ba90
Merged-In: I84daf63e3360b7b4a0af5e055149a4f54e10ba90
(cherry picked from commit 10f441a9db)
2019-04-26 12:25:02 -07:00
xunchang
23f15fcfaf Add test for minadbd
Ass some unit tests to check if the minadbd service exit correctly in
the failure case. Also start the fuse and verify the socket communication
between minadbd with adb host, and minadbd with recovery.

Bug: 131037235
Test: run unit tests repeatedly, injects some errors and test fails
without dangling process.
Change-Id: I2f073b701b25d7f1aafc59868a7a91a8cbefaf49
Merged-In: I2f073b701b25d7f1aafc59868a7a91a8cbefaf49
(cherry picked from commit 9c04eb46b7)
2019-04-26 12:24:40 -07:00
Tao Bao
e5c6446a10 minadbd: Support rescue install and getprop commands.
Bug: 128415917
Test: Enter rescue mode on taimen. Send the following commands:
      `adb rescue getprop ro.build.fingerprint`
      `adb rescue getprop ro.build.date.utc`
      `adb rescue install /path/to/package.zip`
Test: Sideload on taimen w/ `adb sideload /path/to/package.zip`.
Change-Id: Ibc25daf9fd13f7002e54789f67aaf85d06976bb8
Merged-In: Ibc25daf9fd13f7002e54789f67aaf85d06976bb8
(cherry picked from commit ed717ca17d)
2019-04-26 12:21:55 -07:00
Tao Bao
178cdd4f5c Remove the FD parameter from FuseDataProvider ctor.
This leaves the FD implementation details to subclasses. In particular,
it allows minadbd to do additional works with the FD after sideloading.

Bug: 128415917
Test: atest recovery_component_test
Test: atest minadbd_test
Test: Sideload package on taimen.
Change-Id: I106bbaad05201227bbc5fe28890bbbb06fdcb67e
Merged-In: I106bbaad05201227bbc5fe28890bbbb06fdcb67e
(cherry picked from commit 2be9737cf4)
2019-04-26 12:21:38 -07:00
Tao Bao
378bfbfc5c Allow entering rescue mode via recovery UI.
Only enabled on debuggable builds.

Bug: 128415917
Test: Sideload package on taimen.
Test: Choose "Enter rescue" from recovery UI.
Change-Id: I913dbdbcffd3179e6fa72ca862f74ca8f1364b02
Merged-In: I913dbdbcffd3179e6fa72ca862f74ca8f1364b02
(cherry picked from commit c6dc325e88)
2019-04-26 12:20:03 -07:00
Bill Yi
d0052c30ce Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 64712476
Change-Id: Ie58e59d8d2731350f58bc9733e4599f75a3aca61
2019-04-16 19:59:20 -07:00
xunchang
cd780b456f DO NOT MERGE: Move load & restore logs to logging.cpp
We perform these steps to perserve the recovery logs when wiping
/cache partition. Move them to logging.cpp to keep the actually
EraseVolume function concise.

Bug: 130166585
Test: unit tests pass, mount cache and check last log after cache
Change-Id: Idc52833817a446f3a0148a3dd2112f911c9ef48d
(cherry picked from commit 2239b9e4dd)
2019-04-16 19:26:44 +00:00
xunchang
388d253b9c DO NOT MERGE: Move wipe cache|data to libinstall
Therefore, libinstall becomes the sole owner to handle the request
from minadbd service.

The change also includes
1. move logging.cpp out of librecovery
2. drop the dependency on common.h
3. now it's more sensible to move the wipe_cache as part of
install_package. move the wipe_cache to the end of the function.

Bug: 130166585
Test: wipe data and cache from menu
Change-Id: I6f356dccdb38015c50acf756bac246f87c30fc1f
(cherry picked from commit 316e971746)
2019-04-16 19:26:31 +00:00
xunchang
95d67323a4 DO NOT MERGE: Add socket communication between recovery and minadbd
This cl adds a socket pair to support the communication between recovery
and minadbd. Therefore, minadbd will be able to issue multiple commands
to recovery and get back the status of each command.

This cl also switches the adb sideload from the recovery menu to use
this protocol; and moves minadbd to a separate binary.

Bug: 130166585
Test: sideload a package
Change-Id: I80d36d5c4e6fe1ae3ea23640907bc50c0dc0d482
(cherry picked from commit 34690ced91)
2019-04-16 19:26:20 +00:00
Tao Bao
2f8afba707 DO NOT MERGE: Build libinstall as a static library.
It was once considered to be shared between recovery and minadbd, so
that the latter can start an install on its own. The plan has been
changed, since package install -- including device wipe operations --
could be device-specific, which should be done by recovery only.

This CL moves libinstall back to a static library, which also saves the
overall size (reducing from 140256 + 660576 to 555880 bytes on
aosp_taimen-userdebug).

Bug: 130166585
Test: Run recovery_component_test.
Test: `adb sideload` on taimen.
Change-Id: Ib1f5f79f235df4682c0bd104425c9c122f6091ba
2019-04-16 19:25:23 +00:00
Bill Rassieur
7df2da5948 Merge master@5428150 into git_qt-dev-plus-aosp.
am: 86de943dcc

Change-Id: I13691eb31834462d14b9a7ea07eebc75dfba7de0
2019-04-03 17:20:26 -07:00
Bill Rassieur
549321c723 Merge master@5406228 into git_qt-dev-plus-aosp.
am: 74253cca39

Change-Id: I8694e28304a111d7bc6675993a8219d4c328d3a6
2019-04-03 16:11:09 -07:00
David Anderson
53cbda8056 Merge "Append -verity when looking for verity device-mapper names." am: bc2eab4315 am: 9a53189ae5
am: 5fa37b77d1

Change-Id: I44383f3609730fc12aeac24061a7940010a60338
2019-04-02 15:09:14 -07:00
David Anderson
5fa37b77d1 Merge "Append -verity when looking for verity device-mapper names." am: bc2eab4315
am: 9a53189ae5

Change-Id: Ibc664119ec22f7dd1906f1afc44015829c6e3d2e
2019-04-02 14:08:44 -07:00
David Anderson
9a53189ae5 Merge "Append -verity when looking for verity device-mapper names."
am: bc2eab4315

Change-Id: I39b5e0f2f0baf8d459a535de470c99f8a5d4adf9
2019-04-02 14:04:49 -07:00
David Anderson
bc2eab4315 Merge "Append -verity when looking for verity device-mapper names." 2019-04-02 20:16:36 +00:00
Bill Rassieur
86de943dcc Merge master@5428150 into git_qt-dev-plus-aosp.
Change-Id: I1c69d7c91e68fd4baba7b6510acf2a69e1a6c5d7
BUG: 129345239
2019-04-02 18:26:46 +00:00
David Anderson
c52663c4ea Append -verity when looking for verity device-mapper names.
Bug: 123666267
Test: recovery_component_test passes
Change-Id: I9b608b3fbfa14cc45ad0b4de6cb5cecdef983acb
2019-04-01 17:13:11 -07:00
Tao Bao
1055819fa8 Merge changes Ibbe7084e,If584fc8a am: bb8f0fff17 am: effd4ca883
am: 64ec642955

Change-Id: I9294ea938a634e9d95cb2639eea150c2fb1ac30c
2019-03-30 08:41:12 -07:00
Tao Bao
64ec642955 Merge changes Ibbe7084e,If584fc8a am: bb8f0fff17
am: effd4ca883

Change-Id: Icb25c9b6be3e08b346f9e44f0c4f3d358f548204
2019-03-30 08:37:12 -07:00
Tao Bao
effd4ca883 Merge changes Ibbe7084e,If584fc8a
am: bb8f0fff17

Change-Id: I1df188d9a668dffc2f81000c30ae1d6fd2f4bb1c
2019-03-30 08:33:15 -07:00
Tao Bao
bb8f0fff17 Merge changes Ibbe7084e,If584fc8a
* changes:
  recovery: Remove SetUsbConfig() out of common.h.
  Remove ui_print().
2019-03-30 15:18:18 +00:00
Tao Bao
e0cfab3de9 recovery: Remove SetUsbConfig() out of common.h.
libinstall now has its own copy.

Test: mmma -j bootable/recovery
Change-Id: Ibbe7084e15baeb7e744f2175d5944477092acc9e
2019-03-29 15:54:02 -07:00
Tao Bao
bc982a4f88 Remove ui_print().
This used to be a helper function that allows printing message to UI.
We no longer have any active user in bootable/recovery. Device-specific
code can achieve the same functionality by calling GetUI()->Print()
instead.

Test: mmma -j bootable/recovery
Change-Id: If584fc8a51d1af466f1d94d8ea5faa262603a784
2019-03-29 15:50:02 -07:00
Tianjie Xu
8e39f3d54e Merge "Move install to separate module" am: a232d9dccb am: 3f25d6bb07
am: 719c7edd2a

Change-Id: I06348c5bafedd3a3b610dea2bcac4e2622aec24c
2019-03-29 15:04:04 -07:00
Tianjie Xu
719c7edd2a Merge "Move install to separate module" am: a232d9dccb
am: 3f25d6bb07

Change-Id: I1b37d0263bbd383ba71c6025b7fb26b3651d7b8a
2019-03-29 14:54:00 -07:00
Tianjie Xu
3f25d6bb07 Merge "Move install to separate module"
am: a232d9dccb

Change-Id: I6de83aec6ab98ae5280bad07e3359c4bb38abd5e
2019-03-29 14:43:56 -07:00
Tianjie Xu
a232d9dccb Merge "Move install to separate module" 2019-03-29 21:23:49 +00:00
xunchang
2478885f3c Move install to separate module
Build libinstall as a shared library. Also drop the dependency on the
global variables in common.h.

Test: unit tests pass, sideload an OTA
Change-Id: I30a20047768ce00689fc0e7851c1c5d712a365a0
2019-03-29 10:27:51 -07:00
Bill Peckham
575fc7ec07 Merge "Use flags = 0 to avoid fd closing for child updater process" am: 50bda24f1e am: 111663d893
am: 2796a9d00f

Change-Id: Ib6473290e13400c791b8e31ffeab0e1507d270bb
2019-03-29 06:57:42 -07:00
Bill Peckham
2796a9d00f Merge "Use flags = 0 to avoid fd closing for child updater process" am: 50bda24f1e
am: 111663d893

Change-Id: Ie92945a3223a6bc773886fafd16f1d0679cd462a
2019-03-29 06:53:41 -07:00
Bill Peckham
111663d893 Merge "Use flags = 0 to avoid fd closing for child updater process"
am: 50bda24f1e

Change-Id: I0ddb3f3cb29d63922f0c3972e5800f03bd5a85ac
2019-03-29 06:49:40 -07:00
Bill Peckham
50bda24f1e Merge "Use flags = 0 to avoid fd closing for child updater process" 2019-03-29 13:41:40 +00:00
Bernie Innocenti
2cc882c2f8 Merge "Fix bogus error checking on unique_fd" am: a0fe1227b8 am: 7367caad0f
am: 5e028e80cf

Change-Id: Ie850812c7050305c9ca987c63f088f655e250054
2019-03-28 21:30:50 -07:00
Bernie Innocenti
5e028e80cf Merge "Fix bogus error checking on unique_fd" am: a0fe1227b8
am: 7367caad0f

Change-Id: I46a97ce8c85b186f8d7d5c4e7507b4063cc5c710
2019-03-28 21:14:37 -07:00
Bill Rassieur
74253cca39 Merge master@5406228 into git_qt-dev-plus-aosp.
Change-Id: I1091bf4ecb36441bec7651e20222b4d34c69a443
BUG: 129345239
2019-03-29 04:13:21 +00:00
Bernie Innocenti
7367caad0f Merge "Fix bogus error checking on unique_fd"
am: a0fe1227b8

Change-Id: I90f7429cf22cd2a400054a9b3eed4fc4d79436a6
2019-03-28 21:08:33 -07:00
Treehugger Robot
a0fe1227b8 Merge "Fix bogus error checking on unique_fd" 2019-03-29 03:52:46 +00:00
Bill Peckham
08ba1ad9b1 Use flags = 0 to avoid fd closing for child updater process
If we use the default parameter we'll get O_CLOEXEC, which will close the fd
that we pass to the child process, which will cause it to fail. Passing zero
avoids the problem.

Bug: 122813742
Test: Verify that non-A/B OTA update is successful.
Change-Id: Ia61bc7260f17d9209715583e6ded69e1196ed3f6
2019-03-28 18:42:13 -07:00
Tao Bao
8c9e2206b8 Merge "Remove the extern declaration of sehandle from roots.cpp." am: 047582b506 am: 9e23616e2e
am: a799e66faa

Change-Id: I212e5a5ba2ddf4770ff3a31158c37541f192ed52
2019-03-28 09:27:30 -07:00