Commit graph

3548 commits

Author SHA1 Message Date
Junyong Sun
1ffccf5c8b adb: windows: fix adb execute root cmd with no tips
fwrite can cross windows platform to show log on terminal,
so we use it instead of WriteFdExactly.

Change-Id: I252c15a0bc72e1dbd98b7b5ec8000ecdcde16416
Signed-off-by: Junyong Sun <sunjy516@gmail.com>
2020-01-17 09:39:21 +08:00
Tom Cherry
f633b62b63 Merge "Require liblog for libbase in all configurations" 2020-01-15 23:20:07 +00:00
Kevin Brodsky
0b633d8800 Remove leftover support for target-as-host
Support for target-as-host was removed by 4626b71057 ("Fix win_sdk
build."), so ADB_HOST_ON_TARGET is never defined.

Test: build
Change-Id: I5ab27e68208677266e2e4272bc2bae7d6a097c5d
2020-01-13 14:48:49 +00:00
Treehugger Robot
a6379cd2df Merge "Add /system/lib to the permitted paths for ns of APEXes" 2020-01-13 08:19:23 +00:00
Tom Cherry
992163021d Require liblog for libbase in all configurations
liblog will soon be required for all of libbase's logging.  This
change proactively requires liblog in all configurations instead of
just Android.

Bug: 119867234
Test: build
Change-Id: I696162fbebc78d4ef23c6032412101ac51d397a4
2020-01-09 10:43:26 -08:00
Treehugger Robot
f5a329f1a4 Merge "adb: fix adb connect help typo." 2020-01-09 04:34:27 +00:00
Treehugger Robot
97186600b5 Merge "adb: avoid consuming input in adb remount." 2020-01-08 23:52:40 +00:00
Josh Gao
9e75634082 adb: avoid consuming input in adb remount.
Bug: https://issuetracker.google.com/146163747
Test: dd if=/dev/zero bs=1024 count=1 | (adb remount; wc)
Change-Id: I700090cd0bbae2d76569008f3c1a116336951c0a
2020-01-08 12:43:34 -08:00
Elliott Hughes
65474fd78c adb: fix adb connect help typo.
Bug: http://b/130380645
Test: adb connect
Change-Id: I04205ff0120bcfd865dc5fa95846694d0ff6de80
2020-01-08 10:02:43 -08:00
Jiyong Park
016059dd46 Add /system/lib to the permitted paths for ns of APEXes
With b/144533348, there will be symlinks from libs in APEXes to the libs
in the system partition. This is to reduce the size of APEXes when the
APEX is bundled with the platform.

Adding the /system/lib to the permitted paths so that the realpaths of
the symlinks are allowed for the namespaces.

Note that this however does not open all libs in the system partition to
the APEX namespaces, because searching of the libs are NOT done in
/system/lib, but in /apex/<module>/lib directory.

Bug: 144533348
Test: m
Change-Id: I4bb1d6cb5dbf647ae669f49aa5ccb178f5488b5e
2020-01-07 19:53:38 +09:00
Kiyoung Kim
0513f0e266 Update ld.config.txt for adbd apex
ld.config.txt for ADBD APEX works properly, but it can be reduced into
simpler way. This change updates ADBD APEX linker configuration which
reduces complexity and limit library usage from system partition.

Test: m -j && confirmed adbd works from cuttlefish
Change-Id: Ifcf1323082148aec4b6417c0ba7df0d9fe8ffeb0
2020-01-03 13:37:29 +09:00
Josh Gao
27fa358d41 Merge "adb: use poll instead of select in shell_service." 2019-12-19 20:22:13 +00:00
Treehugger Robot
1cdcc5f7e8 Merge "adb: fix use after free of atransport." 2019-12-18 22:39:48 +00:00
Josh Gao
63da8e6272 adb: use poll instead of select in shell_service.
Bug: http://b/141955761
Test: test_device.py
Test: adbd_test
Change-Id: I8976304a1011e81e85f8d90d95d36ecd82834f5f
2019-12-18 14:02:57 -08:00
Elliott Hughes
264a37d12f Merge "Fix SEGV in libziparchive with malformed zip file." 2019-12-18 16:14:54 +00:00
Treehugger Robot
90e9217aca Merge "Enable "localfilesystem" UNIX domain socket for ADB." 2019-12-18 05:34:30 +00:00
Elliott Hughes
fba2a1a1ec Fix SEGV in libziparchive with malformed zip file.
d77c99ebc3 changed MappedFile to return a
bogus zero-length mapping on failure rather than nullptr. None of the
calling code was changed, though, and it seems like doing so would be a
bad idea. Revert that part of the change.

Add missing tests, and tidy up some of the logging. Also remove
single-use or obfuscatory constants from the tests.

The new "empty.zip" was created by using zip(1) to create a zip file
with one entry, then using `zip -d` to remove it.

The new "zero-size-cd.zip" was created by using zip(1) to create a zip
file containing a single empty file, and then hex editing the two byte
"size of the central directory" field in the "end of central directory
record" structure at the end of the file. (This is equivalent to, but
much smaller than, the example zip file provided by the bug reporter.)

Bug: http://b/145925341
Test: treehugger
Change-Id: Iff64673bce7dae886ccbc9dd6c2bbe18de19f9d2
2019-12-17 08:39:09 -08:00
Elliott Hughes
dfe6c84709 adb: improve help for -t/-tt.
Test: adb help
Change-Id: Ic75bf184dfc51e57b422666d85e3b7a5139b3853
2019-12-13 16:43:10 -08:00
Josh Gao
607fd5424a adb: fix use after free of atransport.
libadbd_auth might report authentication success for a transport that's
already been destroyed. Fix this by storing a weak pointer to the
atransport that gets cleared upon destruction instead of a raw pointer.

Bug: http://b/144704376
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: Idffe027381e6b2e37f06aa0166e97cafc98eaf3b
2019-12-13 13:28:21 -08:00
Jack Pham
b310da608b adbd: Update DeviceInterfaceGUID for WinUSB
The MS OS extended property descriptor is used to convey additional
information to Windows hosts, in this case the DeviceInterfaceGUID
which allows the inbox WinUSB driver to get automatically installed.

However, the ADB windows client looks for USB devices by enumerating
devices with a specific GUID {F72FE0D4-CBCB-407D-8814-9ED673D0DD6B},
and as a result fails to find the device since it was installed with
a different DeviceInterfaceGUID. Update the OS descriptor to pass
back the same GUID the client already uses.

Change-Id: If664cdd9be821c502e8c2048ff79e79e311936f5
2019-12-12 00:13:56 -08:00
Josh Gao
f4ddee0f32 Merge changes I6ff85723,Ia7d743d5
* changes:
  adb: add ls_v2.
  adb: rename syncmsg::*::time to mtime.
2019-12-12 01:39:20 +00:00
Treehugger Robot
d692530a71 Merge "adb: remove atransport ref counting." 2019-12-12 00:47:28 +00:00
Josh Gao
9a8366b3d9 adb: remove atransport ref counting.
The reference count is always 0 or 1.

Test: ./test_adb.py
Change-Id: I669f98f4996f4e41ac037f1add9c47819d4003d4
2019-12-11 13:40:41 -08:00
Daniel Colascione
3ec7be7a84 Revert "Revert "Support socket activation of adb server""
Test: actually build both device and client adb this time

This reverts commit c77904e3c5.

Change-Id: I8c2b8f24884ff36ff2460dab2500bad777100dfd
2019-12-11 08:20:20 +00:00
Jason Jeremy Iman
8bde191202 Enable "localfilesystem" UNIX domain socket for ADB.
This patch introduce "service.adb.listen_addrs", a new
string type property, while keeping the old properties.
The new property added in this patch is used to listen
on UNIX domain socket "localfilesystem".

"service.adb.listen_addrs" can be used to listen on
multiple addresses, such as tcp:5555 and tcp:5556.
It is separated by ',' (comma) character.

In the process of introducing the new socket type, the
method tcp_connect is removed and combined into
socket_spec_connect.

Without specifying using the new property, adb will
try to listen on both tcp and vsock (following the
previous implementation).

Some examples of the new property value are:
  - "tcp:5555"
  - "vsock:5555"
  - "localfilesystem:/tmp/test"
  - "tcp:5555,vsock:5555"

Bug: 133378083
Test: On master-arc-dev:
        adb root;
        setprop service.adb.listen_addrs localfilesystem:
	    <path_to_socket>;
        adb connect localfilesystem:<path_to_socket>;
        adb -s localfilesystem:<path_to_socket> shell;
	    inside Chrome OS.
Test: On aosp_bluefin:
        setprop service.adb.listen_addr tcp:5555;
        adb connect <IP>:5555; adb shell;
Test: On aosp_bluefin:
        setprop service.adb.tcp.port 5555;
        adb connect <IP>:5555; adb shell;
Test: On aosp_bluefin:
        setprop service.adb.listen_addrs tcp:5555,tcp:6666;
        adb connect <IP>:5555; adb shell;
        adb connect <IP>:6666; adb shell;
Test: On aosp_bluefin:
        ./adb_test;
Test: On cuttlefish:
        launch_cvd;
        adb -s 127.0.0.1:6520 shell;
Test: Ran host tests:
        ./adb_test;
        ./adb_integration_test_adb;
        ./adb_integration_test_device;

Change-Id: I8289bf0ab3305cf23ce5695ffba46845d58ef6bb
2019-12-04 10:05:05 +09:00
Yurii Zubrytskyi
5dda7f6cea [adb] Optimize adbd's usb reading
Try to not allocate as many blocks on the heap, and reuse
memory instead of copying it

Get rid of unique_ptr and shared_ptr where possible, move
the Block objects themselves

Overall this reduces the time spent in memcpy() from 30% to
15% of the whole 'adb push' command, and gets rid of about 5%
of the time spent in the malloc/free calls

Test: builds
Change-Id: I8995115274b6f08a4df13c58183c928ef384a767
2019-11-28 18:24:01 -08:00
Josh Gao
80a734f146 Merge "Allow the adb server to bind on ::1" 2019-11-21 21:51:07 +00:00
Tianjie Xu
b6d7ea15b7 Handle the reboot in the recovery user mode
We have switched to "/system/bin/reboot" to perform the reboot. But
accessing the shell for user build under recovery is not allowed by
sepolicy. So adding a special routine to handle this reboot case.

Bug: 141247819
Test: run `adb reboot` in user mode recovery
Change-Id: Ia37438e52c67fd2bd54e923a0fea5817a1455a08
2019-11-13 14:23:09 -08:00
Elliott Hughes
ef6d913027 Merge "fastdeploy: fix tests." 2019-11-08 21:11:45 +00:00
Elliott Hughes
74f0fc6b18 fastdeploy: fix tests.
Actually log results of adb commands, so we can see why this fails.

Fix the asan-detected use of a value from a reused part of the stack.

Test: atest FastDeployTest on Linux (with an asan adb)
Change-Id: I4d2bbae62a301e16065d604a2c9918077489cafb
2019-11-08 15:39:50 +00:00
Callum Ryan
8539cb3f75 Allow the adb server to bind on ::1
Currently the adb server can only bind on 127.0.0.1 or * if -a is
provided. This diff adds the ability for adb to bind on ::1 as
well for use cases where you might want to force adb to be IPv6
only.

To bind the adb server on ::1
```
$ ./adb -L tcp:[::1]:1234 server
$ lsof -nPi :1234
COMMAND ... NODE NAME
adb     ...  TCP [::1]:1234 (LISTEN)
```
The original behaviour is also retained, so this would only affect
users explicitly specifying ::1 in the socket spec
```
$ export ANDROID_ADB_SERVER_PORT=1234
$ ./adb server
$ lsof -nPi :1234
COMMAND ... NODE NAME
adb     ...  TCP 127.0.0.1:1234 (LISTEN)
```

Note: I've only implemented this behaviour for posix base systems,
due to my limited understanding of networking on windows. If
needed I can do some research to implement it there as well, but
there is currently no IPv6 support at all on the windows side.

Test: New unit test and the commands in the summary

Change-Id: I23e4531e8dfda4de9348124ad7491d728aecdbf7
2019-11-07 08:32:01 -08:00
Daniel Colascione
2aabeed1fd Merge "Properly finish daemon init when initial USB scan complete" 2019-11-05 23:44:25 +00:00
Josh Gao
e24a4b37b4 Merge changes from topic "adbd_apex"
* changes:
  Move adbd to an apex.
  adbd: use libadbd_auth for authentication.
2019-11-05 23:36:39 +00:00
Tianjie Xu
a933b43c02 Grant adb auth under recovery for unlocked & userdebug devices
During automatic tests, we sometimes want to reboot the device out of
the rescue party remotely. And per http://go/recovery-adb-access, we
need to grant the adb authorization to enable the adb access. The auth
are only granted for userdebug devices and those with an unlocked
bootloader. Since the user can always flash a custom recovery image if
the bootloader is unlocked.

This cl ignores the ro.adb.secure property under recovery. The other
option is to default this property to 0 when building the boot/recovery
image.

Bug: 141247819
Test: unlock bootloader, run adb under recovery in user build
Change-Id: I424cfed5bf51a1e31d8687256ae4c6eaaa5e6249
2019-11-04 16:12:00 -08:00
Josh Gao
594f70ffb8 Move adbd to an apex.
Test: adb shell "su 0 readlink /proc/\`pidof adbd\`/exe"
Change-Id: I84dfe4d1b28b619f98c03a2c8eeef2c783d30af2
2019-11-04 15:52:16 -08:00
Josh Gao
275232667d adbd: use libadbd_auth for authentication.
Bug: http://b/137798163
Test: for i in `seq 1 100000`; do echo $i; adb wait-for-device shell "su 0 stop; su 0 start; sleep 10"; adb disconnect; done
Change-Id: Ie481e79a48c4aabf18ef797317ba18f207808c63
2019-11-04 15:46:20 -08:00
Daniel Colascione
3aef5c82f7 Properly finish daemon init when initial USB scan complete
Call adb_notify_device_scan_complete when we finish enumerating USB
devices. The original intent of the code appears to have been to have
adb_wait_for_device_initialization return as soon as we've finished
looking around at the system USB environment on daemon startup, but at
some point, we forgot to actually notify the init thread that we
finished scanning all the USB devices, forcing the wait on init_cv to
time out after three seconds on every daemon initialization.

After this change, the daemon starts in a few milliseconds on my Linux
machine

Test: killall adb && sleep 1 && time adb server && adb shell ls
Change-Id: I0bc1da7a597d2077dd2b591560d03798b05905b7
2019-11-04 11:43:20 -08:00
Josh Gao
18bbb2d821 Merge changes from topics "adbd_reboot", "adbd_verity"
* changes:
  adb: replace reboot service with exec of /system/bin/reboot.
  Move enable-verity/disable-verity out of adb to a helper binary.
  Use adbd_system_binaries to track adbd's dependencies.
2019-10-24 20:29:25 +00:00
Josh Gao
2c356bb91e adb: replace reboot service with exec of /system/bin/reboot.
Test: adb reboot
Test: adb reboot fastboot
Change-Id: Ia4146dde7ef3ae00a782dbe68aff166d63eabdb9
2019-10-23 14:33:36 -07:00
Josh Gao
f61f41494e Move enable-verity/disable-verity out of adb to a helper binary.
Test: adb enable-verity
Test: adb disable-verity
Test: adb shell enable-verity
Test: adb shell disable-verity
Test: fs_mgr/tests/adb-remount-test.sh
Change-Id: I0f21a6678b332cc9166d912aa38952d50d924566
2019-10-23 14:33:36 -07:00
Josh Gao
7b7ee191dc Use adbd_system_binaries to track adbd's dependencies.
required doesn't propagate from apexes, so we need a separate phony
target to track adbd's dependenecies.

Test: m
Change-Id: I4c97047dbd1c2f9b394d864aed229798f09fc9b1
2019-10-23 14:33:36 -07:00
Josh Gao
c9e09e69b9 deployagent: set sdk version.
Not specifying a platform version in a java binary will result in code
generation tools being built to create framework.jar, which currently
fails when building with BUILD_HOST_static=1.

Specify an SDK version to avoid this.

Bug: http://b/142536936
Test: m -j adb BUILD_HOST_static=1
Change-Id: Ifb9556c7c6cc43417c3f56137edee21f145f8b17
2019-10-17 16:20:26 -07:00
Josh Gao
baea773324 Merge changes from topic "apex_remount"
* changes:
  adbd: replace remount_service with an exec of /system/bin/remount.
  Move remount to PRODUCT_PACKAGES_DEBUG.
2019-10-17 19:14:26 +00:00
Josh Gao
8d1d87e460 adbd: replace remount_service with an exec of /system/bin/remount.
Test: fs_mgr/tests/adb-remount-test.sh
Test: treehugger
Change-Id: Idd581c3927fd8a8bbdf70e90e8f928b7e98e032a
2019-10-16 16:29:10 -07:00
Treehugger Robot
2fd9d735ea Merge "adbd: allow port configuration on host." 2019-10-16 23:22:44 +00:00
Josh Gao
6ce44041b5 Move remount to PRODUCT_PACKAGES_DEBUG.
required seems to conflict with apex with the following error:

    build/make/core/main.mk:1338: warning: build/make/target/product/aosp_x86_64.mk produces files inside build/make/target/product/mainline_system.mks artifact path requirement.

Test: treehugger
Change-Id: If1fbb9c4a4be340750ee6daea7aa4621177d8d56
2019-10-10 13:12:21 -07:00
Elliott Hughes
7fb1407125 adb: log more detail on failure to read keys.
Before we just got "Failed to read key". After:

  adb E 10-07 08:20:14 258249 258249 auth.cpp:176] Failed to read key \
    from '/usr/local/google/home/enh/.android/adbkey'
  94390117965240:error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE:\
    external/boringssl/src/crypto/pem/pem_lib.c:622:Expecting: ANY PRIVATE KEY

Also fix the misleading "Failed to generate" message from adb_auth_init.

Bug: http://b/141715453
Test: manually corrupted key; see above
Change-Id: I6732ee6b683c8548d596d7c22eeddab8ce9a3cea
2019-10-07 08:25:42 -07:00
Alex Buynytskyy
665f3ff5a7 FastDeploy refactor: 2+GB APK support, optimizations, tests.
- removed 2GB apk size cap,
- removed zip archive parsing on device (1.1M->236K agent size reduction),
- optimized matching entries search,
- added more robust matching entries search based on hash of CDr entry,
- reduced patch size by reusing Local File Header of matched entries,
- removed extra manifest parsing and extra agent calls,
- added device-side tests for agent,
- fix for Windows patch creation.

Test: atest adb_test fastdeploy_test FastDeployTests

Total time for 0-size patch reduction for 1.7G apk: 1m1.778s->0m36.234s.

Change-Id: I66d2cef1adf5b2be3325e355a7e72e9c99992369
2019-10-02 13:25:03 -07:00
Josh Gao
ea3f43ccf2 adb: disable failing test.
Bug: http://b/141943968
Bug: http://b/141923622
Test: python -m unittest test_device.FileOperationsTest
Change-Id: Ie384c71c3d6875db74982a398fb66f035ce9f408
2019-10-01 14:15:31 -07:00
Colin Cross
2a62d42704 Merge "Use libcrypto_static instead of libcrypto" 2019-09-26 14:32:33 +00:00
Josh Gao
3a22e8cf73 Merge "adb: fragment host linux USB writes when needed." 2019-09-25 21:20:54 +00:00
Treehugger Robot
070c030289 Merge "adb: fix infinite loop when attempting to push to //foo." 2019-09-25 19:59:51 +00:00
Josh Gao
06e7cb5af0 adbd: allow port configuration on host.
Test: manual
Change-Id: I68cbd9bdb253a68463cc65e63a764ad4fa410c1c
2019-09-26 03:23:05 +08:00
Josh Gao
76b64ba826 adb: fix infinite loop when attempting to push to //foo.
dirname (on glibc, at least) preserves multiple leading slashes, and we
were looping until path != "/", which would lead to an infinite loop
when attempting to push to a path like //data/local/tmp.

Bug: http://b/141311284
Test: python -m unittest test_device.FileOperationsTest.test_push_multiple_slash_root
Change-Id: I182b3e89ef52579c716fdb525e9215f1fe822477
2019-09-26 01:56:58 +08:00
Dan Shi
03ba5b9dfb Merge "Add require_root to adbd_test and libpackagelistparser_test" 2019-09-24 18:30:44 +00:00
Dan Shi
d1360f4412 Add require_root to adbd_test and libpackagelistparser_test
Bug: 141272654
Test: atest
Change-Id: I14e0d3283cba79a2a4e36e1a1274d6921be5b629
2019-09-24 09:13:32 -07:00
Colin Cross
f117f34aed Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I5f0b9acfb57f68570f6f58f2395f2bb1bc015365
2019-09-18 11:04:35 -07:00
Mark Salyzyn
6f908cefe7 adb: fix adb remount -R
A regression from commit 8c2198c809
("adb: use shell for remount to forward return codes.") where the
optional argv[1] got missed for the remount command.  This change
hands off _all_ the arguments if to a shell and activates some of
the extra features in the remount command.

$ adb remount --help
remount [-h] [-R] [-T fstab_file] [partition]...
	-h --help	this help
	-R --reboot	disable verity & reboot to facilitate remount
	-T --fstab	custom fstab file location
	partition	specific partition(s) (empty does all)

Remount specified partition(s) read-write, by name or mount point.
-R notwithstanding, verity must be disabled on partition(s).
$

SideEffects: adb remount [-h] [-R] [-T fstab_file] [partition]...
Test: adb-remount-test.sh
Bug: 138577868
Bug: 139283818
Bug: 139226412
Change-Id: I8223d4000ab20857e9b634e4d4a326eed530d7be
2019-09-18 09:40:50 -07:00
Josh Gao
1025b228ba adb: fragment host linux USB writes when needed.
We've seen USB writes failing due to inability to allocate contiguous
chunks of memory in the kernel on devices, but it looks like the same
problem can occur on the host, as well. It's a mild performance
regression (90->80 MB/s on a blueline) to split the writes always, so
attempt the full write first, and fall back to splitting it up if that
fails with ENOMEM. Once we switch over the the asynchronous transport
API, we'll be able to submit multiple writes cheaply, like on devices,
so we won't need to retry at that point.

Bug: http://b/140985544
Test: test_device.py
Change-Id: I1517c348375b829dfff6796c4e9d394802b02d5b
2019-09-17 14:48:16 +08:00
Alex Buynytskyy
7ea92d8232 Using the correct feature name for abb_exec.
Test: atest adb_test
Test: atest fastdeploy_test

Change-Id: Ib917ed8293d0f51339cade032c768a4058ba578e
2019-09-16 10:36:52 -07:00
Treehugger Robot
fd010252c2 Merge "adb: fix old host transport selection." 2019-09-12 19:58:20 +00:00
Josh Gao
727b07b260 adb: fix old host transport selection.
We regressed handling of the old host transport selection syntax, which
broke users that reimplement adb themselves (e.g. Studio via ddmlib).

Bug: https://issuetracker.google.com/140369526
Test: adb raw "host-serial:822X0028S:forward:tcp:42929;localabstract:/com.example.ndktest-0/platform-1568299082100.sock"
Test: ./test_device.py
Change-Id: Iaaec8fde952316fe9bf2a6f6c6c4a3bc9f74bf72
2019-09-13 00:26:37 +08:00
Colin Cross
537e4af235 Merge changes from topic "protobuf-3.9.1"
* changes:
  Use installed paths of vndk libraries for ld.config.txt
  Adapt to google::protobuf::int64 type change
2019-09-11 18:00:15 +00:00
Josh Gao
3b8cd67dff Add stub code to read MS OS 2.0 descriptors.
Linux doesn't seem to actually support emitting them, so we can't check
that they're actually there, but commit the code to read them so that
if and when Linux gets support, it's easier to check.

This also adds some error checking for ill-formed binary object store
entries.

Test: check_ms_os_desc
Change-Id: I4baf6a16f0f96acbec468b843db65d4ab3a589fe
2019-09-06 14:45:11 -07:00
Josh Gao
27512c9e49 adb: add host tool to check for WinUSB descriptor.
Bug: http://b/68993980
Test: manual
Change-Id: I97395c9738a671dd136c6cf66f88fdb769ec7227
2019-09-05 15:56:54 -07:00
Colin Cross
cfcc0b0337 Adapt to google::protobuf::int64 type change
Protobuf 3.9.1 redefines google::protobuf::int64 from long long to
int64_t, which is sometimes long and sometimes long long.  Use PRId64
to print it.

Bug: 117607748
Test: m checkbuild
Change-Id: I6699cfdb0f0424aa3e1c98b59d941beb9f133055
Merged-In: I6699cfdb0f0424aa3e1c98b59d941beb9f133055
2019-09-05 14:46:16 -07:00
Josh Gao
1f32a20c5c Merge changes Iacf0093a,I40be3504
am: c2f53906e8

Change-Id: I21f8c74909b218a2d35d149305d9858722911cd1
2019-08-20 13:40:55 -07:00
Josh Gao
c2f53906e8 Merge changes Iacf0093a,I40be3504
* changes:
  adb: fdevent: add fdevent_context_epoll.
  adb: extract soon-to-be-common code.
2019-08-20 20:00:34 +00:00
Josh Gao
ada40cd6b8 Merge "adb: fix mac build"
am: ef356fa5bd

Change-Id: Ia7324a9137ce296f2090c82993b1c4726bb25553
2019-08-19 16:54:43 -07:00
Adrian Roos
68c14d10b8 adb: fix mac build
Ensure that off64_t is defined when building adb for mac

Fixes: 139646013
Test: make # On mac
Change-Id: I32b68738d71c8a63a35c22434092933dcabac1ce
(cherry picked from commit 2167b9082d)
2019-08-19 10:51:00 -07:00
Dan Albert
8c2b3a8cde Revert "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
This reverts commit b2d79c5e48.

Bug: http://b/135753060
Test: treehugger
Change-Id: I2b1b2b7dfb7bab783e4ed40e295329525ceaa0dd
(cherry-picked from internal commit ba4684c2b2)
2019-08-15 17:27:49 -07:00
Josh Gao
b43ad44f4c adb: fdevent: add fdevent_context_epoll.
Implement an epoll-backed fdevent_context, that reduces overhead when
we're polling many file descriptors. FdeventTest.smoke goes from ~5.2s
to ~3.3s when run on the host (after this patch's modification to change
it from chaining 10 file descriptors together to 512).

Test: adb_test on host
Test: adbd_test on blueline
Test: test_adb.py
Test: test_device.py
Change-Id: Iacf0093aa7bebea31e447c2cb012af72d8c3297e
2019-08-14 13:56:08 -07:00
Josh Gao
e22cb9f306 adb: extract soon-to-be-common code.
As a side effect, delete FDE_ACTIVE, which was always set on every
fdevent, and FDE_PENDING, which was an internal implementation detail.

This patch removes spin detection, which will be reimplemented
separately later.

Test: adb_test on host
Test: adbd_test on blueline
Change-Id: I40be3504ce03c4fae5e071fa018542a051b7511d
2019-08-14 13:56:08 -07:00
Yurii Zubrytskyi
71d621dd36 Merge "[adb] Use STL for ParseUInt() implementation"
am: 61bffa5fc0

Change-Id: Iafbacab5e2ddf180683d501cd702ad39017104f9
2019-08-14 01:41:47 -07:00
Treehugger Robot
61bffa5fc0 Merge "[adb] Use STL for ParseUInt() implementation" 2019-08-14 06:32:44 +00:00
Josh Gao
86ba5c9433 Merge "adb: use shell for remount to forward return codes."
am: edf8040152

Change-Id: I19682ef013b3d41a1085fe8e4ed632544d29d148
2019-08-13 18:38:49 -07:00
Josh Gao
edf8040152 Merge "adb: use shell for remount to forward return codes." 2019-08-14 00:26:04 +00:00
Songchun Fan
a791d59547 Merge "[adb] Add a getter for native Win32 file handle"
am: 93619e373a

Change-Id: I4e9d8ca2964bfbc9e290ff13f46e03e93f4e4447
2019-08-13 13:22:54 -07:00
Songchun Fan
93619e373a Merge "[adb] Add a getter for native Win32 file handle" 2019-08-13 19:51:01 +00:00
Josh Gao
8c2198c809 adb: use shell for remount to forward return codes.
Bug: http://b/25842395
Test: manual
Change-Id: I719c86bdf573db14ca2a0bdf608065ad63f573c1
2019-08-12 18:31:45 -07:00
Josh Gao
09ee10f185 Merge "adb: windows: fix writev on sockets."
am: 3d0ecde28f

Change-Id: I5b8a01a6f2dd0fd1b34e18971cfc1ed9e08d5a8f
2019-08-12 16:11:54 -07:00
Treehugger Robot
3d0ecde28f Merge "adb: windows: fix writev on sockets." 2019-08-12 22:33:44 +00:00
Josh Gao
34a478f572 adb: add ls_v2.
Add a 64-bit size/time variant of `adb ls`.

Bug: http://b/122955521
Test: adb shell dd if=/dev/zero bs=1m count=8192 of=/data/local/tmp/big
Test: adb pull /data/local/tmp/big
Test: adb ls /data/local/tmp
Change-Id: I6ff857239995bc7b5c5f8dfd65a36fad41e67d85
2019-08-12 13:46:34 -07:00
Josh Gao
51fcf3222b adb: rename syncmsg::*::time to mtime.
Test: mma
Change-Id: Ia7d743d523f7fb45d8be7518b2db763614edcc85
2019-08-12 13:46:34 -07:00
Anatol Pomozov
2df2d458fa Merge "Add header that declares memcpy function"
am: 239439b787

Change-Id: I932a8302ff9ad38dd174740e9a06ff80d7a56204
2019-08-09 19:21:35 -07:00
Anatol Pomazau
60509705e6 Add header that declares memcpy function
It fixes following issue when compiling adb with host libraries:

In file included from core/adb/client/adb_install.cpp:31:
In file included from core/adb/adb.h:30:
In file included from core/adb/socket.h:28:
core/adb/types.h:237:9: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
        memcpy(copy->data(), first_block->data() + begin_offset_, copy->size());
        ^~~~~~
        wmemcpy
/usr/include/wchar.h:262:17: note: 'wmemcpy' declared here
extern wchar_t *wmemcpy (wchar_t *__restrict __s1,

Change-Id: I233e533fa7a5e2ed98190e34e32ddbaddc528558
2019-08-09 22:20:15 +00:00
Anatol Pomazau
cb0bd19b35 Merge "Add header that declares atomic primitives"
am: 3e59c847cc

Change-Id: I1f3f883354c06c90d9cbf7a7aa2c59526d4e9dcc
2019-08-09 14:48:25 -07:00
Treehugger Robot
3e59c847cc Merge "Add header that declares atomic primitives" 2019-08-09 21:36:41 +00:00
Songchun Fan
25fc86357a Merge "[adb] Cache features set inside the client process"
am: 6e861740ff

Change-Id: I150ca16badd7eb07e2706d3832504adebad68005
2019-08-08 18:05:21 -07:00
Songchun Fan
3487d983d4 Merge "[adb] Speed up the streaming install"
am: 82834f1264

Change-Id: I9705ccd0b9e524b79039d52bcf60bc52af3b514c
2019-08-08 18:03:53 -07:00
Songchun Fan
6e861740ff Merge "[adb] Cache features set inside the client process" 2019-08-09 00:40:51 +00:00
Songchun Fan
82834f1264 Merge "[adb] Speed up the streaming install" 2019-08-09 00:38:50 +00:00
Anatol Pomazau
7b2ff6debc Add header that declares atomic primitives
It fixes a compilation issue:

/fdevent/fdevent_poll.cpp -o core/adb/fdevent/fdevent_poll.cpp.o
In file included from core/adb/fdevent/fdevent_poll.cpp:20:
In file included from core/adb/fdevent/fdevent_poll.h:29:
core/adb/fdevent/fdevent.h:106:10: error: no template named 'atomic' in namespace 'std'
    std::atomic<bool> terminate_loop_ = false;
    ~~~~~^

Change-Id: I5305a69a50e2638f514c5a7d47a9612b8ee38c69
2019-08-08 23:30:42 +00:00
Yurii Zubrytskyi
709dfc3524 [adb] Add a getter for native Win32 file handle
+ adb_pread() and adb_pwrite() functions for simpler cross
  platform file operations

Test: builds
Change-Id: I7e2b23e1da79acd7be974a3d7e1be0fb77d7d2c6
2019-08-08 15:52:21 -07:00
Josh Gao
479627b823 Merge changes I4d6bda45,I72576e1f
am: 6c4cfd6af5

Change-Id: I83c66644227840376d8ee31dfa250539a24f3315
2019-08-08 13:54:00 -07:00
Josh Gao
6c4cfd6af5 Merge changes I4d6bda45,I72576e1f
* changes:
  adb: fix transport acquisition for forward, reverse.
  adb: don't manually construct device selection prefix in forward.
2019-08-08 20:38:15 +00:00
Yurii Zubrytskyi
6eca0e6999 [adb] Speed up the streaming install
1. Use bigger buffer for transfers - 64kb is the default size
   for push, so let it be the same in streaming

2. Use abb when it's available for lower overhead

3. Add a posix_fadvise() on the source APK

4. Increase buffer sizes for the socketpair that's transferring
the data from adbd.

Overall this saves about 25% time for streaming installations
and makes it faster than the legacy push (at last!)

Test: manual
Change-Id: Ieb84284da2058944815e062ef6e4389b842565fa
2019-08-08 12:55:51 -07:00
Josh Gao
5ae4a90400 adb: windows: fix writev on sockets.
Bug: http://b/139078301
Test: treehugger
Change-Id: I000c12ef9dedad530a166175cf089df45378f759
2019-08-07 18:26:47 -07:00
Josh Gao
3346339fcb adb: fix transport acquisition for forward, reverse.
Previously, we were calling acquire_one_transport with all empty
parameters, which would work when only one device is connected, but fail
when there are multiple. We've already acquired a transport and put it
into the socket as part of the forward request, so just use that
directly.

Bug: http://b/136198949
Test: test_device.py with multiple devices connected
Change-Id: I4d6bda45b36b71e418ecd9ead61b7379e68aa19b
2019-08-06 17:01:11 -07:00
Josh Gao
da9c767826 adb: don't manually construct device selection prefix in forward.
Use the existing infrastructure instead.

Test: test_adb.py
Test: test_device.py
Change-Id: I72576e1fb922af71852b50ddb3f4cb5c39eb333f
2019-08-06 16:43:34 -07:00
Elliott Hughes
09529e67cb Merge "adb: fail better in install-multiple."
am: 91a531897a

Change-Id: I6ec95d607c686c380fcdcad55bf6afb7bf0c44e3
2019-08-06 12:46:22 -07:00
Elliott Hughes
62d73aba8d Merge "adb: add --abi to the adb install help."
am: dad291fc46

Change-Id: Ib6d5bef802f05abeb680ed1f406925ceb32053a7
2019-08-06 12:40:57 -07:00
Elliott Hughes
b2b26672d0 Merge "Fix adb install on very old Android releases."
am: 8c4db55f66

Change-Id: Ie7328c2ec7aa9e8983824afb6239fce5d984847d
2019-08-06 12:40:23 -07:00
Elliott Hughes
91a531897a Merge "adb: fail better in install-multiple." 2019-08-06 19:33:34 +00:00
Elliott Hughes
dad291fc46 Merge "adb: add --abi to the adb install help." 2019-08-06 19:31:54 +00:00
Elliott Hughes
8c4db55f66 Merge "Fix adb install on very old Android releases." 2019-08-06 19:31:44 +00:00
Elliott Hughes
541d7408c1 adb: fail better in install-multiple.
If we're failing out, don't print any messages from the shutdown code:
it's not interesting (and actively confusing!) to talk about the
"Success" of finalizing an aborted session.

Also fail early if stat fails the first time (we have to tell
PackageManager how much data to expect, for some reason).

Also use `bool` as the boolean type and add quotes around filenames in
error messages.

`install_multi_package` looks like the same nonsense copy & pasted, but
I don't know what that is, and haven't seen any bug reports, so I'm
ignoring that for now.

Bug: http://b/133522725
Test: manual
Change-Id: Id054dff44f21f4c4cc5877dcc2735fc1eb25f9a0
2019-08-05 17:06:04 -07:00
Elliott Hughes
c0ebd59073 adb: add --abi to the adb install help.
A bit of a break with convention, but we do already document `-t` which
is actually a PackageManager option, not an adb option, and `--abi`
seems like it'll be seeing increased usage these next few years.

Also add a pointer to `adb shell pm help` for full details of
PackageManager options.

Bug: http://b/122487331
Test: manual
Change-Id: I93f48d202e5707b27caadb5af2a65c485c6d3407
2019-08-02 17:09:30 -07:00
Elliott Hughes
94350737e3 Fix adb install on very old Android releases.
See the code comment for the gory details.

Bug: https://issuetracker.google.com/37035817
Bug: http://b/37704384
Test: manual testing on a variety of devices & emulators
Change-Id: If9e481924a8a2f3ec1e926342b2ecd522fa933a2
2019-08-02 16:10:45 -07:00
Yurii Zubrytskyi
e800af5c23 [adb] Cache features set inside the client process
Test: manual
Change-Id: I99962edd85e9694c3ca309624368cda6355da008
2019-08-02 11:37:32 -07:00
Yurii Zubrytskyi
d3d650628c [adb] Use STL for ParseUInt() implementation
Test: builds
Change-Id: I8c4d4f24e3496601362fcbbdaa071a29ab9f360a
2019-08-02 11:33:41 -07:00
Elliott Hughes
8836527a1f Merge "adb: fix track-devices-l."
am: 6bac7cd942

Change-Id: I75f4941199c402b79b21b587c30186ee9fff6ecb
2019-07-31 18:54:04 -07:00
Elliott Hughes
fc2f5f6728 adb: fix track-devices-l.
Also add a -l to the undocumented `adb track-devices` for easier
testing.

Bug: https://issuetracker.google.com/118470090
Test: manual
Change-Id: I436f6e45b249b98a073aa147ad4ed67d4d87f9bd
2019-07-31 14:14:59 -07:00
Elliott Hughes
45e2255f65 Merge "Restore default port for adb connect."
am: 690c8c8f25

Change-Id: I6e5edbe8389473c775d986e37d4774e1a8517751
2019-07-31 13:14:58 -07:00
Elliott Hughes
23b37f43b6 Merge "Allow overriding the log path."
am: 11295b7f8b

Change-Id: I7f34ba23b540850518713b88a11409946d02bd26
2019-07-31 13:14:19 -07:00
Elliott Hughes
1a58f4f36d Merge "Clarify adb sync -l help text."
am: 51406823c1

Change-Id: Ia09293aef5c8b863f43a84c963fd84297d309746
2019-07-31 13:12:54 -07:00
Elliott Hughes
690c8c8f25 Merge "Restore default port for adb connect." 2019-07-31 19:48:02 +00:00
Treehugger Robot
11295b7f8b Merge "Allow overriding the log path." 2019-07-31 19:44:58 +00:00
Treehugger Robot
51406823c1 Merge "Clarify adb sync -l help text." 2019-07-31 19:44:49 +00:00
Elliott Hughes
573e67cbeb Restore default port for adb connect.
The default port of 5555 was removed a while back, but the help text was
never updated, and other contexts still allow a default port.

Bug: https://issuetracker.google.com/128561172
Test: manual
Change-Id: I6e5e6edeb2243386a0301c0a6cad569189f9910e
2019-07-30 21:55:56 -07:00
Josh Gao
e21440e547 Merge "adb: avoid leaking pty master FDs."
am: 47757e93aa

Change-Id: If6f73cd4d04c33b5f569d59c329b314e79efe572
2019-07-30 20:20:59 -07:00
Treehugger Robot
47757e93aa Merge "adb: avoid leaking pty master FDs." 2019-07-31 02:55:35 +00:00
Joshua Gilpatrick
a84882427e Merge "Fastdeploy converted to c++ and bin2c on the jar."
am: 60fa8b8ad2

Change-Id: Ied5f860f08599c5ab236ecca084effbb90f93285
2019-07-30 15:46:02 -07:00
Josh Gao
6733b2bf38 adb: avoid leaking pty master FDs.
Reimplement openpty with O_CLOEXEC to avoid accidentally leaking pty
master FDs.

Bug: http://b/138297062
Test: manual
Change-Id: I6d83c909232a95c9f03370f078aec7b0911d7369
2019-07-30 14:48:57 -07:00
Elliott Hughes
1a9da399cb Allow overriding the log path.
Bug: https://issuetracker.google.com/112588493
Test: manual
Change-Id: Ic273d46544479332b8e031f30feadd1840f2d653
2019-07-30 12:26:31 -07:00
Elliott Hughes
4c8ea89afb Clarify adb sync -l help text.
Seems like the bug submitter thought that -l listed the partitions shown
on the line above, rather than the files. Be more explicit.

Bug: https://issuetracker.google.com/73122762
Test: treehugger
Change-Id: I6ed1027639a5b785a5992909430d739958d10ad7
2019-07-30 10:32:53 -07:00
Joshua Gilpatrick
af3ce0876c Fastdeploy converted to c++ and bin2c on the jar.
Test: Added test for DeployPatchGenerator and PatchUtils cpp files.
Bug: 138130943
Change-Id: I6a128eff4cda00dd05c1bccec71e2678a8b13324
2019-07-29 12:00:09 -07:00
Josh Gao
f2dd09ff5b Merge "adb: switch from system_clock to steady_clock."
am: 278754aeac

Change-Id: Ifd0e99d4caade013ed809d21818fa5f5fc86f1bf
2019-07-23 18:31:24 -07:00
Josh Gao
63e8d9815f adb: switch from system_clock to steady_clock.
Test: treehugger
Change-Id: I10b884dc159a5ba624bc0f7ad53a402bffb14293
2019-07-22 16:18:25 -07:00
Josh Gao
1c8ecd77cd Merge changes I35f8843e,Icd2a94f8,I6c20f3b3
am: 1f1a0009fc

Change-Id: I13b66d553915bf4bdada12e854214d3232150423
2019-07-17 11:20:59 -07:00
Josh Gao
1f1a0009fc Merge changes I35f8843e,Icd2a94f8,I6c20f3b3
* changes:
  adb: win32: don't shutdown socket when closing.
  adb: win32: silence wine test failure.
  adb: win32: fix adb_test.
2019-07-17 18:04:29 +00:00
Josh Gao
08bd13eb3d adb: win32: don't shutdown socket when closing.
This appears to be an attempt to do orderly shutdown, but it doesn't
wait until the socket becomes readable, so it doesn't actually work. We
implement orderly shutdown elsewhere already, so delete this so that we
don't accidentally shutdown a duped socket.

Test: wine adb_test
Change-Id: I35f8843e8e6dbc7886fd545f0e43375a005e160f
2019-07-16 15:22:58 -07:00
Josh Gao
2ad4c3696f adb: win32: silence wine test failure.
Wine implements sockets with their own internal socketpair, which
results in the poll disconnect test failing.

Bug: http://b/117568356
Test: wine adb_test.exe
Change-Id: Icd2a94f8297fefd5c02e6517568fe288b168032c
2019-07-16 15:22:51 -07:00
Josh Gao
efd8ae2d54 adb: win32: fix adb_test.
At some point between Q and master, adb_test.exe stopped working because
it wasn't being linked with -municode?

Test: wine adb_test.exe
Change-Id: I6c20f3b3241cee2052d31d1ca85b8a9738828f6e
2019-07-16 15:21:59 -07:00
Steven Moreland
1c9abb85cb Merge "libadbd_services: remove unused deps"
am: a1821e13f3

Change-Id: I8ebee3fde274c70f60b3419c3dc920de51a87213
2019-07-12 10:10:55 -07:00
Steven Moreland
e0d94b6493 libadbd_services: remove unused deps
Bug: 137311188
Test: library still builds
Change-Id: I52e110ddfda073c833e86194eaf7a9502b9181a6
2019-07-11 16:13:10 -07:00
Josh Gao
d057fb5345 Merge changes from topic "fdevent_refactor"
am: 88d23135d2

Change-Id: I5871b36885fbeb5db594d5bb60b043dbd41ff3bb
2019-07-09 13:38:26 -07:00
Josh Gao
77e1372ad9 adb: fdevent: extract Create/Destroy from fdevent_context_poll.
am: 33944a2742

Change-Id: Ie999135e7a60d01848e3ccee13d93135ab2170e8
2019-07-09 13:38:10 -07:00
Josh Gao
296977fed9 adb: fdevent: move TerminateLoop to fdevent_context.
am: ebaa348d32

Change-Id: Ide34c57e2614e43a735249dbaba5277015cb47d4
2019-07-09 13:37:57 -07:00
Josh Gao
57c060a4b8 adb: fdevent: move CheckMainThread logic to fdevent_context.
am: 2c95bf73a5

Change-Id: I27a9059d7009218551b65c1c59db082e87b86c60
2019-07-09 13:37:44 -07:00
Josh Gao
f46ca64f08 adb: fdevent: delete FDE_CREATED.
am: e546f6816e

Change-Id: I3f89664e32fe80af05e5ebc35d333533bfd97745
2019-07-09 13:37:32 -07:00
Josh Gao
3f06c2ba19 adb: fdevent: move run queue to fdevent_context.
am: 95eef6b097

Change-Id: I131984a407220281364c016f832aef45e0f9a457
2019-07-09 13:37:20 -07:00
Josh Gao
8935c1c89f adb: implement fdevent_reset by constructing a new context.
am: 7adca93fe9

Change-Id: Iefd84fb5453ed757feb3b8431c7b31f99e39541e
2019-07-09 13:36:59 -07:00
Josh Gao
e62c2c2485 adb: move fdevent implementation out to a separate file.
am: 95068bbd9a

Change-Id: I4000e495ab9f73863fa7cf8ce5d4742e43a4b020
2019-07-09 13:36:44 -07:00
Josh Gao
b0168bcb04 adb: de-globalize fdevent context.
am: c2cf121174

Change-Id: Ic01cd85b2742ff73399007431f696b0dc372ef50
2019-07-09 13:36:04 -07:00
Josh Gao
261569d533 adb: move fdevent to its own folder.
am: 57e09b16ca

Change-Id: I1f9e0da9a94c8889c378e8ca9dd9b37a48dca58b
2019-07-09 13:35:38 -07:00
Josh Gao
88d23135d2 Merge changes from topic "fdevent_refactor"
* changes:
  adb: fdevent: extract Add/Del/SetTimeout.
  adb: fdevent: extract Create/Destroy from fdevent_context_poll.
  adb: fdevent: move TerminateLoop to fdevent_context.
  adb: fdevent: move CheckMainThread logic to fdevent_context.
  adb: fdevent: delete FDE_CREATED.
  adb: fdevent: move run queue to fdevent_context.
  adb: implement fdevent_reset by constructing a new context.
  adb: move fdevent implementation out to a separate file.
  adb: de-globalize fdevent context.
  adb: move fdevent to its own folder.
  adb: add superfluous include.
2019-07-09 20:02:29 +00:00
Justin Yun
6069891e84 Merge "Rename product_services to system_ext"
am: 5ffffb4f30

Change-Id: I4bdddd6074461f1db7f6be85120ad5f32f45fbb3
2019-07-09 02:15:04 -07:00
Justin Yun
5d0ac62995 Rename product_services to system_ext
Update adb, fastboot and mount point

Bug: 134359158
Test: build and check if system_ext.img can be flashed
Change-Id: I6219f72242c5fe42a508008c0b1fd218d74da5b6
2019-07-09 08:56:53 +00:00
Josh Gao
33944a2742 adb: fdevent: extract Create/Destroy from fdevent_context_poll.
Test: adb_test
Change-Id: Ida308e8e281cbb2954277196a51945f124ce5823
2019-07-08 18:32:24 -07:00
Josh Gao
ebaa348d32 adb: fdevent: move TerminateLoop to fdevent_context.
Test: adb_test
Change-Id: Ib1f20aefdb36603e2ceac4197c02551f557056ee
2019-07-08 18:32:24 -07:00
Josh Gao
2c95bf73a5 adb: fdevent: move CheckMainThread logic to fdevent_context.
Test: adb_test
Change-Id: I10b93293af22d54ec739dc0f95c95df3ab082fb6
2019-07-08 18:32:24 -07:00
Josh Gao
35b29360a2 adb: fdevent: extract Add/Del/SetTimeout.
Test: adb_test
Change-Id: Ibed301f8de73289837153fdfed370a681c24ac55
2019-07-08 18:32:24 -07:00
Josh Gao
e546f6816e adb: fdevent: delete FDE_CREATED.
All fdevents must be created by fdevent_create/fdevent_context::Create
now, so this flag is meaningless.

Test: none
Change-Id: I8489afad07bdb267ddfdb0dbb25d40d3a62f55f6
2019-07-08 18:05:55 -07:00
Josh Gao
95eef6b097 adb: fdevent: move run queue to fdevent_context.
Make the run queue logic reusable between implementations of fdevent by
moving it to the abstract base class.

Test: adb_test
Change-Id: If2f72e3ddc8007304bca63aa75446fa117267b25
2019-07-08 18:05:47 -07:00
Josh Gao
7adca93fe9 adb: implement fdevent_reset by constructing a new context.
Test: adb_test
Change-Id: Ie67afafe2b73fb2a8fc08568560adac6f456eb9a
2019-07-08 17:32:14 -07:00
Alex Buynytskyy
339fcd996a Merge "Refactorings to match adb_abb to adb_shell code."
am: 463773b733

Change-Id: Ia4724a38e8474bbae94c640ccd9cb3cf7d8f1915
2019-07-08 17:19:47 -07:00
Josh Gao
95068bbd9a adb: move fdevent implementation out to a separate file.
Test: mma
Change-Id: I8af945b9ae0accac75fa93c538e44cbab357bb5d
2019-07-08 16:03:27 -07:00
Josh Gao
c2cf121174 adb: de-globalize fdevent context.
Test: adb_test
Test: adbd_test
Change-Id: If711257d831b9090b38412821466c1d358d53d2d
2019-07-08 14:37:27 -07:00
Josh Gao
57e09b16ca adb: move fdevent to its own folder.
Preparatory refactoring for platform-specific implementations.

Test: mma
Change-Id: I0f600122ac89241788c5f3300f362fd9ef02ddcd
2019-07-08 14:37:27 -07:00
Josh Gao
2d03ad42ed adb: add superfluous include.
Resolve a merge conflict between internal and aosp by making aosp look
like internal.

Test: none
Change-Id: I7bea6ab61ad45ff20a3d07abf3f73903a7c05585
Merged-In: If73b81ca73ba4d64763cf49c1bbe42de81fa1cb6
2019-07-08 14:37:27 -07:00
Alex Buynytskyy
cc2f124070 Refactorings to match adb_abb to adb_shell code.
Test: Build, flash and boot, use `adb abb` to verify

Change-Id: I30eb6e8a4fd43b1548a9398376c72e2cb31223a4
2019-07-08 18:30:26 +00:00
Josh Gao
22c98da7e7 Merge "adbd: move jdwp listening logic into ART." am: d194013097
am: 56d33633c2

Change-Id: I40666175760849bd27a94437422559f7b9caba7f
2019-06-28 12:17:22 -07:00
Josh Gao
d194013097 Merge "adbd: move jdwp listening logic into ART." 2019-06-28 19:01:38 +00:00
Josh Gao
5f2c5bbd04 adbd: move jdwp listening logic into ART.
Test: manually use jdwp
Change-Id: Ia09a5c643cba9ec5f343c9767d43d72b077bc247
2019-06-25 12:37:20 -07:00
Dan Albert
134c98814a Revert "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
am: ba4684c2b2

Change-Id: I030ce911424f7315cd3b9c4f299b4232ee81e9aa
2019-06-25 08:01:04 -07:00
Dan Albert
38bdc11d4b Revert "adb: turn CHECKs into an error + transport restart."
am: 2547f740ea

Change-Id: I6855ae62f61d9d1cc234dd15de5ce4a3b39d6faf
2019-06-25 08:01:00 -07:00
Elliott Hughes
7d9841a07c Merge "Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""" am: 12794c039a
am: 6c79fd22be

Change-Id: Iafcc88c0441225d9279ff145c718be77851d639b
2019-06-24 23:34:54 -07:00
Elliott Hughes
12794c039a Merge "Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""" 2019-06-25 05:56:53 +00:00
Elliott Hughes
fab9f30f6f Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""
This reverts commit b00e66f754.

Reason for revert: http://b/135753060

Change-Id: I30f472427f52076b64902420f9538b4a880a2cbe
2019-06-25 05:42:55 +00:00
Dan Albert
ba4684c2b2 Revert "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
This reverts commit b2d79c5e48.

Bug: http://b/135753060
Test: treehugger
Change-Id: I2b1b2b7dfb7bab783e4ed40e295329525ceaa0dd
2019-06-24 14:36:43 -07:00
Dan Albert
2547f740ea Revert "adb: turn CHECKs into an error + transport restart."
This reverts commit b41d7ae1a9.

Bug: http://b/135753060
Test: treehugger
Change-Id: Ib7cd7b7eaffa55ec2884a096a1c11739b12af6d1
2019-06-24 14:36:41 -07:00
Dan Albert
782036b7af Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""
This reverts commit c33aee8ac1.

Bug: http://b/135753060
Test: treehugger
Change-Id: Ic83a44e7c8f860a6c044ca20ec81f365a8a6ba4b
2019-06-24 14:36:31 -07:00
Josh Gao
c33aee8ac1 Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
Read until we receive FUNCTIONFS_BIND after every USB descriptor setup,
instead of only after initial creation of the control fd, so we properly
handle a rebind caused by a change of the USB configuration.

This reverts commit 55b31933f41b1c550b788fa2054010c51f56111b.

Bug: http://b/133132986
Bug: http://b/135155652
Test: manually enabled/disabled MTP with nonblocking_ffs enabled and disabled
Change-Id: Ibb3f46b8f84854ede47a669a85e07e16a5dd6008
Merged-In: Ibb3f46b8f84854ede47a669a85e07e16a5dd6008
(cherry picked from commit b00e66f754)
2019-06-21 14:29:21 -07:00
Josh Gao
b2e5ca2328 Merge "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" am: 2a6ec6c332
am: 5c7c698a97

Change-Id: I94222297a504954ddca5f6ec9b3f7a077e4d0647
2019-06-20 20:02:58 -07:00
Josh Gao
2a6ec6c332 Merge "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" 2019-06-21 02:36:56 +00:00
Josh Gao
b41d7ae1a9 adb: turn CHECKs into an error + transport restart.
These CHECKs are expected to happen if the client does the wrong thing,
so we probably shouldn't be aborting in adbd.

Bug: http://b/133872605
Bug: http://b/134695864
Test: treehugger
Change-Id: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
Merged-In: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
(cherry picked from commit fc0f80ae49)
2019-06-19 15:01:02 -07:00
Josh Gao
b2ea09115c Merge "adb: turn CHECKs into an error + transport restart." am: ad0f27fe72
am: 7373282999

Change-Id: I60415fb9fefb59585e27ba4181a9a69168709758
2019-06-18 21:28:08 -07:00
Treehugger Robot
ad0f27fe72 Merge "adb: turn CHECKs into an error + transport restart." 2019-06-19 00:11:49 +00:00
Josh Gao
b00e66f754 Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
Read until we receive FUNCTIONFS_BIND after every USB descriptor setup,
instead of only after initial creation of the control fd, so we properly
handle a rebind caused by a change of the USB configuration.

This reverts commit 55b31933f41b1c550b788fa2054010c51f56111b.

Bug: http://b/133132986
Bug: http://b/135155652
Test: manually enabled/disabled MTP with nonblocking_ffs enabled and disabled
Change-Id: Ibb3f46b8f84854ede47a669a85e07e16a5dd6008
2019-06-18 15:00:15 -07:00
Josh Gao
7c3b87ffd2 Merge "Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" am: a6f90ce599
am: 099fc95530

Change-Id: Iaa1d67735ed8a4c582c42b630cf90c2c384fd2f6
2019-06-14 16:55:35 -07:00
Josh Gao
9dba0f5824 Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
We're only reading FUNCTIONFS_BIND on creation upon the first creation
of the control fd, which results in an abort when rebind happens (e.g.
when MTP is enabled) and we unexpectedly read FUNCTIONFS_BIND in the
second instantiation of the connection.

This reverts commit 2b668d3906.

Bug: http://b/135155652
Test: manually enabled MTP
2019-06-14 16:21:21 -07:00
Josh Gao
fc0f80ae49 adb: turn CHECKs into an error + transport restart.
These CHECKs are expected to happen if the client does the wrong thing,
so we probably shouldn't be aborting in adbd.

Bug: http://b/133872605
Bug: http://b/134695864
Test: treehugger
Change-Id: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
2019-06-13 13:16:57 -07:00
Hemant Kumar
b2d79c5e48 adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
Bug: http://b/129283234
Test: treehugger
Change-Id: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
Merged-In: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
(cherry picked from commit 1cbe5edbc3)
2019-06-13 12:38:19 -07:00
Josh Gao
db51d08cc8 Merge "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND." am: cb2352a75d
am: b965eea9c6

Change-Id: I81d74942931f8ede3e0c29d1ecef08d3f4f8149c
2019-06-12 07:53:09 -07:00
Treehugger Robot
cb2352a75d Merge "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND." 2019-06-12 14:34:14 +00:00
Josh Gao
2b668d3906 adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.
Rework the functionfs logic to avoid rebinding the USB interface
repeatedly.

Bug: http://b/133132986
Test: treehugger
Change-Id: I7f75874efd197764d40b66800a117ff4726d793b
2019-06-11 20:33:16 -07:00
Josh Gao
bcb3f13d00 Merge "adb: avoid freeing argv entries on Windows." am: 5b63cff411
am: c62f2aca24

Change-Id: Icbb6320d1399efe48efaa8c7a45789b42f63b049
2019-06-10 19:00:44 -07:00
Josh Gao
e72c44b24a adb: avoid freeing argv entries on Windows.
We assign string literals directly to argv[0], which leads to fun
explosions when we attempt to free  when the runtime can detect that
a bad free happened, which seems to happen reliably with lld.

Bug: http://b/110800681
Test: `adb shell true` on windows
Change-Id: Ica81e472c31686d80b58c41ff6d2b825baef06fb
2019-06-10 12:54:14 -07:00
Tao Bao
73a810993d Merge "adb: Allow adb rescue getprop." am: 8eea2cae86
am: a04d17174d

Change-Id: Iedcc4f3337e2c77bd21a8a8ac9f302a20f568660
2019-06-05 14:12:51 -07:00
Tao Bao
8eea2cae86 Merge "adb: Allow adb rescue getprop." 2019-06-05 20:43:55 +00:00
Josh Gao
8e707dede9 Merge changes I2d005e17,If2eec162,Icfd642e6 am: 2683d0a2ca
am: 961b03661a

Change-Id: I8a6957e1944389d2d6b162fdc8d97b430f353fbe
2019-06-04 19:31:37 -07:00
Josh Gao
a00228b646 Merge "adbd: provide MS OS descriptors for WinUSB." am: a891ffddd3
am: 91aa2ef730

Change-Id: I6c6e0675358e748c1228ce87626726fdccb2f533
2019-06-04 19:25:24 -07:00
Tao Bao
599eee1f37 adb: Allow adb rescue getprop.
Which will dump all the allowed properties, similar to `adb shell
getprop`.

Bug: 134027350
Test: Run the command under rescue mode.
Change-Id: Id668224098006d71ee192c8c2bea5d791d2423c1
2019-06-04 14:59:58 -07:00
Josh Gao
2683d0a2ca Merge changes I2d005e17,If2eec162,Icfd642e6
* changes:
  adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
  adbd: respond to device-to-host control transfers.
  adbd: read, print, and ignore USB control transfers.
2019-06-04 19:22:08 +00:00
Josh Gao
a891ffddd3 Merge "adbd: provide MS OS descriptors for WinUSB." 2019-06-04 19:22:00 +00:00
Mohammad Samiul Islam
361a99a3c4 Merge "Allow adb to handle single paramter with install-multi-package flag" am: d877a96656
am: c625e74d88

Change-Id: Ibbe33e4a9290b5e3b40898f7c75e58982ce47ae7
2019-06-03 16:04:00 -07:00
Treehugger Robot
d877a96656 Merge "Allow adb to handle single paramter with install-multi-package flag" 2019-06-03 22:49:48 +00:00
chihhao.chen
c097a5786d Merge "Fix non-aio USB read issue for fastbootd" into qt-dev
am: 9122289a97

Change-Id: I0274561a806f027452bf814a8e0cafbd5a7e0a85
2019-05-29 16:34:29 -07:00
TreeHugger Robot
9122289a97 Merge "Fix non-aio USB read issue for fastbootd" into qt-dev 2019-05-29 23:11:55 +00:00
chihhao.chen
8c544b6fd8 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
Merged-In: I6690324840d78f3f1e04235040301520329976db
2019-05-29 23:10:50 +00:00
chihhao.chen
5f8b966d96 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
2019-05-29 12:41:55 -07:00
Mohammad Samiul Islam
b581ce93bb Allow adb to handle single paramter with install-multi-package flag
Bug: 130164367
Test: $adb install-multi-package dummy.apk
      It installs successfully.

Change-Id: I5775813d10b7a8d865518ce5480a401e8f41e876
2019-05-29 15:00:00 +01:00
Hemant Kumar
1cbe5edbc3 adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
Bug: http://b/129283234
Test: treehugger
Change-Id: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
2019-05-28 17:53:24 -07:00
Josh Gao
43a0a9a5bf adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
Merged-In: If2eec162ca4b31a9974c7bd5802be51cee9e2708
(cherry-picked from internal commit af086e9a95)
2019-05-28 17:52:11 -07:00
Josh Gao
fc2e2003dd adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
Merged-In: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
(cherry-picked from internal commit 12807c7012)
2019-05-28 17:51:05 -07:00
Josh Gao
527d6dd738 Merge "adbd: respond to device-to-host control transfers." into qt-dev
am: 8ef22b102c

Change-Id: Ia371254756e7d951064607226b4f9cfc67832c0b
2019-05-22 16:15:04 -07:00
Josh Gao
db64696b7c adbd: provide MS OS descriptors for WinUSB.
Add Microsoft OS Descriptors so that on Windows, we get automatically
registered with the WinUSB driver instead of requiring a different INF
to be used with device with a different vendor ID.

Bug: http://b/68993980
Test: manually changed the vendor ID on a blueline and connected it to a Windows VM
Change-Id: Id78bae270df9805573a90a86019267b53a3c8252
2019-05-22 14:58:13 -07:00
Josh Gao
af086e9a95 adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
2019-05-21 16:39:51 -07:00
Josh Gao
26a6faf0ae Merge "adbd: read, print, and ignore USB control transfers." into qt-dev
am: 6031286936

Change-Id: I3e1a2052406b3399f7e11176ac2aca1adcb20f52
2019-05-20 17:17:31 -07:00
TreeHugger Robot
7eeed22871 Merge "adbd: reduce queue depths." into qt-dev 2019-05-21 00:05:34 +00:00
TreeHugger Robot
5b882637e1 Merge "adbd: avoid starting multiple worker threads." into qt-dev 2019-05-21 00:04:15 +00:00
Josh Gao
12807c7012 adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
2019-05-17 18:34:23 -07:00
Evgenii Stepanov
9da358d6d3 Initialize all fields of struct iocb.
Kernel does not accept non-zero value of iocb->aio_reserved2.

Bug: 132803232
Test: initialize malloc() memory to non-zero pattern and see what breaks

Change-Id: I65a7e89e3a2c1ba79df1dc2d011d6c76c41afb81
(cherry picked from commit fe7eca7b8f)
2019-05-16 12:55:41 -07:00
Evgenii Stepanov
79b1dc0106 Merge "Initialize all fields of struct iocb." am: 6e06bcce9c
am: 37c81fd6f0

Change-Id: I3c8155e222b7e7f4277d5654f85e7006a777dd16
2019-05-16 00:03:37 -07:00
Evgenii Stepanov
fe7eca7b8f Initialize all fields of struct iocb.
Kernel does not accept non-zero value of iocb->aio_reserved2.

Bug: 132803232
Test: initialize malloc() memory to non-zero pattern and see what breaks

Change-Id: I65a7e89e3a2c1ba79df1dc2d011d6c76c41afb81
2019-05-15 18:46:18 -07:00
TreeHugger Robot
82ebfca5cd Merge "adbd: don't abort on EOF on functionfs control fd." into qt-dev 2019-05-13 22:21:59 +00:00
Josh Gao
127da2ab6d Merge "adbd: don't abort on EOF on functionfs control fd." am: 41531df7b0
am: f848fac660

Change-Id: I9fda92cd15fa84318759a37606429621a0797d36
2019-05-13 11:58:57 -07:00
Josh Gao
1f7ae9d4e3 adbd: don't abort on EOF on functionfs control fd.
Also, improve the logging in the cases where we do abort.

Bug: http://b/131867920
Test: treehugger
Change-Id: If8ec9f4614ce146e6dbd21cc77587ea81658199b
(cherry picked from commit 2916e148d9)
2019-05-13 11:42:29 -07:00
Josh Gao
41531df7b0 Merge "adbd: don't abort on EOF on functionfs control fd." 2019-05-13 18:40:34 +00:00
Michael Groover
69277fb9c5 Merge "Notify the framework when an adb key is authorized" into qt-dev
am: b9c555e2cf

Change-Id: I664ba3acfb8295ccf7b773e07d2d007ff942bc40
2019-05-10 17:21:47 -07:00
Elliott Hughes
7b4bd88aa0 Merge "Clean up copy & paste from frameworks/base/cmds." am: d203a508ff
am: 9dedcc81ad

Change-Id: I2b851d9b6e8e60bd518fc209d263014c72c7c5b4
2019-05-10 17:12:42 -07:00
Treehugger Robot
d203a508ff Merge "Clean up copy & paste from frameworks/base/cmds." 2019-05-10 22:00:23 +00:00
Josh Gao
2916e148d9 adbd: don't abort on EOF on functionfs control fd.
Also, improve the logging in the cases where we do abort.

Bug: http://b/131867920
Test: treehugger
Change-Id: If8ec9f4614ce146e6dbd21cc77587ea81658199b
2019-05-10 11:37:34 -07:00
Al Sutton
4983a007cf Merge "Add deprecation warning to adb backup/restore" am: 09070afd38
am: 2cf161bcc7

Change-Id: Icaa05ed20fb043c98bc440a1a36390b2396eb227
2019-05-10 03:42:06 -07:00
Al Sutton
09070afd38 Merge "Add deprecation warning to adb backup/restore" 2019-05-10 08:40:50 +00:00
Stephen Hines
e5c452085b Merge "NFC: Fix potentially uninitialized 'port' variable." am: f0d59e24c3
am: 68b69c35b7

Change-Id: I3df8fa238dfaba119caad661914f59489d5c8207
2019-05-09 22:15:13 -07:00
Josh Gao
0bd7a96967 Merge "Revert "Revert "Add a way to turn off unique_fd's operator int.""" am: fe1d1e815f
am: 0df5a1cb66

Change-Id: I8cc21b88841d6a7b7b93efafbc89939540350214
2019-05-09 22:14:23 -07:00
Elliott Hughes
e98971c06e Clean up copy & paste from frameworks/base/cmds.
Test: treehugger
Change-Id: I337e6f7e48d4debfce010ad4b6f9fcb860c13fb7
2019-05-09 22:05:13 -07:00
Treehugger Robot
f0d59e24c3 Merge "NFC: Fix potentially uninitialized 'port' variable." 2019-05-10 01:34:56 +00:00
Michael Groover
7eeda6ba03 Notify the framework when an adb key is authorized
Bug: 124076524
Test: atest AdbDebuggingManagerTest
Change-Id: If73b81ca73ba4d64763cf49c1bbe42de81fa1cb6
2019-05-09 16:05:40 -07:00
Stephen Hines
391c40b9ec NFC: Fix potentially uninitialized 'port' variable.
Bug: http://b/131390872
Test: Builds with -Wconditional-uninitialized.
Change-Id: Ie699ec39307fb3b66ade8248cdbe3d6de42533a7
2019-05-09 12:55:41 -07:00
Al Sutton
31d335f39f Add deprecation warning to adb backup/restore
Test: Manual execution and verification of the message
Fixes: 131891013
Change-Id: Idc38fcdace2d79668a4daac0b99fb87d04fb4cb8
2019-05-09 16:14:05 +00:00
Josh Gao
27241a7a96 Revert "Revert "Add a way to turn off unique_fd's operator int.""
The original commit broke aosp-master-with-phones, because of
vendor libraries the depended on the int versions of libbase functions.

This patch reverts the revert, and also adds ABI-compatibility shims for
the replaced functions.

This reverts commit 2c58e1924a.

Bug: http://b/131312539
Test: treehugger
Test: forrest run of aosp-master-with-phones
Change-Id: I75cc84ec8d963e20862f7662e8e2f409471f41cc
2019-05-06 16:18:02 -07:00
Mark Salyzyn
5c812e7a13 Merge "adb: enable/disable verity expected overlayfs errors." am: be9c2c0310
am: 3809014902

Change-Id: Icb7f4cd3c20af1f80fa3ca2b05b906b38111b1e2
2019-05-06 08:38:56 -07:00
Treehugger Robot
be9c2c0310 Merge "adb: enable/disable verity expected overlayfs errors." 2019-05-06 14:36:51 +00:00
Elliott Hughes
f774bcc942 Merge "libbase: add ConsumePrefix/ConsumeSuffix." am: 7046bcb461
am: 9f6f62a485

Change-Id: Ie328e1a6da12ace87ebb2da65cbc649a1c972039
2019-05-03 17:48:43 -07:00
Josh Gao
a31aa2e749 Merge "adbd: move posix_fadvise after open." am: 19322dddc6
am: c97b258c42

Change-Id: I10f91ee1cedd16c1f803c3bdff9253fe3bca6841
2019-05-03 17:25:51 -07:00
Elliott Hughes
7046bcb461 Merge "libbase: add ConsumePrefix/ConsumeSuffix." 2019-05-04 00:03:14 +00:00
Treehugger Robot
19322dddc6 Merge "adbd: move posix_fadvise after open." 2019-05-03 23:23:59 +00:00
Mark Salyzyn
5828b77a3d adb: enable/disable verity expected overlayfs errors.
Expect EBUSY for overlayfs teardown, and ENOENT for setup.

Test: adb-remount-test.sh
Bug: 131614849
Change-Id: I0fb351d6d5fe758021c9e9043f57863c7a194c12
2019-05-03 14:44:49 -07:00
Elliott Hughes
b4dc7be6c5 libbase: add ConsumePrefix/ConsumeSuffix.
adb was already using ConsumePrefix, and now we have another would-be
user in cutils. (There appears to be one place in adb that should use
ConsumeSuffix, so I'm assuming we'll want that sooner or later.)

I've kept these inline because adb and google3's versions both were, and
I'm easily led.

Test: treehugger
Change-Id: I29d99032f6f6ccbfaefece59725db8afb02a4c87
2019-05-03 12:49:31 -07:00
Josh Gao
d594359e7f Merge "adbd: avoid starting multiple worker threads." am: 5ddd49eeae
am: dcfc785d20

Change-Id: Id5fbaba786214b2d5b9dcab7f433ce12f850d35d
2019-05-02 14:33:26 -07:00
Josh Gao
94fb36bf77 adbd: avoid starting multiple worker threads.
A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
(cherry picked from commit 910ce0ff08)
2019-05-02 14:13:14 -07:00
Treehugger Robot
5ddd49eeae Merge "adbd: avoid starting multiple worker threads." 2019-05-02 21:09:04 +00:00
Josh Gao
1f37bbb38c Merge "adb: increase adb [un]root timeout." am: 6bc132846a
am: bead01860d

Change-Id: I9c5d7e914d27705f3f021a476ac9adf19ec7039a
2019-05-02 09:19:02 -07:00
Treehugger Robot
6bc132846a Merge "adb: increase adb [un]root timeout." 2019-05-02 15:53:20 +00:00
Josh Gao
15cc1d641e Merge "adbd: compile a static version." am: 7a7c71b2b6
am: d8ccd6b57c

Change-Id: I9a305af5eaf20cfb136cb74833a4a5c6f41e69e0
2019-05-01 22:09:05 -07:00
Josh Gao
ef4a999343 adb: increase adb [un]root timeout.
3 seconds isn't generous enough, because if we're rapidly restarting
(e.g. `adb root; adb unroot`), init will wait 5 seconds to restart us.

Test: `adb root && adb unroot`
Change-Id: I353e8d1ee14f3b08416445ff627dea4a49afd9a4
2019-05-01 18:53:43 -07:00
Josh Gao
bde8c848d8 adbd: compile a static version.
Test: mma
Change-Id: I785de074f9b5cc63d1804420b734c4b07081a716
2019-05-01 18:25:52 -07:00