Commit Graph

7727 Commits

Author SHA1 Message Date
Tao Bao e545dcf7c7 Merge changes I2d42f55a,Ic1b5dbf7 am: b5fe2dd00c
am: 2ea4768d6e

Change-Id: I501ab5e9041ab6984e7d597c9534e6867742698c
2019-04-30 15:42:23 -07:00
Tao Bao 2ea4768d6e Merge changes I2d42f55a,Ic1b5dbf7
am: b5fe2dd00c

Change-Id: I253e8f580cfa41a6a240cb311970a3165fd69fb0
2019-04-30 15:36:27 -07:00
Tao Bao b5fe2dd00c Merge changes I2d42f55a,Ic1b5dbf7
* changes:
  install: Install functions return InstallResult.
  install: Return bool for a few check functions.
2019-04-30 21:49:03 +00:00
Tao Bao adc99efd1c install: Install functions return InstallResult.
Test: `atest recovery_unit_test recovery_component_test`
Test: Sideload a package on taimen.
Change-Id: I2d42f55a89931ee495ea5c5d9e6b5ee1058e8e52
2019-04-30 13:58:03 -07:00
Tao Bao 36c7276cb2 install: Return bool for a few check functions.
The results from these functions have boolean semantics. They're
returning `int` prior to this CL, with some of them mixing 0 and
InstallResult.  Note that SetUpNonAbUpdateCommands() was returning
INSTALL_CORRUPT / INSTALL_ERROR / 0 prior to this change, but all the
callers handle INSTALL_CORRUPT and INSTALL_ERROR the same way.

This CL changes them to return bool instead.

Test: `mmma -j bootable/recovery`
Test: TreeHugger
Test: Sideload on taimen.
Change-Id: Ic1b5dbf79aaca68b53ab8ea2c8ba3d19f988c571
2019-04-30 13:58:03 -07:00
xunchang 0b64a17614 Support wipe command in rescue mode
am: 5a1916b9be

Change-Id: I7683fe5986cc5c82c431e8e8431a7bb02ea36682
2019-04-30 13:10:46 -07:00
Tao Bao 9df721ed91 Merge "tests: Merge recovery_component_test into recovery_unit_test." am: 865d1df0c9
am: 064ce341ee

Change-Id: I7941b9a42796bfd6404ad02fd15354c94ca4439c
2019-04-30 12:35:15 -07:00
Tao Bao 064ce341ee Merge "tests: Merge recovery_component_test into recovery_unit_test."
am: 865d1df0c9

Change-Id: I39fe185e72acd6eb934db6868df1526fdfc1614c
2019-04-30 12:30:22 -07:00
Tao Bao 865d1df0c9 Merge "tests: Merge recovery_component_test into recovery_unit_test." 2019-04-30 19:09:36 +00:00
Tao Bao 4a01f36d21 tests: Merge recovery_component_test into recovery_unit_test.
Most of the tests in component/ are in fact unit tests. And it doesn't
look practically beneficial to distinguish between the two:
- They have the same test setup;
- We always run both (recovery_unit_test and recovery_component_test)
  at the same time;
- Breaking any of them would be equally bad.

This CL merges the tests in recovery_component_test into
recovery_unit_test to save the effort to maintain both.

Test: Run recovery_unit_test on marlin (via `adb sync data`).
Test: `atest recovery_unit_test`
Change-Id: I93ff32e7219cd83425a4bcfe5613978a8dd48d75
2019-04-30 09:13:36 -07:00
Tao Bao b0c3c15639 Merge "Consolidate the codes that handle reboot/shutdown." am: 189c8f9aeb
am: 3486372d69

Change-Id: I08b9755b1493f7c658b5ea0a076a4f9b59f5fcbe
2019-04-29 15:24:38 -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 3486372d69 Merge "Consolidate the codes that handle reboot/shutdown."
am: 189c8f9aeb

Change-Id: I4bf9b921c241b2c062c452ed38a0215600e6ec98
2019-04-29 15:19:32 -07:00
Tao Bao 189c8f9aeb Merge "Consolidate the codes that handle reboot/shutdown." 2019-04-29 21:53:41 +00:00
Tao Bao 93f65f6df7 [automerger skipped] Parse BCB command to enter rescue mode.
am: 75321ade87 -s ours
am skip reason: change_id I5b7de9dfd898ed8e14bea0d4ad7385a9bae26e94 with SHA1 d9cb014d43 is in history

Change-Id: I5cf072d9b82c58e307c104257a12b3c45455d2f1
2019-04-29 14:26:37 -07:00
Tao Bao f51f548c63 [automerger skipped] minadbd: Support adb reboot under sideload/rescue modes.
am: 7b9b7db877 -s ours
am skip reason: change_id I84daf63e3360b7b4a0af5e055149a4f54e10ba90 with SHA1 10f441a9db is in history

Change-Id: I77fba90b8a5506ff4754bee0b6dd569efe015685
2019-04-29 14:26:27 -07:00
xunchang d2ec7c8f79 [automerger skipped] Add test for minadbd
am: 23f15fcfaf -s ours
am skip reason: change_id I2f073b701b25d7f1aafc59868a7a91a8cbefaf49 with SHA1 9c04eb46b7 is in history

Change-Id: I3500aab156ea8cde0ce18d277a06bf6550f1e677
2019-04-29 14:26:18 -07:00
Tao Bao 00dcd3fbc1 [automerger skipped] minadbd: Support rescue install and getprop commands.
am: e5c6446a10 -s ours
am skip reason: change_id Ibc25daf9fd13f7002e54789f67aaf85d06976bb8 with SHA1 ed717ca17d is in history

Change-Id: Icc2738f1cbc67ea9a1a23dcc7b96a3bab5c0c8eb
2019-04-29 14:26:08 -07:00
Tao Bao ff3f9c3d79 [automerger skipped] Remove the FD parameter from FuseDataProvider ctor.
am: 178cdd4f5c -s ours
am skip reason: change_id I106bbaad05201227bbc5fe28890bbbb06fdcb67e with SHA1 2be9737cf4 is in history

Change-Id: I70d9a3f1ad8b1defc3435a4c16820702524481f5
2019-04-29 14:25:59 -07:00
Tao Bao ee2b4024bf [automerger skipped] Allow entering rescue mode via recovery UI.
am: 378bfbfc5c -s ours
am skip reason: change_id I913dbdbcffd3179e6fa72ca862f74ca8f1364b02 with SHA1 c6dc325e88 is in history

Change-Id: I44775c08042bbc949966fe828a031965e989432f
2019-04-29 14:25:50 -07:00
Tao Bao 782dcc1996 Consolidate the codes that handle reboot/shutdown.
Test: Choose `Reboot system now`, `Power off`, `Reboot to bootloader`
      from recovery UI respectively.
Test: `adb reboot recovery` while under sideload mode.
Change-Id: I0f3d55b80b472178ea4f6970b29cd9df0778b639
2019-04-29 12:12:25 -07:00
Tao Bao 44e39cfd15 Merge "Add install/wipe_device.cpp." am: 40ccbe3324
am: a4993ce078

Change-Id: Iaf06e571a794ec8c07edc4c0acc5946735df23c9
2019-04-29 11:59:21 -07:00
Tao Bao a4993ce078 Merge "Add install/wipe_device.cpp."
am: 40ccbe3324

Change-Id: I0a7e05a6ca5d5ea8ea3e7b5bc3a83a61dc218440
2019-04-29 11:54:20 -07:00
Tao Bao 40ccbe3324 Merge "Add install/wipe_device.cpp." 2019-04-29 18:46:53 +00:00
Tianjie Xu 473532343c Merge "Support wipe command in rescue mode" am: 8fc8f39b62
am: 6c9f2acda0

Change-Id: I2b3502cf90f62d6c0c7d223d69cb9e403de4b814
2019-04-29 11:06:22 -07:00
Tianjie Xu 6c9f2acda0 Merge "Support wipe command in rescue mode"
am: 8fc8f39b62

Change-Id: I2c9776d877de6474362c0c67049f9bc5c5647f62
2019-04-29 11:00:29 -07:00
Tianjie Xu 8fc8f39b62 Merge "Support wipe command in rescue mode" 2019-04-29 17:47:20 +00: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 7f19d100b5 Add install/wipe_device.cpp.
Prior to this CL, GetWipePartitionList was declared in install.h
(libinstall) but defined in recovery.cpp (librecovery). This CL
addresses the issue by refactoring wipe-device related functions into
install/wipe_device.cpp.

Test: atest recovery_component_test
Change-Id: I7ebe04ccfda3d793e085403560a0a202752d9ee3
2019-04-26 23:23:19 -07:00
Tao Bao 7027a5fb12 Merge "Add recovery_host_test to TEST_MAPPING." am: 42168c4ab2
am: a11bb6c2c0

Change-Id: I034aeecc1aa5ab439dd7e4cf24ae863a8f9b7a5a
2019-04-26 14:16:52 -07:00
Tao Bao a11bb6c2c0 Merge "Add recovery_host_test to TEST_MAPPING."
am: 42168c4ab2

Change-Id: I43301da565a7ab5e1509a5e14aa7d297f0855dac
2019-04-26 14:11:51 -07:00
Treehugger Robot 42168c4ab2 Merge "Add recovery_host_test to TEST_MAPPING." 2019-04-26 20:30:48 +00: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
xunchang fedeef6f6d Support wipe command in rescue mode
Bug: 131037235
Test: unit tests pass, run `adb rescue wipe`
Change-Id: I22668f2c98fe2d9195d2561f961c28a7c08e712c
2019-04-26 10:36:48 -07:00
Tao Bao 83186dddb2 Add recovery_host_test to TEST_MAPPING.
Also remove the AndroidTest.xml file, which is no longer needed (the
`data` property in Android.bp takes care of that). The AndroidTest.xml
file would otherwise block `atest recovery_host_test` from running.

Test: TreeHugger; check the test result.
Change-Id: If545878a1f3ae627986e19a94b42162f133b9098
2019-04-26 10:05:55 -07:00
Tao Bao a4c38d860a Merge "Parse BCB command to enter rescue mode." am: e645ba5aca
am: 2f5b6751d8

Change-Id: I9e12a6091c8513b766765d7e152072d4e665ea25
2019-04-25 16:40:01 -07:00
Tao Bao 2f5b6751d8 Merge "Parse BCB command to enter rescue mode."
am: e645ba5aca

Change-Id: I898b6cc59cbb03109e800ddaf6ee3f642a0078f5
2019-04-25 16:35:00 -07:00
Tao Bao e645ba5aca Merge "Parse BCB command to enter rescue mode." 2019-04-25 23:18:08 +00:00
Tao Bao d9cb014d43 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
Test: Boot into rescue mode. Run `adb rescue getprop` and `adb rescue
      install`. Check the UI. Then run `adb reboot rescue`.
Change-Id: I5b7de9dfd898ed8e14bea0d4ad7385a9bae26e94
2019-04-25 14:02:41 -07:00
Tao Bao 4507b9d0fb Merge "Add TEST_MAPPING." am: c6ebcaaad7
am: d8cecf4df9

Change-Id: Ia7377f8c4baebc4175855465befca024d87243bf
2019-04-24 17:39:28 -07:00
Tao Bao d8cecf4df9 Merge "Add TEST_MAPPING."
am: c6ebcaaad7

Change-Id: Ib9d892cf4657a6b4cce9c15c6f25f5a89b4dbdef
2019-04-24 17:36:26 -07:00
Treehugger Robot c6ebcaaad7 Merge "Add TEST_MAPPING." 2019-04-25 00:18:44 +00:00
Tao Bao a14e860190 Add TEST_MAPPING.
Currently it triggers minadbd_test, recovery_unit_test and
recovery_component_test during presubmit.

Test: TreeHugger
Change-Id: Ie0e2ddc9519a7e9b66d059cdf0b81dcbba631c25
2019-04-24 14:03:52 -07:00
Tao Bao 24eb4d1cdd Merge "minadbd: Support adb reboot under sideload/rescue modes." am: cf1f715d62
am: 0d6f57a90f

Change-Id: I4be98a85565ada3f1e97f038ff116174d7f03559
2019-04-24 13:56:24 -07:00
Tao Bao 0d6f57a90f Merge "minadbd: Support adb reboot under sideload/rescue modes."
am: cf1f715d62

Change-Id: Ie0037cbef2daa1e47f169ff353ca3ac4fd24c164
2019-04-24 13:52:22 -07:00
Tao Bao cf1f715d62 Merge "minadbd: Support adb reboot under sideload/rescue modes." 2019-04-24 20:33:18 +00:00