Commit graph

2765 commits

Author SHA1 Message Date
Elliott Hughes
60ba9943ed Merge "adb: syntax_error: add compile time format string checking" 2018-09-05 15:56:10 +00:00
Anton Hansson
1f8147fb19 Merge "Make sync and remount support product_services." 2018-09-05 11:00:35 +00:00
Treehugger Robot
4931a29f6d Merge "adb: win32: fix Ctrl-C of adb server nodaemon" 2018-09-05 04:47:28 +00:00
Spencer Low
a00f91b4c1 adb: syntax_error: add compile time format string checking
Test: mma

Change-Id: I8eccd17a1feac0dd98fb317d30ab27489b803669
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2018-09-04 18:08:49 -07:00
Anton Hansson
7f3c01c1d4 Make sync and remount support product_services.
Test: adb remount; touch /product_services/x
Test: adb sync
Bug: 80741439
Bug: 113657113
Change-Id: I8d85964428e5c43811bb5e807b523a0175dd3f5b
2018-08-31 16:18:03 +01:00
Dan Willemsen
4d8929773b Merge "Convert fastboot to Soong" 2018-08-30 23:36:54 +00:00
Josh Gao
fc2e56ffd7 adb: don't try to reconnect emulators.
Bug: http://b/113533872
Test: ./test_adb.py
Change-Id: Id591f43b487cc3928390e30f11645990e34a51bf
2018-08-30 11:37:00 -07:00
Dan Willemsen
ab971b5e7e Convert fastboot to Soong
Also fix adb's version number to match.

See build/soong/README.md for more information.

Test: cd system/core/fastboot; mma
Test: fastboot --version
Test: adb --version
Test: out/host/linux-x86/nativetest/fastboot_test/fastboot_test
Test: out/host/linux-x86/nativetest64/fastboot_test/fastboot_test
Change-Id: I65ea39af9183c602e84f3bc0e4a0d066a30fc464
2018-08-30 11:28:18 -07:00
Ivan Afonichev
0a10040289 adb should #include <sys/sysmacros.h>
On modern systems <sys/sysmacros.h> no longer being included by <sys/types.h>
To use major(), minor() we should include <sys/sysmacros.h> explicitly.
See https://koji.fedoraproject.org/koji/taskinfo?taskID=29356781
Similar changes merged last year:
https://android-review.googlesource.com/c/platform/system/core/+/398913
https://android-review.googlesource.com/c/platform/system/core/+/399050
2018-08-30 01:12:56 +04:00
Mark Salyzyn
7c2020bf64 adb: use fs_mgr_has_shared_blocks
Use fs_mgr_has_shared_blocks in fs_mgr for adb.

Test: compile
Bug: 109821005
Change-Id: Idccaa252c7630375e49f58727a014e61b50a96d6
2018-08-27 16:29:58 +00:00
Spencer Low
84fc27159a adb: win32: fix Ctrl-C of adb server nodaemon
On Windows, when running adb server nodaemon and pressing Ctrl-C,
adb_server_cleanup (an atexit handler) would call kick_all_transports()
which would eventually fail a CHECK because the current thread was not
equal to the main thread. This is because Ctrl-C is implemented in
Windows by the OS creating a new thread in the process and calling the
Ctrl-C handler from there.

The CHECK fail would print out the CHECK expression and call abort()
which would record a crash in the Windows Event Log, plus would
potentially upload a crashdump to Microsoft's Watson service.

This might be a regression from d51c6df1ef.

The fix is to share more code between platforms, removing the call to
Win32 SetConsoleCtrlHandler() and just use the C Runtime's signal()
implementation which is built upon SetConsoleCtrlHandler(). The signal
handler still ends up being called from another thread, but the handler
is thread-safe enough so this seems to work.

Test: On Win10 and Vista, run adb server nodaemon and then try Ctrl-C,
Ctrl-Break and close console window.

Change-Id: I6603970616098d2b3ce68f2a3d4e5515ec859811
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2018-08-25 23:46:48 -07:00
Idries Hamadi
7f51e007a2 Address style and efficiency post-merge feedback from previous change (ed409eaec2).
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: I44105a78c78c6d3c77a6b3b5e14f53cd1707b704
2018-08-23 17:24:07 +01:00
Treehugger Robot
f6d707ba93 Merge "adb: fix spurious usb write failure on Windows." 2018-08-23 03:12:30 +00:00
Treehugger Robot
ddb2bfeae4 Merge "adb: don't spew push/pull progress to dumb terminals." 2018-08-23 02:20:21 +00:00
Josh Gao
7e7ab56e8e adb: don't spew push/pull progress to dumb terminals.
Bug: http://b/113070277
Test: adb push 100mb /data/local/tmp | cat
Test: adb sync | cat
Change-Id: I252bdbdbde825bba903f43bd892262786a58c4e4
2018-08-22 17:28:33 -07:00
Josh Gao
5d799cd454 adb: fix spurious usb write failure on Windows.
We were accidentally returning 0 instead of the number of bytes written
whenever we wrote a USB packet that had a size that was a multiple of
the USB packet size, which resulted in the device getting kicked.

Bug: http://b/113070258
Test: python test_device.py
Change-Id: Ib3d6415545e90e1f4730afc8ad8713d10bb1534a
2018-08-22 17:11:40 -07:00
Josh Gao
860cc5ae39 adbd: use unique_fd for the usb file descriptors.
Test: adb shell
Change-Id: I8b5e31377bbda9b02e522e3a4b75ac908197912f
2018-08-22 15:33:08 -07:00
Treehugger Robot
6d2ace3684 Merge "adb: fix test_adb.py's adb server spawning on Windows." 2018-08-22 00:09:56 +00:00
Treehugger Robot
627a74b714 Merge "adb: add better logging for connection failure." 2018-08-21 21:41:02 +00:00
Josh Gao
92cd59fc31 adb: fix test_adb.py's adb server spawning on Windows.
Test: test_adb.py on windows vm
Change-Id: I918678be7ececd167969789ecff7cfb58829fa1d
2018-08-21 14:28:56 -07:00
Josh Gao
ec54ef7a8d Merge "Fix MacOS SDK build error caused by deprecated stl call." 2018-08-21 20:06:55 +00:00
Idries Hamadi
1d197931b7 Fix MacOS SDK build error caused by deprecated stl call.
Test: lunch sdk-eng && cd system/core/adb && mm
Test: adb install -r -f --force-agent --local-agent ~/example_apks/example.apk
Change-Id: Idf59cc30b7bc2150fc0d68289c3230c6a1057908
2018-08-21 19:25:01 +01:00
Treehugger Robot
15eb065bbb Merge "Integrate adb with fastdeploy" 2018-08-21 06:28:49 +00:00
Tao Bao
308129d274 Merge "adb: Drop the unneeded dependency on libfec_rs.so." 2018-08-15 18:14:16 +00:00
Treehugger Robot
3231be66ce Merge "Add sideload, fastboot as reboot targets in init" 2018-08-14 21:25:50 +00:00
Tao Bao
0caf3c1617 adb: Drop the unneeded dependency on libfec_rs.so.
It was only needed when we statically linked libfec into libadbd in
past.

Test: `mmma -j system/core/adb`
Test: `m -j installclean && m -j bootimage` with aosp_taimen-userdebug.
      Check the installed files in recovery image.
Change-Id: I8627d5f98568ab1d71e6a47cb1b2540a33bffdab
2018-08-14 06:05:04 +00:00
Josh Gao
45e3e95de0 adb: add better logging for connection failure.
Test: manual
Change-Id: I1babee0e01376955529dc1e7d5e3257a7f51f33d
2018-08-13 16:33:54 -07:00
Josh Gao
902dace132 adb: make disconnect stop reconnection immediately.
Make `adb disconnect` remove transports immediately, instead of on
their next reconnection cycle.

Test: adb connect unreachable:12345; adb devices; adb disconnect; adb devices
Change-Id: I35c8b57344e847575596d09216fc636be47dde64
2018-08-13 16:33:54 -07:00
Josh Gao
8a40c8a109 adb: switch reconnect_queue to std::set.
We can't remove from the middle of a priority_queue, which a followup
commit wants to do, so switch to std::set, with the side benefit of
making operator< point the right direction.

Test: mma
Test: ./test_adb.py
Change-Id: I784c1dcc91f0a9cf760e9fa1710202e37e85432b
2018-08-10 15:58:11 -07:00
Josh Gao
043fbec646 adb: add environment variables to disable usb, emulators, mdns.
Provide a way to selectively disable USB, automatic emulator
connection, and mDNS, to make reading through ADB_TRACE logging easier.

Test: manual
Change-Id: Ic6a06cdce14235415520cbf2d51c7f7031b7a7b3
2018-08-10 14:27:51 -07:00
Josh Gao
e032387480 adb: minor cleanup.
Test: mma
Change-Id: I874b10c2821ffe702fecd7e854bca2fbf4d701c3
2018-08-10 14:24:19 -07:00
Josh Gao
18eae78c09 Merge changes If7c8d38f,I7117dd19,Iaa5006e3,I3a568361,I37df06e4, ...
* changes:
  adb: report connection status when we're unauthorized.
  adb: disable test_device.FileOperationsTest.test_pull_symlink_dir.
  adb: fix test_device.FileOperationsTest.test_push_empty
  adb: switch test_adb.py over to double quotes.
  adb: make test_adb.py work on windows.
  adb: switch test_adb.py to python3.
2018-08-09 22:12:46 +00:00
Mark Salyzyn
d88b52e7f4 Merge changes from topic "squashfs+overlayfs"
* changes:
  init: add fs_mgr_overlayfs_mount_all to FirstStageMount
  adb: add overlayfs handling for readonly system filesystems
  fs_mgr: get fs_mgr_mount_all to call fs_mgr_overlayfs_mount_all
  fs_mgr: add overlayfs handling for squashfs system filesystems
2018-08-09 20:44:20 +00:00
Josh Gao
362e696bbf adb: report connection status when we're unauthorized.
Previously, connecting to devices that end up as unauthorized would
wait 10 seconds before reporting failure to the user. After this
change, notification happens as soon as the adb server realizes.

Test: manual
Change-Id: If7c8d38f22da3d98b952eee6a334abc8566bb751
2018-08-08 17:40:15 -07:00
Josh Gao
a8db274a69 adb: disable test_device.FileOperationsTest.test_pull_symlink_dir.
selinux prevents us from doing this.

Test: python test_device.py
Change-Id: I7117dd19348b0764638977b7c958331a4839ea4f
2018-08-08 17:40:15 -07:00
Josh Gao
6c1b42ccd0 adb: fix test_device.FileOperationsTest.test_push_empty
Test: python test_device.py
Change-Id: Iaa5006e39c3d61374de11c05bcaffb4f30b7512e
2018-08-08 17:40:15 -07:00
Josh Gao
b3610734f8 adb: switch test_adb.py over to double quotes.
Test: ./test_adb.py
Change-Id: I3a568361d54f32cc895cea439de0f2c38aee5e2d
2018-08-08 17:40:15 -07:00
Josh Gao
676f375d9b adb: make test_adb.py work on windows.
Switch from os.pipe to socket.socketpair for the fake adbd termination
termination signaller, that we can select on it on windows.

Test: test_adb.py on windows (2 failures on windows)
Change-Id: I37df06e465ec8be28cfb18a5c21ef30125195004
2018-08-08 17:40:15 -07:00
Josh Gao
9b6522b357 adb: switch test_adb.py to python3.
Currently, test_adb.py doesn't work on Windows, because we're selecting
on a pipe, which doesn't work on Windows. Python 3.5 adds socketpair
support to Windows, so switch over to Python 3 to make it so we can use
that.

Test: python3 test_adb.py
Change-Id: I0fbd1bca0b28324658831d5ef8ee08aefe2b0596
2018-08-08 17:40:15 -07:00
Treehugger Robot
7b1d163cb8 Merge "Add adb integration test to general-tests" 2018-08-09 00:05:51 +00:00
Mark Salyzyn
c60153f742 adb: add overlayfs handling for readonly system filesystems
adb verity-on setup overlayfs directories, do not skip if verity
feature not configured for device.

adb verity-off teardown overlayfs directories, do not skip if verity
feature not configured for device.

adb remount setup overlayfs directories and mount if possible, and
do so without a reboot if possible.

Test: compile
Bug: 109821005
Bug: 110985612
Change-Id: I28c4c23fea44b886c5523f0286a523f0b0485df0
2018-08-08 15:42:44 -07:00
Julien Desprez
75fea7ec3b Add adb integration test to general-tests
In order to run them continuously, add them to general-test
zip.

Test: make general-tests
Bug: 112104122
Change-Id: I7a1143ac638626069ed78ddd450063e9489e22e8
2018-08-08 12:08:50 -07:00
Josh Gao
4039051d6d adb: clean up handle_host_request.
Previously, we were returning the result of SendOkay/SendFail in a few
places after handling a host request, which is incorrect for two
reasons. First, the return type of SendOkay/SendFail is bool, and
handle_host_request was expected to return 0 on success. Second, we
don't care if the SendOkay fails; if we got to that point, we're done
with the request, regardless of whether we succeeded to report our
result. The result of this was a spurious failure result reported after
the initial result, which was ignored by the adb client.

Test: manually straced adb server
Test: python test_adb.py
Test: python test_device.py
Change-Id: I7d45ba527e1faccbbae5b15e7a0d1557b0a84858
2018-08-07 14:24:36 -07:00
Josh Gao
50973d1865 Merge changes from topic "fdsan_debuggerd"
* changes:
  adb: actually enable fdsan.
  adb: move AdbCloser to its rightful place.
  libdebuggerd: extract and print the fdsan table.
  crash_dump: pass the address of the fdsan table.
2018-08-07 10:02:16 +00:00
Josh Gao
297d9bf8ea adb: actually enable fdsan.
adb was using a custom unique_fd closer that didn't have an
implementation for fdsan, which meant that none of our FDs were
actually tracked. Guard this behind ifdefs so that we only use this
on Windows, and delete our implementation of Pipe in favor of the one
in libbase while we're at it. libbase's implementation always sets
O_CLOEXEC, so fix up the instance of Pipe that doesn't expect that.

Test: mma
Test: adb start-server
Test: debuggerd `pidof adbd`
Change-Id: Ic29d641a2f93fb42384b00c51775048c8bcbe152
2018-08-06 18:50:10 -07:00
Josh Gao
9d100f1043 adb: move AdbCloser to its rightful place.
Test: mma
Change-Id: Ie74c49e8abf72f594a35d04b2b0d99b96f58f8d0
2018-08-06 18:50:10 -07:00
Tao Bao
eca59ae895 adb: adbd uses shared libraries.
This CL builds the former `libadbd` as a shared library, and moves
`adbd` to using shared libraries.

We can't switch `libadbd` from static to shared library directly, due to
the circular dependency between `libadbd` and `adbd`. In particular,
daemon_service_to_fd() can't be compiled into `libadbd`, as it needs to
be overridden by recovery/minadbd.

This CL creates a static library `libadbd_core` as the common base,
which contains everything from the former `libadbd`. Both of the two
shared library targets `libadbd` and `libadbd_services` depend on
`libadbd_core`.

The `adbd` on device (under both of normal boot and recovery) now
depends on `libadbd.so` and `libadbd_services.so`. recovery/minadbd will
depend on `libadbd.so` and `libminadbd_services.so` in future (after
fully converting recovery to Soong).

Bug: 78793464
Test: `m dist`
Test: Run adbd_test on marlin.
Test: Build and flash marlin on device. Check basic adbd functionalities
      (`adb shell` and `adb sync`) under normal boot and recovery.
Test: `adb sideload` on marlin.
Change-Id: Iacbd4db524ef94abd175cd1d27688f4faf3db024
2018-08-06 11:40:47 -07:00
Idries Hamadi
ed409eaec2 Integrate adb with fastdeploy
Test: lunch sdk-eng && make sdk -j44
Test: lunch aosp_walleye-eng && cd system/core/adb && 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: Ia1c2160f87ea584656f8fdd67e314a260d39d607
2018-08-06 13:57:47 +01:00
Treehugger Robot
d560f39fd7 Merge "Accept DexMetadata files (.dm) for install-multiple" 2018-08-03 20:14:28 +00:00
Calin Juravle
f03eebdd59 Accept DexMetadata files (.dm) for install-multiple
Allow .dm files (DexMetadata) to be passed to adb install-multiple.

Do not rename the input files based on their indices as the naming matters
for associating an .dm file to an .apk file.

Test: adb install-multiple -p com.android.cts.classloadersplitapp base.apk
     split.apk split.dm

Bug: 30934496
Change-Id: I2ac39e00d64eae938124250033f79e02f3c3f9c0
(cherry picked from commit aa7753871e)
2018-08-03 11:21:06 -07:00