summaryrefslogtreecommitdiffstats
path: root/adb
Commit message (Collapse)AuthorAgeFilesLines
* Merge "adb: fix double close in jdwp_service." into pi-devJosh Gao2018-05-151-2/+0
|\
| * adb: fix double close in jdwp_service.Josh Gao2018-05-141-2/+0
| | | | | | | | | | | | | | Bug: http://b/78793027 Test: treehugger Change-Id: Ie66d12e70bdaf09148e3d672e3c7c3da9e8ab2fe (cherry picked from commit b7a9956cbc1cd8b1ffff86d13c6bea893a65c74d)
* | Documented adb install --instantFelipe Leme2018-05-091-2/+3
|/ | | | | | | | Test: m -j32 adb && ./out/host/linux-x86/bin/adb help 2>&1 | grep instant Bug: 79422318 Change-Id: I2830a9e3cf81becac1a6334670d8dc487fe72322 (cherry picked from commit 807be77c25276cecd8a939dad2cdb3c7ac1db975)
* adb: don't error in handle_host_request if we can't acquire a transport.Josh Gao2018-04-191-1/+1
| | | | | | | | | | | Host services are attempted after handle_host_request, which means that failing to find a transport to give to handle_forward_request shouldn't send an error over to the other end. Bug: http://b/78294734 Test: `adb track-devices` with multiple devices connected Change-Id: I46c89cc1894b51d48fea7d4e629b1d57f73e3fd6 (cherry picked from commit 78f133d7d46386a2215cd45836354260265ade26)
* adb: fix `adb reverse` when adbd has multiple transports.Josh Gao2018-04-135-23/+17
| | | | | | | | | | | | | Plumb the transport that we received the adb reverse request on through to reverse_service, instead of trying to get a unique transport on devices that have multiple active transports (e.g. a device with USB (even unplugged) connected via TCP). Bug: http://b/37066218 Bug: http://b/71898863 Test: `echo foo | nc -l 12345 & adb reverse tcp:12345 tcp:12345; adb shell nc localhost 12345` on a device connected via TCP Change-Id: Iae199ae787f2e344126bbcacca8544cfc9844a4c (cherry picked from commit 44899eeb53eb6260c20891723709ab38ed246349)
* adbd: increase oom_score_adj for `adb shell`Josh Gao2018-04-131-0/+9
| | | | | | | | | | | | | Previously, processes started via `adb shell` have an oom_score_adj of -1000, making them invisible to the oom killer. This makes running a process that consumes all memory (e.g. by leaking in a loop) lead to the entire rest of the system (including adbd, because of bad heuristics in the kernel) being oom killed before getting to it. Bug: http://b/63143027 Test: `adb shell cat /proc/self/oom_score_adj` with adb root Change-Id: I59111134e36dc271adf4c1dd4bd4400d4fe6aee0 (cherry picked from commit 2de2ade387774effee209a1498f16babab81e4ee)
* adb: properly calculate packet size on Mac.Josh Gao2018-04-112-22/+35
| | | | | | | | | | | | | | | | OS X reports maxPacketSize as wMaxPacketSize * (bMaxBurst + 1) in the deprecated GetPipeProperties function. Use the also-deprecated GetPipePropetiesV2 API to get bMaxBurst and figure out what wMaxPacketSize is. (This file is going to go away eventually, so don't bother with switching to the recommended GetPipePropertiesV3, since it would be a substantially larger charge.) libusb is unaffected. Bug: http://b/77733422 Test: python test_device.py Change-Id: I66517d699a4f39b93ba5eb7882bd8ee6c70f3672 (cherry picked from commit 2ea46521f3c6a275b100737ea071ecd473a38aaa)
* Merge "Support /odm and /product in "adb remount" and "adb sync"." into pi-devElliott Hughes2018-04-093-43/+22
|\
| * Support /odm and /product in "adb remount" and "adb sync".Elliott Hughes2018-04-053-43/+22
| | | | | | | | | | | | | | | | | | Bug: http://b/77587036 Test: `adb remount` and `adb sync` still work on hikey (cherry picked from commit 57e97cb7aac9873745ca14dcb005d61fda6a65d0) Change-Id: Ie49d703dac04e2fb8eda420b9253b8d45b6e1479
* | adb: Correctly drop caps when ambient capabilities are usedLuis Hector Chavez2018-04-061-5/+30
|/ | | | | | | | | | | | | | | | | | This change splits the capability-dropping step of adbd into two. This is more robust when ambient capabilities are being used, since minijail cannot currently handle that case. Bug: 77146512 Test: grep Cap /proc/`pidof adbd`/status CapInh: 0000000000000000 CapPrm: 0000000000000000 CapEff: 0000000000000000 CapBnd: 00000000000000c0 CapAmb: 0000000000000000 Change-Id: I0476a8d80f7a2497600196932542045f3bc87537 Merged-In: I0476a8d80f7a2497600196932542045f3bc87537 (cherry picked from commit daacf4f6f3aba6e0584103820100da7a7ea81123)
* adb: fix windows test build.Josh Gao2018-03-284-19/+16
| | | | | | | | | | | | The switch over to soong unintentionally turned off building the Windows tests (and there's a bug preventing them from being turned on). Preemptively fix the build breakages that'll happen when we turn them back on. Bug: http://b/74616284 Test: mma with Android.bp 's/cc_test_host/cc_binary_host' hacks Change-Id: I6582cfc61b96052537d50d8ba90533dbb66e3e1d (cherry picked from commit 2e1e789e2ac34402810321334537a3dd4992705c)
* adb: bump the local socket backlog to the maximum.Josh Gao2018-03-282-5/+2
| | | | | | | | | | | | The listen backlog seems to be more meaningful on Darwin than on Linux, resulting in connections failing with ECONNRESET. Bump it up to the maximum supported value to make this less likely. 128 pending connections ought to be enough for anybody. Bug: http://b/74616284 Test: python test_device.py Change-Id: I5fe0205924188cf18ca1fc1204f923ab5523eeb2 (cherry picked from commit bf243a61289b7a4aa87962f1b697472bbd4f07fa)
* adb: delete vestigial SHELL_EXIT_NOTIFY_FD.Josh Gao2018-03-285-121/+0
| | | | | | | | | | | | There exists no path through which a value other than -1 can be written to the SHELL_EXIT_NOTIFY_FD. Bug: http://b/74616284 Test: adb_test Test: adbd_test Test: python test_device.py Change-Id: I0630c302ba06bc76917f0445aea75d2dbe1dc865 (cherry picked from commit dcc055af644ce87f1590ab82680f3e0ca4cee54c)
* adb: don't immediately close a socket when write fails.Josh Gao2018-03-282-133/+119
| | | | | | | | | | | When we fail to write to a local socket peer, we might still have data queued up to send to the other side. Defer closing the socket until we've failed to both read and write. Bug: http://b/74616284 Test: python test_device.py Change-Id: Ifc4b8fe95369b4872e475c2ae4ee611dd2d8b9d7 (cherry picked from commit 184f4805476af19c2e58dd96c2ce6aa241efaacf)
* adb: make fdevent_run_on_main_thread's fd nonblocking.Josh Gao2018-03-282-4/+19
| | | | | | | | | | | | | | | | If we get a ton of fdevent_run_on_main_thread calls while running one of the handlers, the socket might become full, which will result in a deadlock in fdevent_run_on_main_thread when a write to the fd blocks with the mutex taken. Resolve this by making the fd nonblocking, which is safe because we always write after appending to the list, and read before emptying the list, which guarantees that if the byte we write is consumed, the std::function we appended will be run. Bug: http://b/74616284 Test: adb_test Test: python test_device.py Change-Id: I29319bda2ad7b5a5cdcd91d1d0ddf39f7ab7d115 (cherry picked from commit 1222abc75b7854979e6a9f982004985179bcbede)
* adb: skip IPv6 test if IPv6 isn't available.Josh Gao2018-03-281-2/+6
| | | | | | | Bug: http://b/69813298 Test: none Change-Id: I0793e793bd52c5f1c639faedf09a513df263db78 (cherry picked from commit 4abb5074bebe7e001ff4a8373718b3ce7fcfdc61)
* adb: add `adb shell exit 42` stress test.Josh Gao2018-03-281-0/+24
| | | | | | | | | Add a test to hammer on `adb shell exit $n` for flakiness. Bug: http://b/74616284 Test: python test_device.py Change-Id: I6a842960f5b55ff739044698f5c9683992fc42f1 (cherry picked from commit c970aefadace2203f23f0b028b6c6be16e55dd04)
* adb: improve socket tests.Josh Gao2018-03-281-17/+14
| | | | | | | | | | Make it so that the socket tests don't leak until your machine blows up by switching an infinite loop into an assertion failure. Bug: http://b/74616284 Test: adb_test Change-Id: If618c26b224b660548454f542cab79bebe46f80e (cherry picked from commit ecb96ac04d7be37eae168658d50003434407b1ac)
* adb: implement std::make_unique, start using it.Josh Gao2018-03-285-6/+44
| | | | | | | | | | Add an implementation of std::make_unique for Windows, where we're currently stuck with C++11, and switch some uses of new over to it. Bug: http://b/74616284 Test: treehugger Change-Id: I99b85f07754adda7c525243480c3e0bce9a25ce7 (cherry picked from commit 31b5be69f4f39365ce0faad85faba604a2509022)
* adb: add test for flushing socket data after a write failure.Josh Gao2018-03-281-0/+40
| | | | | | | | | | Add a currently failing test that's a reduced case of the 'concurrent adb shell' flakiness reported in b/74616284. Bug: http://b/74616284 Test: changed #if 0 to #if 1, test fails Change-Id: Id170a185f7c5d2ff44f772f7849a73227f9df441 (cherry picked from commit df3bae9f0675f6cfbe68e64600166e62a403ce7d)
* adb: Retry io in case of interruptJerry Zhang2018-03-231-14/+20
| | | | | | | | | | | | | | | | | | | | io_submit sleeps waiting for the gadget to be enabled. Currently if that sleep is interrupted it will shut down adb, causing it to have to start back up again. Rather than return EINTR if interrupted, io_submit actually completes and the EINTR is found later when looking through events. Since an io that is interrupted will be small anyway, add a loop to retry small ios. Also upgrade aio logs in accordance with their importance. Fixes: 75981904 Test: adb works, logs show successful interrupt handling Change-Id: I35973fce130ee849ce59fef80d15b65afb816ba4
* adb: checks device state when using adb disable-verity for AVBBowgo Tsai2018-03-161-2/+11
| | | | | | | | | | | | | | | | adb disable-verity will toggle a flag in /vbmeta and introduce AVB verification error on next boot. If the device is LOCKED, it will make the device unbootable because verification error isn't allowed when the device is locked. Also indicating 'adb root' when failed to get verity state. Bug: 70969453 Test: adb disable-verity should pop-up warning if the device is locked. Change-Id: I1ed705e34334ea2231c96b16ddb8d225067af2f0 Merged-In: I1ed705e34334ea2231c96b16ddb8d225067af2f0 (cherry picked from commit 8cc9c3835a7052621b4829324b30f21f0307510e)
* adb: Remove usages of ENDPOINT_ALLOCJerry Zhang2018-03-142-33/+2
| | | | | | | | | | | All devices that previously used ENDPOINT_ALLOC are on the new async io routines. None of the devices using aio_compat have ENDPOINT_ALLOC so remove the code to stop logging failures. Fixes: 74213465 Test: adb works Change-Id: I0c903eb76b006b6bcce48cec24f5353fa47cc128
* Merge "Add a NOLINT for the memory leak we added" am: 10f62351eb am: 4e3ae2cbfaGeorge Burgess IV2018-03-011-0/+1
|\ | | | | | | | | | | am: ad4025b35b Change-Id: I1d4831bc70b8874e66583f4a130b3a711c24b019
| * Add a NOLINT for the memory leak we addedGeorge Burgess IV2018-03-011-0/+1
| | | | | | | | | | | | | | | | Added by I7255d45335fa009dc9e5de99dff67af52bd70e06 Bug: None Test: Ran the analyzer. Complaint is gone. Change-Id: Id9b8debd8b9690210f5a8e19154ee3a5095b8fbd
* | Merge "adb: add a way to make the server intentionally leak." am: 1ac7150590 ↵Josh Gao2018-02-281-0/+10
|\| | | | | | | | | | | | | | | am: 9ba182e3bb am: 399c3591f2 Change-Id: Ifa340ad4f3ce53786391722a7d4f8b97816dfd20
| * adb: add a way to make the server intentionally leak.Josh Gao2018-02-281-0/+10
| | | | | | | | | | | | | | | | 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
* | Merge "Change the remount command to be more container-friendly" am: ↵Luis Hector Chavez2018-02-281-7/+19
|\| | | | | | | | | | | | | | | d24c8484c8 am: 677288c80a am: d12cf88945 Change-Id: Ie9986fe8723ed34ecc787deb72bd75c89f1e8554
| * Merge "Change the remount command to be more container-friendly"Treehugger Robot2018-02-281-7/+19
| |\
| | * Change the remount command to be more container-friendlyLuis Hector Chavez2018-02-271-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge changes I0783be05,Id8178913 am: 09d5e258ef am: 2c1b3e9761Josh Gao2018-02-286-24/+61
|\| | | | | | | | | | | | | | | | | am: d8b711e16b Change-Id: Ifa679ee1857fddf693f9e9b994bb4d9dff3f6c8a
| * | adb: allow reentrant calls to fdevent_run_on_main_thread.Josh Gao2018-02-272-16/+56
| | | | | | | | | | | | | | | | | | | | | | | | Previously, reentrant calls to fdevent_run_on_main_thread would deadlock. Test: adb_test on host Change-Id: I0783be0558dcaf61ddbe76d13ac6917fc2de0be0
| * | adb: stop using quick_exit.Josh Gao2018-02-274-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "adb: switch apacket over to a std::string payload." am: 581a4ceb00 ↵Josh Gao2018-02-248-73/+96
|\| | | | | | | | | | | | | | | | | | | | | | | am: 4d74066425 am: ea9359a957 Change-Id: Ib9b1f7c9c3e59e3cfd3ea492360703d2b7a68119
| * | adb: switch apacket over to a std::string payload.Josh Gao2018-02-218-73/+96
| |/ | | | | | | | | Test: python test_device.py with walleye/x86_64 emulator Change-Id: I0a18941af1cb2279e5019a24ace25741def1202f
* | Merge "bpfmt." am: 0609e8d231 am: b57755c429Elliott Hughes2018-02-201-30/+30
|\| | | | | | | | | | | am: a91867a788 Change-Id: Ieb0985434e2464e47b3adb93fb27fe5042e91657
| * Merge "bpfmt."Treehugger Robot2018-02-201-30/+30
| |\
| | * bpfmt.Elliott Hughes2018-02-161-30/+30
| | | | | | | | | | | | | | | | | | Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
* | | Merge "Fix a memory leak" am: cb1b68f9b3 am: 894337ee0bGeorge Burgess IV2018-02-191-0/+1
|\| | | | | | | | | | | | | | | | | am: 2a7d34014a Change-Id: I2b763775555659f77e969f1d4d5bc73363afc53b
| * | Fix a memory leakGeorge Burgess IV2018-02-191-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "adbd: receive jdwp pids from art as raw integers." am: d31df3a1be am: ↵Josh Gao2018-02-141-15/+4
|\| | | | | | | | | | | | | | | f6a2296aff am: 33bedcde5b Change-Id: I8317d035fe4d65e06bcd849b64654419c051c021
| * Merge "adbd: receive jdwp pids from art as raw integers."Treehugger Robot2018-02-131-15/+4
| |\
| | * adbd: receive jdwp pids from art as raw integers.Josh Gao2018-02-121-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "adb: fix build breakage." am: 14d7cdce51 am: a4c4ef463bJosh Gao2018-02-131-1/+1
|\| | | | | | | | | | | | | | | | | am: 07de47eeb3 Change-Id: I935612655924b3263883e0f4bfdba2bdbd9d5386
| * | adb: fix build breakage.Josh Gao2018-02-121-1/+1
| | | | | | | | | | | | | | | Test: mma Change-Id: Id8e7ffd2212449bbac5b64b50e7b3aef7e97d649
* | | Merge "adb: use delete on objects with destructors." am: e504360f3d am: ↵Josh Gao2018-02-134-34/+26
|\| | | | | | | | | | | | | | | | | | | | | | | 854879ecdc am: 84cd5de121 Change-Id: I33b77e3daef7e7778cce6b05a36b9710f6209af5
| * | adb: use delete on objects with destructors.Josh Gao2018-02-124-34/+26
| |/ | | | | | | | | | | | | | | | | 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
* | Merge "adb: switch asocket::enqueue to std::string." am: 9bf624cd3a am: ↵Josh Gao2018-02-088-126/+166
|\| | | | | | | | | | | | | | | e523a6c94f am: 16bbf3b4cd Change-Id: Ie46218fe0fff30999f1ca40c509bb7e27fe2cb42
| * Merge "adb: switch asocket::enqueue to std::string."Josh Gao2018-02-088-126/+166
| |\
| | * adb: switch asocket::enqueue to std::string.Josh Gao2018-02-068-126/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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