Commit graph

2823 commits

Author SHA1 Message Date
Treehugger Robot
321a60f156 Merge changes Ic8d22016,I3e15296e,Ie275e22c
* changes:
  adb: improve benchmark script a bit.
  adb: extract helper for dumping a packet header.
  adbd: turn on -Wthread-safety.
2018-10-18 20:25:53 +00:00
Josh Gao
f2eaefe368 Merge "test_adb.py: silence ResourceWarning." 2018-10-17 21:10:45 +00:00
Josh Gao
42c86722fc test_adb.py: silence ResourceWarning.
Test: ./adb_test.py
Change-Id: If12558492e4edafd3568530a96eac2032526877d
2018-10-16 11:00:39 -07:00
Josh Gao
6c060cf180 adb: improve benchmark script a bit.
Test: none
Change-Id: Ic8d220163ee764fee5fb5887a495557c16703187
2018-10-12 18:03:50 -07:00
Josh Gao
99d3d705f0 adb: extract helper for dumping a packet header.
Test: mma
Change-Id: I3e15296eb917d9df11ca13591d26d3aa54d66412
2018-10-12 16:38:52 -07:00
Josh Gao
560a547db4 adbd: turn on -Wthread-safety.
not_windows doesn't include android...

Test: treehugger
Change-Id: Ie275e22c895b0c88ce9d9f677750d2bffeeebc42
2018-10-12 16:38:52 -07:00
Julien Desprez
618f0e11d6 Add adb_integration_test_device to general-tests
Run some more tests for adb.

Test: tradefed.sh run template/local_min --template:map test=atest --include-filter adb_integration_test_device --log-level VERBOSE --log-level-display verbose
Bug: 112104122
Change-Id: I44b5a2aed8d86ab2dca62081d5b3b05f6e01cabd
2018-10-12 13:48:14 -07:00
Josh Gao
58d5906be3 Merge "Revert "adb: don't close sockets before hitting EOF."" 2018-10-12 06:38:55 +00:00
Josh Gao
faf1328a64 Revert "adb: don't close sockets before hitting EOF."
This reverts commit ffc11d3cf3.

Reason for revert: DeviceIdleFreqCheckTest failing

Bug: http://b/117630047
Change-Id: Ia51a4a30e785bc5b2526695de3f442aac298198f
2018-10-12 05:08:45 +00:00
Treehugger Robot
11cbf7d711 Merge "adb: add reboot-fastboot command" 2018-10-12 03:38:05 +00:00
Mark Salyzyn
d8e94bd3f2 adb: add reboot-fastboot command
Alias reboot-fastboot to reboot fastboot

Test: manual
Bug: 117604012
Change-Id: I5f7842e420fbc0b1d9ae8e1231887fb8644b29e9
2018-10-11 13:21:16 -07:00
Pirama Arumuga Nainar
a2ccce870c Merge changes from topic "windows-libcxx"
* changes:
  Do not enable -Wold-style-cast for Windows
  Add sys/types.h in utf8.h
  Adapt to switch to libc++ for Windows
2018-10-11 17:00:53 +00:00
Idries Hamadi
86554e949b Merge "Reverted aapt dependency to be a dependency on libandroidfw" 2018-10-11 06:15:04 +00:00
Josh Gao
2185d8ceef Merge "adb: don't close sockets before hitting EOF." 2018-10-10 18:13:01 +00:00
Treehugger Robot
3614b39bb9 Merge "adb: identical symlink, do not update" 2018-10-08 19:52:20 +00:00
Josh Gao
f3186de123 Merge changes Ia4244757,Ibcdf69d9
* changes:
  adbd: clean up jdwp service a bit.
  Revert "Revert "adb: detect some spin loops and abort.""
2018-10-08 17:45:23 +00:00
Mark Salyzyn
376e3cbb50 adb: identical symlink, do not update
Inefficient to always update the symlinks to overlayfs, can
also lead to

    failed to copy 'xxx' to 'yyy': remote symlink failed: File exists

on older variants of overlayfs that do not effectively mark them
deleted.

Test: manual
Bug: 109821005
Change-Id: If1286d76f45ce14087cdb515fe8d2fed198fd9d8
2018-10-08 10:37:10 -07:00
Josh Gao
15dcc62c72 adbd: clean up jdwp service a bit.
Change-Id: Ia42447576b047dfa9ddc0b73b87adc8114e3f20f
Test: ./test_device.py
2018-10-05 17:23:44 -07:00
Josh Gao
39c1f4bca5 Revert "Revert "adb: detect some spin loops and abort.""
This reverts commit 04b9ca8c31.

The original incarnation of this patch was falsely triggering when our
poll would block with no activity happening for an extended amount of
time. When the poll returned, we would immediately flag that as a spin
loop. Solve this by tracking the last time we looped, to detect this.

While we're at it, switch from CLOCK_MONOTONIC to CLOCK_BOOTTIME, for
the same reason.

Change-Id: Ibcdf69d93f7b6012142cafd72066f39494c1f84b
Test: ./test_device.py
2018-10-05 17:23:44 -07:00
Idries Hamadi
269a4b422b Reverted aapt dependency to be a dependency on libandroidfw
Removed call to external aapt2 process
Replaced several layers of error handling with calls to fatal()
Changed output messages for failures to be more useful for diagnostics

Bug: 116753196
Test: mm
Test: adb install -r --fastdeploy --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r --fastdeploy --no-streaming --force-agent --local-agent ~/example_apks/example.apk

Change-Id: I6006d8aa584e789a086a31e79a41d1416e54402a
2018-10-05 17:55:05 +01:00
Chih-Hung Hsieh
747eb149d0 Add noexcept to move constructors and assignment operators.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: I5a7461386946ca623ab509609092aa0ac8418b80
2018-10-05 16:43:47 +00:00
Josh Gao
ffc11d3cf3 adb: don't close sockets before hitting EOF.
The standard (RFC 1122 - 4.2.2.13) says that if we call close on a
socket while we have pending data, a TCP RST should be sent to the
other end to notify it that we didn't read all of its data. However,
this can result in data that we've succesfully written out to be dropped
on the other end. To avoid this, instead of immediately closing a
socket, call shutdown on it instead, and then read from the file
descriptor until we hit EOF or an error before closing.

Bug: http://b/74616284
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: I36f72bd14965821dc23de82774b0806b2db24f13
2018-10-04 14:01:07 -07:00
Victor Hsieh
8e27656a9a Restore lost .dm support of adb install-multiple
Apparently some changes are lost in
https://android-review.googlesource.com/c/platform/system/core/+/600457.

Test: adb install-multiple foo.apk foo.dm
Bug: 117092647
Change-Id: I87a6e1509de809624254c77073d922617f222ed2
2018-10-04 10:46:56 -07:00
Tao Bao
546b539b47 Merge "Support > 2GiB seeks in adb_lseek." 2018-10-03 14:59:01 +00:00
Treehugger Robot
4eb864bf7d Merge "allow adb to remount symlink mount points" 2018-10-02 23:41:40 +00:00
Bowgo Tsai
41649b871a allow adb to remount symlink mount points
Currently `adb remount` won't remount symlink mount points.
In Android Generic System Image, there is a symlink
/product -> /system/product for devices with and without a physical
/product partition to work, respectively:

  - Mount product partition under /system/product via
    'mount /product' OR

  - Keep using /product -> /system/product symlink,
    when no product partition

Currently find_proc_mount() is seeking "/product" under /proc/mounts.
But the actual mount path is "/system/product" when GSI is used
on a device with product partition.

Bug: 111539442
Test: adb remount && touch /product/abc on both GSI and non-GSI

Change-Id: I8f15a67109d0a3f4ee18596ef7eb4280c5631b11
2018-09-28 12:47:27 +08:00
Elliott Hughes
cabfc3dc80 Support > 2GiB seeks in adb_lseek.
Also stop using size_t (which will be 32-bit on Win32) for offsets in
adb_sideload_host, and stop truncating large file sizes in our
"sideload-host" messages.

Bug: http://b/112003354
Test: builds
Change-Id: If5b7cc9d1fc7ff7ca6eaebd20418f7b061846203
2018-09-26 14:48:05 -07:00
Josh Gao
2f6c2fa935 adb: add fdevent_release.
Implement a version of fdevent_destroy that returns the file descriptor
previously owned by the fdevent, instead of closing it.

Bug: http://b/74616284
Test: treehugger
Change-Id: I6a14ac96e6b8c801bc71bfcc9094851c158510ae
2018-09-26 12:44:30 -07:00
Josh Gao
ed17650438 adb: fix test_device.FileOperationsTest.test_push_empty.
It was doing a test with `[ -d foo`, without the closing square bracket.

Test: python -m unittest test_device.FileOperationsTest.test_push_empty
Change-Id: I996b98850cf916986ef969768a7235547fcc404a
2018-09-26 12:44:30 -07:00
Josh Gao
db8b2afe23 Merge "adb: make test_device.py executable." 2018-09-26 19:43:28 +00:00
Treehugger Robot
c105f4b63a Merge "adb: remount for /system as root" 2018-09-25 20:38:01 +00:00
Treehugger Robot
37d8bbdf9c Merge "fs_mgr: init: adb: add fstab argument to fs_mgr_overlayfs_mount_all" 2018-09-25 20:37:15 +00:00
Treehugger Robot
6544056d54 Merge "Support 'adb reboot fastboot' command conditionally." 2018-09-25 17:17:08 +00:00
Mark Salyzyn
04aa426c5f adb: remount for /system as root
We can not mount overlayfs on root / as it will intercept all file
transactions.  Thus must remount /system instead.

Test: manual
Bug: 109821005
Bug: 115751838
Change-Id: Idf646b8c1ca8a0d006bf64e23a76a7e909f9162a
2018-09-25 07:30:57 -07:00
Mark Salyzyn
f35db9b11b fs_mgr: init: adb: add fstab argument to fs_mgr_overlayfs_mount_all
Add an fstab argument for fs_mgr_overlayfs_mount_all so that it can
leverage the locally and timely acquired fstab entries.  Affects all
callers, adb and init.

Test: manual
Bug: 109821005
Bug: 115751838
Change-Id: I96e2045d88525a6ce39bef63327a0fcf0704e9bc
2018-09-25 07:30:55 -07:00
Hridya Valsaraju
542582689d Support 'adb reboot fastboot' command conditionally.
Devices not supporting logical partitions do not require the command.

Bug: 78793464
Test: 'adb reboot fastboot' reboots to bootloader for a device
not supporting logical partitions.

Change-Id: I0a7b6d4335040e24efbf461e2dd2d56ab1985b7f
2018-09-25 03:52:12 +00:00
Pirama Arumuga Nainar
29e3dd8548 Adapt to switch to libc++ for Windows
Bug: http://b/91353691

- libcxx has ETXTBSY for Windows
- adb/sysdeps/memory.h is no longer needed

Test: Build and test Windows binaries under Wine.

Change-Id: I9c27087d46c49cb25b391c4adae8d9e24724784d
2018-09-21 10:46:25 -07:00
Josh Gao
caab47f513 adb: make test_device.py executable.
For symmetry with test_adb.py, since they have different interpreter
requirements now.

Test: ./test_device.py
Change-Id: I02fe659a7216a619383661c8019d356f9ccfb34d
2018-09-20 17:55:37 -07:00
Treehugger Robot
c2501fda60 Merge "adbd: fix remount on non-system-as-root devices." 2018-09-14 23:24:44 +00:00
Josh Gao
96d445d846 adbd: fix remount on non-system-as-root devices.
The system image is now a root image, even on devices that don't use
system-as-root. Fix remount to always remount /, to account for this.

Bug: http://b/115751838
Test: `adb remount; adb shell mount | grep " / "`
Change-Id: I2d89a795bd0bc53af33fe69c9d049bbb64d26f3b
2018-09-14 14:32:27 -07:00
Peter Collingbourne
fc0373706d libadbd_services: Link libselinux dynamically instead of statically. 2018-09-13 14:34:04 -07:00
Idries Hamadi
5e26856b98 Merge "Small clean ups for issues raised in reviews of fastdeploy" 2018-09-08 12:11:48 +00:00
Treehugger Robot
756e28ee0c Merge "adb: win32: test for Unicode console output" 2018-09-08 01:35:29 +00:00
Josh Gao
c8d3853a14 Merge "adb: win32: set thread names" 2018-09-07 22:18:18 +00:00
Idries Hamadi
4af6ee4784 Small clean ups for issues raised in reviews of fastdeploy
Removed support for -f shortcut flag as this conflicts with some package manager flags
Renamed use_localagent global to match conventions
Fixed case where tmp files were created unnecessarily
Removed dead code (delete_host_file)
Cleaned up multiple layers of error handling by using fatal() as soon as error conditions occur

Fix: 113631900

Test: mm
Test: adb install -r --fastdeploy --nostreaming --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r --fastdeploy --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Test: observe that fast deploy works as usual

Test: adb install -r -f --nostreaming --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Test: observe that fast deploy is no longer invoked by -f
Change-Id: Ic719df1003ac319e48b32f7f377f6f91d17f6a6f
(cherry picked from commit 0584689beaff604ceeccaf706dc368213d07b977)
2018-09-07 15:35:19 +01:00
Idries Hamadi
7575cd90e5 Modified fastdeploy dependencies to ensure that fast deploy is build as part of 'sdk' target
deploypatchgenerator is now a dependency of adb
deployagent is now a java_binary target and uses the built in 'wrapper' parameter to bundle deployagent.sh
fastdeploy.cpp code in adb modified to reference deployagent rather than deployagent.sh (required to work with built in wrapper functionality).
removed near-redundant fastdeploy_init and TFastDeployConfig singleton as per:
https://android-review.googlesource.com/c/platform/system/core/+/740521/12/adb/client/fastdeploy.cpp#36
relocated kFastDeployMinApi to more appropriate location

Test: rm -rf $ANDROID_ROOT/out
Test: make sdk -j40

Test: find out/ -iname deploypatchgenerator
Test: observe that deploypatchgenerator.jar has been built as a dependency of the sdk target

Test: mm
Test: adb install -r -f --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk

Change-Id: I4e52d32f87774b44845bf6b5be0bae331a0b2324
2018-09-06 10:05:54 +00:00
Idries Hamadi
662a3a6cc3 Merge "Remove fastdeploy dependency on libandroidfw" 2018-09-06 07:26:36 +00:00
Treehugger Robot
a23ba9f61a Merge "adb: win32: test USB kick on resume from sleep/hibernation" 2018-09-06 04:27:23 +00:00
Idries Hamadi
5b6bf94716 Remove fastdeploy dependency on libandroidfw
Call aapt2 to determine package name instead of parsing APK within process.

Test: mm
Test: adb install -r -f --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Change-Id: I99b2c64f0617a9bb27a5c54a2e8f39efd5028f36
2018-09-05 15:59:20 -07:00
Treehugger Robot
28c9539697 Merge "adb: static constexpr." 2018-09-05 21:57:41 +00:00