Commit Graph

2567 Commits

Author SHA1 Message Date
Josh Gao 8020d1d8f5 Merge "adbd: don't require authentication for userdebug/eng builds." am: bf62136be4
am: 0360ada8f5

Change-Id: I386ebf095d083a1f34d0ba9d313e73f6aefdcac6
2018-03-07 21:48:47 +00:00
Josh Gao f01cf8dec5 Merge "adbd: make static." am: b41b33581e
am: 51c06da6ca

Change-Id: I9170ca4973d9ee066c1c9ad7d8cb4f90d92837b5
2018-03-06 23:32:15 +00:00
Josh Gao 6eda1840cb adbd: don't require authentication for userdebug/eng builds.
By default, the build system only sets ro.adb.secure (to 1) when
building user builds.

Bug: http://b/73993211
Bug: http://b/74059119
Test: treehugger
Change-Id: I2a683257c1027394ded90c8d2634def6003e0525
2018-03-06 13:37:45 -08:00
Josh Gao 8db99f810d adbd: make static.
adbd is copied into the recovery image without the accompanying
linker/libraries, so it must be a static executable.

Bug: http://b/74237641
Test: `file $ANDROID_PRODUCT_OUT/system/bin/adbd`
Change-Id: Ie8d0710f6002458519d3eea3d696e9016faafee8
2018-03-06 13:01:34 -08:00
Jerry Zhang 4d1ee695c5 Merge "Make libasyncio headers usable from C" am: 5180d5b4dc
am: e661d52573

Change-Id: I31c4f488ffb7523c1b2980246be400d388ac0a25
2018-03-06 20:47:25 +00:00
Jerry Zhang 5180d5b4dc Merge "Make libasyncio headers usable from C" 2018-03-06 19:35:21 +00:00
Josh Gao 360cf3703b Merge changes from topic "adb_bp" am: 9ee373ac2c
am: ca6ec5c48b

Change-Id: I1a9a4bc92bf48d1d0af6bf74f6f84d20d43d10c9
2018-03-06 01:36:57 +00:00
Josh Gao 9ee373ac2c Merge changes from topic "adb_bp"
* changes:
  adb: remove meaningless const.
  adb: convert Connection to a nonblocking interface.
  adb: use soong version stamping.
  adb: switch over to Android.bp.
2018-03-05 23:45:27 +00:00
Josh Gao ffbd3364a4 adb: remove meaningless const.
Returning a const value is pointless.

Test: mma
Change-Id: Ia578d75345361d53e4a29bb9724bfcc161b8d8be
2018-03-05 13:00:28 -08:00
Josh Gao 0bbf69cbbf adb: convert Connection to a nonblocking interface.
Rename the existing Connection to BlockingConnection, add a nonblocking
Connection, and add an adapter between the two, to enable future work
to reduce the impedance mismatch from implementing a blocking interface
on top of nonblocking primitives.

While we're here, delete A_SYNC, and remove one layer of pipes when
sending a packet (replacing it with a condition variable when using
BlockingConnectionAdapter).

Test: python test_device.py, manually plugging/unplugging devices
Change-Id: Ieac2bf937471d9d494075575f07e53b589aba20a
2018-03-05 13:00:28 -08:00
Josh Gao c7567fa52e adb: use soong version stamping.
Bug: http://b/71719137
Test: adb version
Change-Id: Ic735814574c83a7c2b8bef213592d494f5ec3860
2018-03-05 13:00:08 -08:00
Jerry Zhang c3d4e7226a Make libasyncio headers usable from C
This allows us to enable LTP tests
for io_* syscalls.

Bug: 31152298
Test: LTP tests pass
Change-Id: Ic25189d8bf25cdacfa0f144ac57c7b2827adcd9f
2018-03-02 16:28:15 -08:00
George Burgess IV a712e2164a Merge "Add a NOLINT for the memory leak we added" am: 10f62351eb am: 4e3ae2cbfa
am: ad4025b35b

Change-Id: I1d4831bc70b8874e66583f4a130b3a711c24b019
2018-03-01 22:19:41 +00:00
George Burgess IV 657db00e3d Add a NOLINT for the memory leak we added
Added by I7255d45335fa009dc9e5de99dff67af52bd70e06

Bug: None
Test: Ran the analyzer. Complaint is gone.
Change-Id: Id9b8debd8b9690210f5a8e19154ee3a5095b8fbd
2018-03-01 18:59:50 +00:00
Josh Gao 2776845aa5 adb: switch over to Android.bp.
Rearrange some files while we're doing this.

Bug: http://b/71721338
Test: manually ran adb on windows
Change-Id: Ie47bda82279e4b9521505ad0353bf9ef649fc7d7
2018-02-28 15:29:50 -08:00
Josh Gao 0e459e1d47 Merge "adb: add a way to make the server intentionally leak." am: 1ac7150590 am: 9ba182e3bb
am: 399c3591f2

Change-Id: Ifa340ad4f3ce53786391722a7d4f8b97816dfd20
2018-02-28 23:16:34 +00:00
Josh Gao e2176118f4 adb: add a way to make the server intentionally leak.
Add a way to test LeakSanitizer with the server by adding an
environment variable that intentionally leaks.

Test: ASAN_OPTIONS=detect_leaks=1:leak_check_at_exit=1 ADB_LEAK=1 adb server nodaemon
Change-Id: I7255d45335fa009dc9e5de99dff67af52bd70e06
2018-02-28 14:16:14 -08:00
Luis Hector Chavez b14ce54176 Merge "Change the remount command to be more container-friendly" am: d24c8484c8 am: 677288c80a
am: d12cf88945

Change-Id: Ie9986fe8723ed34ecc787deb72bd75c89f1e8554
2018-02-28 17:12:31 +00:00
Treehugger Robot d24c8484c8 Merge "Change the remount command to be more container-friendly" 2018-02-28 16:48:37 +00:00
Josh Gao a085c9f826 Merge changes I0783be05,Id8178913 am: 09d5e258ef am: 2c1b3e9761
am: d8b711e16b

Change-Id: Ifa679ee1857fddf693f9e9b994bb4d9dff3f6c8a
2018-02-28 02:07:21 +00:00
Josh Gao e39ccd3cbd adb: allow reentrant calls to fdevent_run_on_main_thread.
Previously, reentrant calls to fdevent_run_on_main_thread would
deadlock.

Test: adb_test on host
Change-Id: I0783be0558dcaf61ddbe76d13ac6917fc2de0be0
2018-02-27 14:50:07 -08:00
Josh Gao d51c6df1ef adb: stop using quick_exit.
We don't actually need to use quick_exit to avoid calling static
destructors, since we have -Wexit-time-destructors to guarantee we
don't actually have any, and this precludes the use of asan's exit time
leak checking, so switch back to atexit/exit.

Test: ASAN_OPTIONS=detect_leaks=1:leak_check_at_exit=1 adb server nodaemon with a manually inserted leak
Change-Id: Id8178913f64cb02c820c5073351369a9e4d8c74d
2018-02-27 14:50:07 -08:00
Luis Hector Chavez 0db4b7a95b Change the remount command to be more container-friendly
Passing in MS_REMOUNT | MS_BIND tells the kernel to only remove the
MS_RDONLY flag and keep all the other flags the same. This is also the
only kind of remount that is allowed in Linux containers (to be more
precise, within user namespaces).

This change also attempts to always run the remount command when dealing
with /, since containers will almost always run a loop device, and since
the number of the device changes, it is not convenient to put it in the
fstab. Plus, the container won't have permission to modify it, but might
be able to perform the remount.

Bug: 72178046
Test: `adb remount` works in both sailfish and Chrome OS
Change-Id: I9e8ec8afcd57f67875a312824667768b3aa89faa
2018-02-27 14:37:26 -08:00
Josh Gao 0a3726a113 Merge "adb: switch apacket over to a std::string payload." am: 581a4ceb00 am: 4d74066425
am: ea9359a957

Change-Id: Ib9b1f7c9c3e59e3cfd3ea492360703d2b7a68119
2018-02-24 01:10:36 +00:00
Josh Gao f571fcbe87 adb: switch apacket over to a std::string payload.
Test: python test_device.py with walleye/x86_64 emulator
Change-Id: I0a18941af1cb2279e5019a24ace25741def1202f
2018-02-21 14:30:17 -08:00
Elliott Hughes 4c33b88c4b Merge "bpfmt." am: 0609e8d231 am: b57755c429
am: a91867a788

Change-Id: Ieb0985434e2464e47b3adb93fb27fe5042e91657
2018-02-20 02:24:45 +00:00
Treehugger Robot 0609e8d231 Merge "bpfmt." 2018-02-20 02:02:59 +00:00
George Burgess IV 54abd1d82f Merge "Fix a memory leak" am: cb1b68f9b3 am: 894337ee0b
am: 2a7d34014a

Change-Id: I2b763775555659f77e969f1d4d5bc73363afc53b
2018-02-19 11:02:02 +00:00
George Burgess IV cb2449f851 Fix a memory leak
If create_service_thread fails, we'll leak `arg`.

This fixes a static analyzer complaint:
system/core/adb/services.cpp:298:13: warning: Potential leak of memory
pointed to by 'arg'

Bug: None
Test: Reran the static analyzer. No more complaints about this leak.
Change-Id: I5aec7fd78f2cc775b650501b02bdf0039d1647ca
2018-02-19 01:05:56 -08:00
Elliott Hughes dc699a269f bpfmt.
Bug: N/A
Test: builds
Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2018-02-16 17:58:14 -08:00
Josh Gao d8e298a3ac Merge "adbd: receive jdwp pids from art as raw integers." am: d31df3a1be am: f6a2296aff
am: 33bedcde5b

Change-Id: I8317d035fe4d65e06bcd849b64654419c051c021
2018-02-14 00:06:17 +00:00
Treehugger Robot d31df3a1be Merge "adbd: receive jdwp pids from art as raw integers." 2018-02-13 23:34:49 +00:00
Josh Gao 483046d952 Merge "adb: fix build breakage." am: 14d7cdce51 am: a4c4ef463b
am: 07de47eeb3

Change-Id: I935612655924b3263883e0f4bfdba2bdbd9d5386
2018-02-13 08:50:37 +00:00
Josh Gao 69b86a24a4 Merge "adb: use delete on objects with destructors." am: e504360f3d am: 854879ecdc
am: 84cd5de121

Change-Id: I33b77e3daef7e7778cce6b05a36b9710f6209af5
2018-02-13 08:44:58 +00:00
Josh Gao 1b58bbf2ef adb: fix build breakage.
Test: mma
Change-Id: Id8e7ffd2212449bbac5b64b50e7b3aef7e97d649
2018-02-12 18:03:49 -08:00
Josh Gao e0361d1e90 adb: use delete on objects with destructors.
asocket has a destructor now, so we have to delete it, or leak the
data pointed to by its std::string.

Bug: http://b/73257049
Test: manual testing with asan
Change-Id: Ia88199292cc74e10032a9a16226d3afc61c3e0be
2018-02-12 17:31:39 -08:00
Josh Gao 86f39b4078 adbd: receive jdwp pids from art as raw integers.
Don't go through a pointless conversion to hex that reduces our maximum
pid to 64k.

Bug: http://b/17661822
Test: `adb jdwp`
Change-Id: Idd572eac827f3ed3825ac2cf55fc4db109e70854
2018-02-12 15:07:28 -08:00
Josh Gao 8d220bb0cd Merge "adb: switch asocket::enqueue to std::string." am: 9bf624cd3a am: e523a6c94f
am: 16bbf3b4cd

Change-Id: Ie46218fe0fff30999f1ca40c509bb7e27fe2cb42
2018-02-08 05:37:19 +00:00
Josh Gao e75f43461d Merge changes I86bcfaaa,I24d7f5d0 am: f99711fe87 am: 157c2fa504
am: d3f70d4a83

Change-Id: Iafc3ec17d90251d1f120c34f27f5c17041f6f882
2018-02-08 05:10:22 +00:00
Josh Gao 9bf624cd3a Merge "adb: switch asocket::enqueue to std::string." 2018-02-08 01:06:22 +00:00
Josh Gao f99711fe87 Merge changes I86bcfaaa,I24d7f5d0
* changes:
  adb: restore packet data length checks.
  adb: switch asocket's intrusive linked list to vectors.
2018-02-08 00:34:40 +00:00
Josh Gao 465c5849d7 Merge "adb: don't spew to logcat when tracing is enabled." am: 28c44863f6 am: b652ac4bd8
am: b4affd20b7

Change-Id: I9711ce90493b7b311ae04fe5c4b25739cb57dbc2
2018-02-07 08:57:59 +00:00
Josh Gao 95c4497bd4 adb: don't spew to logcat when tracing is enabled.
When persist.adb.trace_mask is used to enable verbose logging, avoid
exponential logging when a user runs `adb logcat`. As a side-effect,
set the minimum logging level to include everything when ADB_TRACE is
used on the client (which is something we want anyway).

Bug: http://b/72971016
Test: `adb shell 'setprop persist.adb.trace_mask; killall adbd'; adb logcat`
Change-Id: Id4bca1f3933a920345499dbeaeb103c8a2e220cd
2018-02-06 15:55:06 -08:00
Josh Gao 27cb7dca77 adb: switch asocket::enqueue to std::string.
Switch asocket over to taking a std::string instead of apacket* for
data. This allows us to remove asocket specific fields from apacket*.

Test: python test_device.py with x86_64 emulator, walleye
Test: adb_test on host
Change-Id: I9d157ff331a75ba49a54fdd4194e3f6cdff722f4
2018-02-06 12:59:06 -08:00
Josh Gao 5caaebdc3d adb: restore packet data length checks.
These checks were moved to after the read of the payload, which is too
late. Add a check before each read to avoid a heap buffer overflow.

Test: python test_device.py with x86_64 emulator, walleye
Change-Id: I86bcfaaa9004951cc52ad89af74680cf748e717d
2018-02-06 12:59:06 -08:00
Josh Gao 5e5076404a adb: switch asocket's intrusive linked list to vectors.
Test: python test_device.py
Change-Id: I24d7f5d0401de77d80c7a2dd5a7dcb551943342d
2018-02-06 12:59:06 -08:00
Josh Gao 2309f0fd40 Merge changes I877b8027,I469bd931 am: 8848052c9f am: 99500f1e3b
am: b685db4bf2

Change-Id: I249ca7c34ac6262140e70244bfec877f6fa6fe9d
2018-01-31 21:52:21 +00:00
Josh Gao b800d88b34 adb: extract atransport's connection interface.
As step one of refactoring atransport to separate out protocol handling
from its underlying connection, extract atransport's existing
hand-rolled connection vtable out to its own abstract interface.

This should not change behavior except in one case: emulators are
now treated as TCP devices for the purposes of `adb disconnect`.

Test: python test_device.py, with walleye over USB + TCP
Test: manually connecting and disconnecting devices/emulators
Change-Id: I877b8027e567cc6a7461749432b49f6cb2c2f0d7
2018-01-30 15:22:41 -08:00
Josh Gao fb413a2304 adb: fix a leak.
Test: none
Change-Id: I469bd93180cd2a8b6408f73e8c8f164f72b3345c
2018-01-30 13:32:38 -08:00
Calin Juravle aa7753871e 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
2018-01-17 19:06:28 -08:00