After USB disconnection, io_submit will block until the endpoint comes
back up. We handle this in the worker thread by sending it a signal to
break it out of io_submit when we notice that USB has gone down, but
opportunistic writes from the main thread can get stuck in this scenario
as well. Submitting the writes only on the worker thread doesn't have a
measurable impact on performance, so avert this scenario by only
submitting writes from the worker thread.
Bug: http://b/157078255
Test: test_device.py
Change-Id: I1118f2e2a70d13f15592eb996e7084033ed5cb9d
When a subprocess closes its PTY slave, the master fd will report
POLLHUP when polled. This leads to us prematurely tearing everything
down, without reading out output that's been written to the PTY.
Resolve this by waiting until the fd no longer reports POLLIN.
Bug: http://b/156551485
Bug: http://b/156552734
Test: `adb shell 'X=0; while /data/nativetest64/adbd_test/adbd_test --gtest_filter="ShellServiceTest.*Pty*" >/dev/null 2>&1; do X=$((X+1)); echo $X; done'` for 1000 iterations (failed within 20, previously)
Test: test_device.py
Change-Id: Ie591e0cafb532cd6cebdf6f356dc967565b5a2d9
* changes:
adb pair: allow passing password as command-line argument.
Change adb auto-connect to use mdns instance name.
'adb pair' by mdns instance name.
'adb connect' by mDNS service name.
Add mDNS service instance name parser.
This change will fix reconnects when the ip address and port changes for
the same mdns instance name.
Bug: 152886765
Test: 'adb pair <mdns_instance>' and wait for auto-connect.
'adb devices' | grep <mdns_instance
On device, toggle wireless debugging off/on. Client should be able to
reconnect with the different port.
Change-Id: I9ad486534019ee70fb54c9f26ce028951eca8566
When we're waiting for the device to show up (e.g. `adb logcat` with the
device not connected), we can transition from the feature set being
unavailable to being available.
Test: `adb logcat` with device disconnected
Change-Id: I5c93a725605c886cba2c66daa25b484c90a170ec
Also remove some dead code. The "missing port" case in
parse_tcp_socket_spec hasn't been meaningful since we put the default
port back.
Test: treehugger
Change-Id: I40958f0f1c2dd7f0315142c2c0363a70fe6f80fe
...because that makes our coverage numbers look better. But since there
are only two concrete classes anyway, we weren't gaining much from the
default implementation and it's arguably more intention-revealing now.
Test: treehugger
Change-Id: I7a8a3195023048b1a84277358b857222692d96ee
* changes:
adbd: avoid compiling more code in the daemon.
adb: don't run all of the tests again over TCP in coverage.
adbd: respect ADB_TRACE on host adbd.
adb: mark kMaxProcessNameLength as constexpr.
This will be used for parsing user-provided names to 'adb connect' and
'adb pair' in order to check for matches in the mdns service registry.
Bug: 152886765
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
--gtest_filter=mdns_utils*
Change-Id: Ifd74b4394212853c1c193a2ea64937f6a6a0ff24
We were getting stale service ip addresses because we weren't
destroying the sdref correctly.
Also, we were leaking the ResolvedServices when removing it from the
ServiceRegistry. Converted them to smart pointers to fix that.
Bug: 153343580
Test: test_adb.py
Change-Id: Ib7c1dbf54937d4ac6d9885cb5f7289bef616d12e
Strip out more code that has no meaning on device, to "improve"
coverage.
Test: test_device.py over TCP
Change-Id: Id8d9fa6cc6c6c30773f67303bcc89e6d60824700
They take forever, and we're only really interested in the transport
related code, so test that more directly.
Test: ./coverage/gen_coverage.sh
Change-Id: I47d3ad50db0f1020fe4b3da5cdfe455190d022b5
Added ADB_MDNS_AUTO_CONNECT envionment variable to control which
services to allow auto-connect. By default, only _adb-tls-connect
services can auto-connect, since these services only auto-connect once
paired. _adb services will try to auto-connect to every service found.
Bug: 152636135
Test: ADB_TRACE=1 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb,adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=0 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=1 adb server nodaemon | grep whitelist
Change-Id: Ie562ea24fea3d6d96e67b376a0523b09e2778eb7
ABB uses single shared CMD for all operations which improves
reliability.
Bug: b/153486595
Test: atest adb_test adbd_test fastdeploy_test
Change-Id: I1e3da63882c980811ed2e9f5556732b24a041ce5
We have dependencies that use libc++_shared, which results in ODR
violation manifesting as host adbd crashing on launch in libc++ locale
initialization.
Test: adbd on host
Change-Id: I6c039b325308fb8c36dfe5c1d090ff4ebe9e3433
This command list all discovered mdns services, so we
can connect via service name later on.
Bug: 152521166
Test: 'adb mdns services'
Test: test_adb.py
Change-Id: I23d42a7933e67a65bd0c9924afd6abe5915c0a11
This command will check if the mdns daemon is available on the host
machine.
Bug: 152510294
Test: pkill -9 mdnsd; adb mdns check; mdnsd; adb mdns check;
Test: test_adb.py
Change-Id: If644678a339763817a8a7adcbdc545626d161aba
This fixes a bug in adb root/unroot where we always fail because we're
waiting for a TCP device to disappear.
Test: test_device.py over TCP
Change-Id: I7e4b6fdaa1070cee1f9b471de46ae00bf89b3089
Make it easier to identify adbd's PIDs for coverage purposes by adding
an explicit log message to grep for.
Test: manual
Change-Id: I47e13417c0d9adb7d427414fd70c218f988909f5