If std::remove_if is a no-op (no service name match), then
std::vector::erase would crash.
Bug: 160025305
Test: test_adb.py
Test: Manual.
1) Enable wireless debugging on multiple devices
2) Disable wireless debugging on all devices
Change-Id: If58b0dda0bb698fd3fd225d9b6a6726a88ae47e0
It's in the progress output, but typically gets truncated.
Bug: https://issuetracker.google.com/131112559
Test: adb bugreport
Change-Id: I35ba4f39941aea68f2412e7b64feaac4da2f82e3
Adb client does not use these values, so just ignore it.
Bug: b/158824677
Test: 'adb -H 127.0.0.1 -P 5037 devices' does not crash.
Change-Id: I4dada6e5e1714157bbf1af370510dfa7bfbd6b17
The same adbd module prebuilt will get used for both user and userdebug
builds in the post-APEX world, so we can't guard functionality with
product variable ifdefs anymore.
The code that was previously compiled out runs before we drop root, so
the increased attack surface essentially consists of an attacker having
control over system properties, and that likely implies that we're
doomed already (either they have filesystem control, or they have code
execution in init).
Bug: http://b/158156979
Test: treehugger
Change-Id: Ia70d3140189e5212beb813ff719355e30ca5fa04
This way if an unknown device returns anything but a clear
success report from an incremental installation adb would retry
non-incrementally
Bug: 158006039
Test: manual install on R and Q
Change-Id: I9950273bd60ba75fe12a3706d2ccbee136987d13
The required block inside the definition of "adbd" does nothing: we get
the libraries it contains via direct dependency when building from
source, and not at all when using a prebuilt. Move them to a phony
rule that's explicitly listed in PRODUCT_PACKAGES.
Bug: http://b/157709367
Test: treehugger
Change-Id: I97c0889558482cfbe18ae91b39b6889d3fee877c
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