Commit graph

7350 commits

Author SHA1 Message Date
Tianjie Xu
33bb113af2 Merge "Add a new key_pressed_mutex" 2019-07-10 17:46:27 +00:00
Tianjie Xu
5f408dd48a Merge "Create a fallback to install from fuse if mmap fails" 2019-07-10 17:40:37 +00:00
Treehugger Robot
c992962503 Merge "Change the symlink to system_ext" 2019-07-10 04:39:52 +00:00
Tianjie Xu
b8a959b00f Add a new key_pressed_mutex
The following variables in recovery ui were protected by
key_queue_mutex. But the purpose of key_queue_mutex is to protect the
key_queue, which will be changed after we already have a key code. So
getting the key pressed should be orthogonal to the key queue. And
adding a mutex will help to avoid deadlocks in b/135078366.

Variables include:
  char key_pressed[KEY_MAX + 1];
  int key_last_down;
  bool key_long_press;
  int key_down_count;
  bool enable_reboot;

Bug: 135078366
Test: boot into recovery and press keys
Change-Id: Ie2cfcf1f2fec49b53f8fac97aa9a2c60f15b84f9
2019-07-09 16:47:07 -07:00
Justin Yun
ea3c4a4948 Change the symlink to system_ext
As system_ext partition will be linked to system/system_ext, update
the path to system/system_ext.

Bug: 134359158
Test: build
Change-Id: I5a49adfe7e045e24bf6dfbf6990a965b8a5e1ce1
2019-07-09 23:33:26 +00:00
Tao Bao
04b4ff695d Merge "recovery_ui: Remove RecoveryUI::last_key." 2019-07-09 22:04:33 +00:00
Tianjie Xu
e521861508 Create a fallback to install from fuse if mmap fails
We may fail to memory map the package on 32 bit builds for packages with
2GiB+ size. This cl tries to install the package with fuse when memory map
fails in such cases.

Bug: 127071893
Test: build 32 bit version sailfish, push package and block.map, reboot into recovery with
the corresponding update_package argument.

Change-Id: I5dae4f3e27ccaf8d64ff3657d36f0e75db2330b0
2019-07-09 14:15:18 -07:00
Josh Gao
e1701454b2 Merge "minadbd: delete unnecessary fdevent.h include." 2019-07-09 20:02:29 +00:00
Tao Bao
1df3ce7ea8 recovery_ui: Remove RecoveryUI::last_key.
It's a private member, and the last user has been removed in [1] in
2015.

[1] commit ec28340cf3,
https://android-review.googlesource.com/c/platform/bootable/recovery/+/146330

Test: mmma -j bootable/recovery
Change-Id: I65a2370cb20a7b296888425a44a42c8b90abc766
2019-07-09 11:21:18 -07:00
Treehugger Robot
5135d1f095 Merge "Add a GetMappedPackageLength to Updater" 2019-07-08 23:12:38 +00:00
Josh Gao
290322b060 minadbd: delete unnecessary fdevent.h include.
Test: treehugger
Change-Id: I09e9850dabbd71bffbe568f240f9fde8b3743e5e
2019-07-08 15:54:33 -07:00
Robin Lee
1cf8eb7559 Add a GetMappedPackageLength to Updater
Corresponds to GetMappedPackageAddress.

There is at least one custom device recovery with an extension to copy
the package somewhere else as a backup. Ability to do this was removed
in change ag/955273.

Test: lunch cf_x86_tv-eng; make
Test: atest recovery_unit_test recovery_component_test
Change-Id: I0e61d8a8839c47721874526504ea03b9ca7bafa9
2019-07-08 19:30:11 +02:00
Tianjie Xu
9341e970ba Merge "Build libimgdiff as a host only library" 2019-07-02 04:27:44 +00:00
Tianjie Xu
42d7779caf Build libimgdiff as a host only library
Stop building libimgdiff on device because we are only running
patching there.

Test: unit tests pass
Change-Id: I4225c6b52a536617301a64c405e325799a303b40
2019-06-28 11:04:07 -07:00
Tianjie Xu
4955648c4c Merge "Add unit tests for simulator" 2019-06-28 17:47:23 +00:00
Tianjie Xu
b9f356f581 Merge "Rename product_services to system_ext" 2019-06-28 17:45:16 +00:00
Tianjie Xu
6f114c72db Merge "Implement ShowMenu for StubRecoveryUI" 2019-06-28 17:45:01 +00:00
Justin Yun
7ba8f18590 Rename product_services to system_ext
Bug: 134359158
Test: build and boot
Change-Id: I2ea21a0e528bdbab7d2479b48c73e7f2274ecca5
2019-06-28 16:17:26 +09:00
Tianjie Xu
c3a161e2b8 Add unit tests for simulator
Make sure the simulator succeeds executing common non-A/B update
functions.

Bug: 131911365
Test: run unit tests
Change-Id: I520ce6a8827539b88a9e36f9e67eec30d8b586d4
2019-06-27 16:17:05 -07:00
Tianjie Xu
09a8f76ac2 Implement ShowMenu for StubRecoveryUI
The ShowMenu in StubRecoveryUI used to return initial selection
immediately. This leads to an immediate reboot if we enter recovery
with a stub UI and wait for user's input. This cl changes the behavior
of stub UI's ShowMenu so that it waits keys in loop, and only returns in
the case of interruption or time out.

Bug: 130535924
Test: start recovery with a stub UI, wait for the timeout
Change-Id: I96ad8aad8930756b09101bb98ba5fbe7b53bcb37
2019-06-27 15:54:59 -07:00
Treehugger Robot
0ad3ec03e4 Merge "recovery_ui: Remove redundant menu creation." 2019-06-27 21:46:14 +00:00
Tao Bao
fa8e02af7c recovery_ui: Remove redundant menu creation.
Test: Boot into recovery and "Run graphics test".
Change-Id: Icbf1c230b4af57cf32b3c7a4b30ddbabc21d5618
2019-06-27 09:07:51 -07:00
Treehugger Robot
db0a68e6b7 Merge "Implement updater runtime for dynamic partitions" 2019-06-24 20:24:49 +00:00
Tianjie Xu
d118833f3e Implement updater runtime for dynamic partitions
The simulator skips executing the operations for dynamic partitions, and
will use the logical images under target_files/IMAGES directly. (Similar
to the targets without DAP enabled)

Bug: 131911365
Test: run update on cuttlefish, run simulator
Change-Id: Id318d97ece4560df9f20dc5cabeb8b2e261bdf9c
2019-06-24 12:46:28 -07:00
Treehugger Robot
b87520077b Merge "updater_sample: Build SystemUpdaterSample as non-privileged app by default." 2019-06-24 15:41:27 +00:00
Tao Bao
061267eee9 updater_sample: Build SystemUpdaterSample as non-privileged app by default.
Prior to the change, SystemUpdaterSample was built as privileged app.
It must be installed along with the matching privapp-permissions
whitelist change (as noted in updater_sample/README.md), otherwise would
block device booting if installed unintentionally (e.g. with `mm` or
`mmma`).

This CL avoids putting the device in a bad state due to a sample app.

Fixes: 135703777
Test: `lunch aosp_taimen-userdebug && m -j installclean &&
          mmma -j bootable/recovery && m -j`
      Flash on device and boot successfully.
Test: Run the tests per instructions in updater_sample/README.md.
Change-Id: Ib8b587c77570f05f7db748fad84744fa45016aab
2019-06-21 12:10:36 -07:00
Tianjie Xu
090b62832f Merge "Support starting fuse from a block map" 2019-06-21 17:14:10 +00:00
Tianjie Xu
9b76970e9a Merge "Implement the TargetFile and BuildInfo" 2019-06-20 22:39:42 +00:00
Tianjie Xu
f6158eb918 Support starting fuse from a block map
Factor out a new function from ApplyFromSdcard that installs a package
from a local path. Inside this function, we start the fuse and choose the
type of data provider depending on the path string. And similar to the
existing logic, we treat the package as a block map if the path starts
with a '@'.

This is part of the effort to install larger than 2GiB packages on ILP32
devices.

Bug: 127071893
Test: Build a 32 bit sailfish and create a 3GiB OTA package. Sideload
the package, uncrypt and install the package from sdcard.

Change-Id: I328ea34fa530731acbce7554bfc3059313ad6ece
2019-06-20 13:53:40 -07:00
Tianjie Xu
87e2275970 Merge "InstallPackage now takes a package as parameter" 2019-06-14 00:24:49 +00:00
Tianjie Xu
980f92ec00 InstallPackage now takes a package as parameter
Therefore InstallPackage() doesn't need to worry about the details of a
given Package.

Bug: 127071893
Test: run update from /bin/recovery --update_package=@path, sideload a package
Change-Id: I0caa36785b43924f884ee398e7ea640d7472a92e
2019-06-13 13:36:56 -07:00
Elliott Hughes
053ea111a7 Merge "Use the new ziparchive Next std::string_view overload." 2019-06-13 19:59:18 +00:00
Treehugger Robot
eb33356544 Merge "Avoid key_queue_mutex deadlock in waitkey()" 2019-06-13 00:01:49 +00:00
Elliott Hughes
39ac1c013c Use the new ziparchive Next std::string_view overload.
Bug: http://b/129068177
Test: treehugger
Change-Id: Ieec83126e36b330da33092a172e365376cd04dfe
2019-06-12 12:20:37 -07:00
Zhang, GaofengX
852d9fec6d Avoid key_queue_mutex deadlock in waitkey()
Waitkey() is designed to obtain lock "key_queue_mutex" in
the very beginning of function.

  int RecoveryUI::WaitKey() {
    std::unique_lock<std::mutex> lk(key_queue_mutex);
    ...
  }

However, there's case "key_queue_mutex" being applied again in
waitkey(), thus cause deadlock. There are two reproduce
scenario:
1.Executing "fastboot reboot recovery" in userspace
  fastboot
2.Executing "adb reboot fastboot" in recovery os

When entering userspace fastboot/recovery, waitkey()
will wait there for user action. fastboot/adb commands
will trigger ui->interruptkey() to notify the thread
waitkey() in. In the next, waitkey() will move on and call
SetScreenSaveState(), which do LOG(ERROR) in fail case of
brightness set. LOG(ERROR) is designed to print log on
UI. Unfortunately, UI->print() applies lock "key_queue_mutex"
too, so deadlock happen.

Note:
Here is details how lock "key_queue_mutex" applied in
UI->print():
Function Print() call
   Function PrintV() call
      Function update_screen_locked() call
         Function draw_screen_locked() call
            Function draw_menu_and_test_buffer_locked() call
               Function IsLongPress()

  bool RecoveryUI::IsLongPress() {
    std::lock_guard<std::mutex> lg(key_queue_mutex);
    bool result = key_long_press;
    return result;
  }

Bug: 135078366
Test: no errors when running "fastboot reboot recovery" in userspace
      fastboot & "adb reboot fastboot" in recovery os

Change-Id: Ida6b3c4ba9896a70021373f02a94954f0a60cf31
Signed-off-by: Zhang, GaofengX <gaofengx.zhang@intel.com>
Signed-off-by: Xihua Chen <xihua.chen@intel.com>
2019-06-12 14:48:37 +08:00
Tao Bao
cb930939a4 Merge "minadbd: adb rescue getprop returns newline-terminated result." 2019-06-10 23:43:09 +00:00
Tao Bao
57a27890ce 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

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
2019-06-10 13:08:03 -07:00
Tao Bao
533a12c71e Merge "minadbd: Support adb rescue getprop." 2019-06-05 20:43:55 +00:00
Tao Bao
d8db81a014 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
2019-06-04 15:09:41 -07:00
Tao Bao
1ef7f92871 Merge "minadbd: More allowed properties." 2019-06-04 22:01:36 +00:00
Paul Duffin
14bc5e1feb Merge "Use icu4j instead of its deprecated legacy alias icu4j-host" 2019-06-04 09:24:01 +00:00
Tao Bao
3b9ef341be 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
2019-06-03 12:14:18 -07:00
Paul Duffin
eb586b7baf Use icu4j instead of its deprecated legacy alias icu4j-host
Bug: 134379140
Test: m droid
Change-Id: I71c2ac392361b3c6dfa693194c05116422335e55
2019-06-03 16:14:35 +01:00
Tianjie Xu
74b0f7cce0 Implement the TargetFile and BuildInfo
The TargetFile class parses a target-file and provides functions to read
its contents. And the BuildInfo tries to simulate the device with files
on host. Some work it does includes parsing the build properties,
and extracting the image files for partitions specified in the fstab.

Bug: 131911365
Test: unit tests pass, run simulator with cuttlefish, wear devices and from extracted TF.
Change-Id: Iefe4a96d619d2e4b3d038e31480f11a0f9a70afa
2019-05-31 17:55:36 -07:00
Treehugger Robot
f3dd821f76 Merge "Disable building simulator for mac" 2019-05-30 20:45:28 +00:00
Tianjie Xu
76e165d143 Disable building simulator for mac
Disable building the simulator and its support libraries to resolve the breakage
on mac host targets. Because the simulator is not intended to use on mac anyway.

Bug: 134047992
Test: mma
Change-Id: I488ab50cab1282f03250010b5334f1895d44f98b
2019-05-30 10:49:18 -07:00
Tianjie Xu
65d7d5b8cf Merge "Implement an update simulator to verify BB OTA packages on host" 2019-05-29 17:20:36 +00:00
Tianjie Xu
c1a5e26fd9 Implement an update simulator to verify BB OTA packages on host
Implement the simulator runtime and build the updater simulator as a host
executable. The code to parse the target-files and mocks the block devices
will be submitted in the follow-up.

Bug: 131911365
Test: unit tests pass

Change-Id: Ib1ba939aec8333ca68a45139514d772ad7a27ad8
2019-05-28 15:18:25 -07:00
Treehugger Robot
c0a51a01ce Merge "recovery: report compliant reboot reason (Part Deux)" 2019-05-28 15:57:24 +00:00
Tianjie Xu
52e61f6995 Merge "Some clean ups to the updater" 2019-05-24 04:45:43 +00:00