Commit graph

38365 commits

Author SHA1 Message Date
David Brazdil
2ef56a1174 Revert "adb: add transport benchmark."
This reverts commit d78f59ca53.

Reason for revert: Breaks aosp-master renderscript and sdk_mac:
  error: system/core/adb/Android.bp:199:19: unrecognized property "host_supported"

Change-Id: Ifd75921dcdf5dce57f98833a913540914984b293
2018-04-04 10:32:08 +00:00
Josh Gao
d78f59ca53 adb: add transport benchmark.
Add some basic benchmarks for the underlying transport.

Test: adb_benchmark
Change-Id: I6475a66eb5a43a241c907046c23fea68263db945
2018-04-03 16:54:51 -07:00
Treehugger Robot
a10d40e2b2 Merge "Add a header-version argument to fastboot" 2018-04-03 18:33:57 +00:00
Josh Gao
b9b967e2fc Merge changes Iff1ec14b,I32123c51,I517dbcba,Ic215c7fe
* changes:
  adb: try harder to fill our test sockets.
  adb: don't set has_write_error on success.
  adb: move ownership of the fdevent thread into FdeventTest.
  adb: guarantee that fdevent_run_on_main_thread happens last.
2018-04-03 01:44:14 +00:00
Elliott Hughes
be5332d236 Merge "Improve fastboot verbose output." 2018-04-03 00:58:33 +00:00
Hridya Valsaraju
7d824136ae Add a header-version argument to fastboot
The argument would set the boot header
version for flash:raw and boot
commands when they are used for boot
image creation.

Bug: 77154616
Test: Dumped the created boot image and checked
the header version using unpack_bootimg

Change-Id: I2c458996817615f4351db102b4234984108d47c0
Merged-In: I2c458996817615f4351db102b4234984108d47c0
(cherry picked from commit 88de5556ec)
2018-04-02 16:00:59 -07:00
Elliott Hughes
855cdf82f5 Improve fastboot verbose output.
Move some verbose messages so they're only output with -v.

Remove some misleading verbose messages altogether (such as "wiping
userdata...").

Properly log all the commands sent and responses received. Example:

  $ fastboot -v flashall
  ...
  Sending sparse 'system' 2/2 (443712 KB)
  fastboot: verbose: sending command "download:1b1500d0"
  fastboot: verbose: received DATA 1b1500d0
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (165596160 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (267762688 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (20978688 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (7168 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (3072 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (3072 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (3072 bytes)
  fastboot: verbose: sending data (208 bytes)
  fastboot: verbose: received OKAY
  OKAY [ 13.871s]
  Writing sparse 'system' 2/2
  fastboot: verbose: sending command "flash:system"
  fastboot: verbose: received OKAY
  OKAY [  3.228s]
  Rebooting
  fastboot: verbose: sending command "reboot"
  fastboot: verbose: received OKAY

  Finished. Total time: 36.939s

Bug: http://b/30953083
Bug: http://b/74444116
Test: `fastboot -v flashall`
Change-Id: I2cca198daa062fd1fb732218343263803b111e38
2018-04-02 14:28:18 -07:00
Josh Gao
7651eb9ef7 adb: try harder to fill our test sockets.
On platforms that implement sockets via underlying sockets (e.g. Wine),
a socket can appear to be full, and then become available for writes
again without read being called on the other end. Add a sleep after
each write to give the underlying implementation time to flush.

This doesn't help us if the buffer size is smaller than MAX_PAYLOAD,
but at least in the case of Wine, that doesn't seem to be the case.

Test: adb_test
Test: wine adb_test.exe
Change-Id: Iff1ec14bbf318b9742ec7e2fb72e34e3d6bbe6ad
2018-04-02 14:18:50 -07:00
Josh Gao
954e1280d7 adb: don't set has_write_error on success.
Whoops.

Test: adb_test
Change-Id: I32123c51446a22d4423eef0753b0a0b00b500a90
2018-04-02 14:18:27 -07:00
Elliott Hughes
194e27bf5e Merge "Modernize fastboot output format." 2018-04-02 20:47:53 +00:00
Elliott Hughes
f238d8751b Modernize fastboot output format.
After:

  --------------------------------------------
  Bootloader Version...: 0.5
  Baseband Version.....: 0.5
  Serial Number........: serialv1.0
  --------------------------------------------
  Checking product                                   OKAY [  0.032s]
  Sending 'boot' (9962 KB)                           OKAY [  0.350s]
  Writing 'boot'                                     OKAY [  0.143s]
  Sending 'dts' (14 KB)                              OKAY [  0.068s]
  Writing 'dts'                                      OKAY [  0.048s]
  Sending sparse 'system' 1/2 (460796 KB)            OKAY [ 14.383s]
  Writing sparse 'system' 1/2                        OKAY [  4.138s]
  Sending sparse 'system' 2/2 (443712 KB)            OKAY [ 13.871s]
  Writing sparse 'system' 2/2                        OKAY [  3.246s]
  Rebooting
  Finished. Total time: 36.962s

For a failure:

  extracting android-info.txt (0 MB) to RAM...
  --------------------------------------------
  Bootloader Version...: 0.5
  Baseband Version.....: 0.5
  Serial Number........: serialv1.0
  --------------------------------------------
  Checking product                                   FAILED

  Device product is 'hikey960'.
  Update requires 'marlin' or 'sailfish'.

  fastboot: error: requirements not met!

This change also adds a -v/--verbose flag, but doesn't make much use of
it yet (http://b/30953083 will need it).

Bug: N/A
Test: manual
Change-Id: I7d19f5775859ffad5f3be5707b37dcb6e180917f
2018-04-02 11:01:48 -07:00
Tao Bao
b7ba61ffc5 Merge "Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr." 2018-03-31 17:03:25 +00:00
Jayant Chowdhary
478c7c1eaf Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr.
Bug: 74763691

Test: m -j libmkbootimg creates libmkbootimg.so.lsdump.

Test: make -j64

Change-Id: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d
(cherry picked from commit 4cc755dce5)
2018-03-31 07:13:33 -07:00
Josh Gao
7ab55713cc adb: move ownership of the fdevent thread into FdeventTest.
Previously, each of the tests was spawning the fdevent thread manually,
in order to be able to set up listeners and such before running
fdevent_loop. Now that we have a way to run arbitrary code on the
fdevent thread, switch to having a generic fdevent thread and running
setup code via fdevent_run_on_main_thread.

Test: adb_test
Test: wine adb_test.exe
Change-Id: I517dbcbad31067b45087d9fbed67a75b75a75aec
2018-03-30 14:57:09 -07:00
Josh Gao
fa30bf3932 adb: guarantee that fdevent_run_on_main_thread happens last.
Make it so that we handle run_on_main_thread calls after regular socket
events, so that we can use it as a way to ensure we've processed all
pending socket events.

Test: adb_test
Test: wine adb_test.exe
Change-Id: Ic215c7fed19a8e1699e759970658b3775aa08c45
2018-03-30 14:38:25 -07:00
Josh Gao
e6ae06e687 Merge changes I06ccca30,Iee86b058
* changes:
  adb: fix FdeventTest.invalid_fd on Windows.
  adb: extract the sleep in socket_test to its own function.
2018-03-30 21:38:16 +00:00
Treehugger Robot
14da8f607f Merge "Support Speck encryption." 2018-03-30 20:51:14 +00:00
Paul Crowley
e640bc1b88 Support Speck encryption.
Test: Modified Pixel to support and use Speck encryption, booted.
Bug: 77227248
Change-Id: I6ec272db5e4f16e9dd4f759203c14ad2a8772cd1
Merged-In: I6ec272db5e4f16e9dd4f759203c14ad2a8772cd1
2018-03-30 10:18:46 -07:00
Logan Chien
602af1c488 Merge "Allow VNDK-SP extensions to use vendor lib" 2018-03-30 07:14:51 +00:00
Josh Gao
05fb45be17 adb: fix FdeventTest.invalid_fd on Windows.
Bail out immediately in our poll emulation if we have any invalid file
descriptors, instead of actually calling WSAPoll (which might block
forever).

Test: wine adb_test.exe
Change-Id: I06ccca305783ee7a1721b1585ddf73e022bd02d7
2018-03-29 14:24:03 -07:00
Treehugger Robot
a5bf7bad2c Merge "Allow vendor-init-actionable for ro.board.platform and sys.boot_from_charger_mode" 2018-03-29 21:12:46 +00:00
Treehugger Robot
61896fc0ee Merge "Enabled SYS_MODULE capability for wifi@1.0-service" 2018-03-29 20:57:42 +00:00
Josh Gao
fd7486fb42 adb: extract the sleep in socket_test to its own function.
Make it easier to replace the sleep with something that actually waits
for the event loop to quiesce.

Test: adb_test
Change-Id: Iee86b058abbb607256dbfce43d8c70252b6bb0f6
2018-03-29 13:21:58 -07:00
Josh Gao
31ed2a5c04 Merge "adbd: spawn login shell when run without a command." 2018-03-29 20:19:27 +00:00
Josh Gao
db9671090d Merge "adbd: increase oom_score_adj for adb shell" 2018-03-29 20:19:03 +00:00
Josh Gao
8043633922 Merge "adb: restore adb/adb.exe in the list of artifacts." 2018-03-29 20:18:58 +00:00
Ajit Kumar
b0fc2d743b Enabled SYS_MODULE capability for wifi@1.0-service
Add sys_module capability to enabled insmod operation.

Merged-In: I6436c3297e5318bd00ae3582549a11cb82ccbafd
Change-Id: I6436c3297e5318bd00ae3582549a11cb82ccbafd
(cherry picked from commit c2a059fbf0)
2018-03-29 19:34:06 +00:00
Christopher Ferris
95a524460a Merge "Cache DWARF location rules for a given pc." 2018-03-29 14:47:35 +00:00
David Srbecky
3386ebade2 Cache DWARF location rules for a given pc.
Decoding the DWARF opcodes is expensive so make sure we cache it.

This speeds unwinding in simpleperf by over a factor of 3x.

Add unit tests for this new behavior.

Bug: 77258731

Test: libbacktrace/libunwindstack unit tests on host and target.
Test: Ran debuggerd -b on various processes on target.
Change-Id: Ia516c0fa5d3e5f76746190bb4b6fdf49fd1c9388
2018-03-29 14:47:13 +00:00
Logan Chien
8667747a0e Allow VNDK-SP extensions to use vendor lib
This commit adds a wildcard linker namespace link between the "vndk"
namespace and the "sphal" namespace of the system processes.  This is
created for VNDK-SP-Ext to load vendor libs in "sphal" namespace.

Bug: 77249955
Test: lunch aosp_walleye-userdebug && make -j8  # runs unit tests
Test: lunch aosp_sailfish-userdebug && make -j8  # runs unit tests
Test: Create a VNDK-SP-Ext, link to vendor libs, and run it.
Change-Id: I71b0fb604a84272156aa119130c272f891847008
2018-03-29 17:18:40 +08:00
Jaekyun Seok
1f90ccefb6 Allow vendor-init-actionable for ro.board.platform and sys.boot_from_charger_mode
ro.board.platform and sys.boot_from_charger_mode are already
public-readable, but they should be used as action triggers as well for
some products including Android Go devices.

Bug: 75987246
Test: succeeded building and tested with taimen
Change-Id: I140a8f7ef3fa9823ceced94b00a413800518c240
2018-03-29 14:54:51 +09:00
Christopher Ferris
85d9e67361 Merge "Fix null pointer dereference in RegsArm." 2018-03-29 03:22:57 +00:00
Treehugger Robot
77a61d3e6e Merge "OWNERS for system/core/mkbootimg." 2018-03-29 00:46:36 +00:00
Christopher Ferris
6dbc28ece3 Fix null pointer dereference in RegsArm.
Fix RegsArm::GetPcAdjustment to check for an invalid elf before trying
to read memory.
Modify the tests for this so it crashes without this change.

Also modify the GetPcAdjustment for all different architectures so
that unless the relative pc is too small, it will return the minimum
amount that should be adjusted. This is to handle cases where we still
want to adjust the pc but it's in an invalid elf. Mostly this is for
handling cases when the pc is in jit gdb debug code so that we use the
right unwind information.

Bug: 77233204

Test: Passes unit tests for libbacktrace/libunwindstack.
Change-Id: Id73609adaf3b80a583584441de228156fec3afa7
2018-03-28 17:21:01 -07:00
Treehugger Robot
3ac694632c Merge changes from topic "recovery_dtbo"
* changes:
  Add a script to unpack boot image
  Add a recovery DTBO section to boot image
2018-03-29 00:02:57 +00:00
Elliott Hughes
539f3ddff5 Merge "Add "require partition-exists=" support." 2018-03-28 23:25:24 +00:00
Josh Gao
2de2ade387 adbd: increase oom_score_adj for adb shell
Previously, processes started via `adb shell` have an oom_score_adj of
-1000, making them invisible to the oom killer. This makes running a
process that consumes all memory (e.g. by leaking in a loop) lead to
the entire rest of the system (including adbd, because of bad
heuristics in the kernel) being oom killed before getting to it.

Bug: http://b/63143027
Test: `adb shell cat /proc/self/oom_score_adj` with adb root
Change-Id: I59111134e36dc271adf4c1dd4bd4400d4fe6aee0
2018-03-28 15:01:23 -07:00
Treehugger Robot
45562bfb63 Merge changes Iea2a3055,I6582cfc6
* changes:
  adb: start building windows test again.
  adb: fix windows test build.
2018-03-28 21:59:33 +00:00
Elliott Hughes
d08c9102d6 OWNERS for system/core/mkbootimg.
Bug: N/A
Test: N/A
Change-Id: I9007898e29727892a166f4445c9b112987a97d7d
2018-03-28 14:48:59 -07:00
Hridya Valsaraju
02c08cc347 Add a script to unpack boot image
The script prints out the boot image header
contents and extracts the kernel, ramdisk,
second bootloader and recovery DTBO images.

Bug: 74763691
Test: unpack_bootimg --boot_img $OUT/recovery.img

Change-Id: Iadbca81c157d9e4607f808a14468ab5542347507
2018-03-28 21:25:41 +00:00
Josh Gao
541a8656c4 adb: restore adb/adb.exe in the list of artifacts.
Test: m dist
Change-Id: Iba44a03e79af9242bfe36efb736496f8db720ebf
2018-03-28 12:57:48 -07:00
Hridya Valsaraju
147b355bb3 Add a recovery DTBO section to boot image
For non-A/B devices, the recovery partition should
be self-sufficient and not depend on any other
partition. Since recovery may need access to devices
added to the DT by overlays(for eg.display), we need to
make sure that the the recovery image also contains
the information from the DTBO image.

The following fields are added to the boot image
header for this purpose:
-boot header version
-header size
-recovery dtbo size
-recovery dtbo address

Bug: 74763691
Test: unpack_bootimage --boot_img $OUT/recovery.img
      diff out/extracted_dtbo $TOP/device/google/wahoo-kernel/dtbo.img

Change-Id: I1969859038b84fac1e4a71f79f2f546b9cacffc8
2018-03-28 12:53:21 -07:00
Elliott Hughes
5620d224b6 Add "require partition-exists=" support.
The Pixel 2 system images release was a bit of a disaster because anyone
using an old version of fastboot would blindly flash too few partitions,
potentially bricking their device. This change lets us add a line to
the android-info.txt file for a device with a new partition.

Also error out sooner in such cases by checking the requirements
immediately, rather than optimistically unpacking everything first.

Switch Action over to C++ to fix memory issues.

Bug: http://b/77158188 (partition checking)
Bug: http://b/74444116 (error out sooner)
Test: manual testing with a modified android-info.txt
Change-Id: I58b426cad410107e368f35f5725216d07281dd97
2018-03-28 12:43:53 -07:00
Treehugger Robot
cdc553d042 Merge "Adding odm.img for fastboot flashall" 2018-03-28 19:42:30 +00:00
Treehugger Robot
5e7de48f03 Merge "Allow vendor-init-actionable for ro.debuggable" 2018-03-28 19:15:16 +00:00
Bowgo Tsai
017217ec57 Adding odm.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall
Change-Id: Ie6c20a1004867e7c9cfa1894abab9252316a9154
2018-03-29 01:31:51 +08:00
Jaekyun Seok
4f214c5179 Allow vendor-init-actionable for ro.debuggable
Some partners are using ro.debuggable as action trigger to config a
product differently according to its value.

Bug: 75987246
Test: succeeded building and tested taimen
Change-Id: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8
2018-03-28 12:21:03 +09:00
Treehugger Robot
c41ff1b366 Merge "Adding product.img for fastboot flashall" 2018-03-27 01:37:42 +00:00
Tom Cherry
324e27d284 Merge "Verify the SELabels used in property_contexts" 2018-03-26 23:28:30 +00:00
Treehugger Robot
3b279aa5c7 Merge "Allow android::base::ScopeGuard in STL containers" 2018-03-26 23:05:25 +00:00