Commit graph

2242 commits

Author SHA1 Message Date
Elliott Hughes
fc485e4488 Merge "Start retiring socket_loopback_client." am: 58f7f61266 am: cd0e8cfd33
am: aa509a3e9d

Change-Id: Iea3a25f193b9249ba93d49514b2a409d693121e1
2016-10-13 15:00:24 +00:00
Elliott Hughes
aa509a3e9d Merge "Start retiring socket_loopback_client." am: 58f7f61266
am: cd0e8cfd33

Change-Id: Ibd76fcb2aa9abb35a11f3b1e3f771a168f6d96de
2016-10-13 14:50:50 +00:00
Elliott Hughes
cd0e8cfd33 Merge "Start retiring socket_loopback_client."
am: 58f7f61266

Change-Id: I2b3d6ae5e90fb99163eb639e185b93cd55ff724a
2016-10-13 14:43:05 +00:00
Elliott Hughes
58f7f61266 Merge "Start retiring socket_loopback_client." 2016-10-13 14:38:48 +00:00
Lingfeng Yang
7bdbbfb0ef Merge "Fix adb flakiness on reboot" am: f7a1c476ff am: d0dead710b
am: e93241e377

Change-Id: Icd024ed6896a1989f67beb512a399cd0979b2cf1
2016-10-12 00:49:27 +00:00
Lingfeng Yang
e93241e377 Merge "Fix adb flakiness on reboot" am: f7a1c476ff
am: d0dead710b

Change-Id: I7b966be541d89b2f13a9c39218627884e001cc21
2016-10-12 00:44:48 +00:00
Lingfeng Yang
d0dead710b Merge "Fix adb flakiness on reboot"
am: f7a1c476ff

Change-Id: If74046384b04c8bae587c3194c85e1a1865e3cbb
2016-10-12 00:36:30 +00:00
Lingfeng Yang
1197952e71 Fix adb flakiness on reboot
bug: 31950237

There are two lists of active ADB transports (devices),
and with the emulator, they can go out of sync.

This CL more conservatively checks if there are no
transports in either list before commiting to
register a new transport for the emulator.

(cherry picked from commit edaedfd5da)

Change-Id: Id1201dc59c70825881dad80925c2e5bcc13dbd5e
2016-10-11 23:19:51 +00:00
Elliott Hughes
139b372fab Start retiring socket_loopback_client.
Bug: http://b/31537253
Test: can still talk to adb
Change-Id: Icfd7f00d35cf963befc139e81904790b4b8b67c0
2016-10-11 13:45:03 -07:00
Josh Gao
f369babcb8 Merge "Remove useless arguments from is_adb_interface." am: bd6c6eb0e4 am: db50d1d6ef
am: 0a629b4bdd

Change-Id: I54e47bf9d8e056255335e809b9733e2597b3e532
2016-10-11 17:51:40 +00:00
Josh Gao
0a629b4bdd Merge "Remove useless arguments from is_adb_interface." am: bd6c6eb0e4
am: db50d1d6ef

Change-Id: I4a21f8296643bbe185ac79df8888eec07c88ca78
2016-10-11 17:42:47 +00:00
Josh Gao
db50d1d6ef Merge "Remove useless arguments from is_adb_interface."
am: bd6c6eb0e4

Change-Id: I1390870da63506df411dbd94f2b19d147d90009c
2016-10-11 17:36:09 +00:00
Mark Salyzyn
144abd8cb2 Merge "liblog: adb: move security interfaces to private" am: 09dac589f1 am: 586c6985cf
am: 4b5456eacc

Change-Id: Id78628d7e7abfa16f1ada16f894f9616a2dc469b
2016-10-10 23:34:54 +00:00
Mark Salyzyn
4b5456eacc Merge "liblog: adb: move security interfaces to private" am: 09dac589f1
am: 586c6985cf

Change-Id: I8c54bdc1a3582be1fc7c4a9be83b555624fcb0a3
2016-10-10 23:29:55 +00:00
Treehugger Robot
bd6c6eb0e4 Merge "Remove useless arguments from is_adb_interface." 2016-10-10 22:50:13 +00:00
Mark Salyzyn
586c6985cf Merge "liblog: adb: move security interfaces to private"
am: 09dac589f1

Change-Id: I05ad9cee5ffe00e842120aa960d6652517b94a16
2016-10-10 22:04:39 +00:00
Elliott Hughes
36e0d390a2 Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I18a1d816d63b64601485045070851f32d44e85eb
2016-10-10 14:31:12 -07:00
Josh Gao
30186df0f0 Remove useless arguments from is_adb_interface.
Test: mma
Change-Id: I8b7b411d7d5ec9d401b61ed8f817b98c61114d4f
2016-10-10 13:44:00 -07:00
Mark Salyzyn
6debf985aa liblog: adb: move security interfaces to private
Test: Compile & adb functioning
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I7ad8963bcca3d8b5c37b547c11d163b652d35556
2016-10-10 15:15:45 +00:00
Josh Gao
f883e2f65c Merge "adb: rationalize types." am: 8caf4e7443 am: e335bea277
am: 010818f313

Change-Id: I1edebee150c7b36cfa3ca58626eaebf5e9ce647f
2016-10-07 20:48:19 +00:00
Josh Gao
010818f313 Merge "adb: rationalize types." am: 8caf4e7443
am: e335bea277

Change-Id: I045ccbebbc1005a501768da3222a211e49821895
2016-10-07 20:44:43 +00:00
Josh Gao
e335bea277 Merge "adb: rationalize types."
am: 8caf4e7443

Change-Id: I2e363c31a22b57964688f170c6f96cd8764959e0
2016-10-07 20:41:16 +00:00
Josh Gao
06d61d4d96 adb: rationalize types.
Use fixed length types for structs going over the wire, constify
arguments where possible, use char* instead of unsigned char* for
apacket data, and assorted other refactoring.

Bug: http://b/29273531
Test: python test_device.py with every combination of old/new adb and adbd
Change-Id: I0b6f818a32be5386985aa4519f542003cf427f9d
2016-10-06 14:50:02 -07:00
Josh Gao
e1afd17d75 Merge "adb: split up adb_auth.cpp." am: 4a8b178c97 am: 4546c8ac3d
am: 58a5e5a50b

Change-Id: Ibb499732491fc584be2b1e61f95bb9375fad16ec
2016-10-06 19:54:06 +00:00
Josh Gao
58a5e5a50b Merge "adb: split up adb_auth.cpp." am: 4a8b178c97
am: 4546c8ac3d

Change-Id: Idb9ed3e21524893943ecd176d9abe6a1e3b5493b
2016-10-06 19:50:37 +00:00
Josh Gao
4546c8ac3d Merge "adb: split up adb_auth.cpp."
am: 4a8b178c97

Change-Id: I846a06ca04aad456c6659dd6db4c8d0666fc6707
2016-10-06 19:47:11 +00:00
Treehugger Robot
4a8b178c97 Merge "adb: split up adb_auth.cpp." 2016-10-06 19:37:31 +00:00
Josh Gao
3bd2879d8e adb: split up adb_auth.cpp.
All of the functions in adb_auth.cpp were used in only one of
adb/adbd. Split up them up into adb_auth_host.cpp and adbd_auth.cpp
respectively.

Bug: http://b/29273531
Test: built and flashed bullhead, adb still works
Change-Id: Ib610c5157522634cc273511175152f1306cc52a7
2016-10-06 12:36:26 -07:00
Tao Bao
4fa6e4855b Merge "adb: Remove the obsolete include path to ext4_utils." am: 9f828a5383 am: a00020317e
am: 9766909149

Change-Id: I1059d176220327d6f1ecb5c56dde2bebf31c371f
2016-10-06 06:29:57 +00:00
Tao Bao
9766909149 Merge "adb: Remove the obsolete include path to ext4_utils." am: 9f828a5383
am: a00020317e

Change-Id: I474494405de42c794af3160898a867e766c558b1
2016-10-06 06:26:25 +00:00
Tao Bao
a00020317e Merge "adb: Remove the obsolete include path to ext4_utils."
am: 9f828a5383

Change-Id: Ia833226376111a0ead4f0c5b5d79768a8b8dbeb2
2016-10-06 06:23:27 +00:00
Tao Bao
fee161d189 adb: Remove the obsolete include path to ext4_utils.
Since commit 8ad80763e4 has removed
'#include "ext4_sb.h"', there's no more reference to ext4_utils headers.

Test: `mmma system/core/adb`

Change-Id: I7ca1a6e91f1e0de84238c2a7facbebe9600a3d87
2016-10-05 18:06:03 -07:00
Mark Salyzyn
9f6b98dec0 system/core Replace log/log.h with android/log.h am: ff2dcd9af9 am: cac331afd9
am: 0308b0eabd

Change-Id: I4d631d53b4fc27e1a02d412bae21fffad6635258
2016-09-30 22:18:18 +00:00
Mark Salyzyn
0308b0eabd system/core Replace log/log.h with android/log.h am: ff2dcd9af9
am: cac331afd9

Change-Id: I95c6a64bc35a041688303fcee4d506865d0a19a4
2016-09-30 22:13:00 +00:00
Mark Salyzyn
cac331afd9 system/core Replace log/log.h with android/log.h
am: ff2dcd9af9

Change-Id: I3c47cb42639d56740ecf7e4fe61ea49982d69fed
2016-09-30 22:09:28 +00:00
Mark Salyzyn
ff2dcd9af9 system/core Replace log/log.h with android/log.h
Should use android/log.h instead of log/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-09-30 12:47:05 -07:00
Elliott Hughes
a6d5587f78 resolve merge conflicts of b40756a to nyc-dev-plus-aosp
am: fe807214ef

Change-Id: Ibcfd7f5c9c67084c754b2b60ff1e9eed976e3249
2016-09-30 17:07:03 +00:00
Elliott Hughes
fe807214ef resolve merge conflicts of b40756a to nyc-dev-plus-aosp
Change-Id: Ic1aa6fd6ab66ca8fb7cf434a3d0679a41288e4a7
2016-09-30 10:00:02 -07:00
Elliott Hughes
b40756ac28 resolve merge conflicts of 50cb973 to stage-aosp-master
Change-Id: Idf0d02687cc47f64acfdd3da623c7a7a62043651
2016-09-30 09:08:23 -07:00
Elliott Hughes
4bf9bc1ac7 Improve "adb help" output.
The specific request was to document $ADB_VENDOR_KEYS, but since I'm here,
let's try to make the help output shorter but more useful...

Bug: http://b/18437888
Test: adb help
Change-Id: I77135d4e666f19524f880228d27d87ba881672b5
2016-09-28 15:29:19 -07:00
David Pursell
5cab7cc637 Merge "adb: fix host-side serial number parsing for IPv6." am: b1c4d90215 am: 94c652ed31
am: dde69001c2

Change-Id: I869720698bb91b0e968c51740b916ab58ea89d5a
2016-09-28 17:46:46 +00:00
David Pursell
dde69001c2 Merge "adb: fix host-side serial number parsing for IPv6." am: b1c4d90215
am: 94c652ed31

Change-Id: I87e3bbc33077830ca95e06807cb9863f42b87bf4
2016-09-28 17:41:16 +00:00
David Pursell
94c652ed31 Merge "adb: fix host-side serial number parsing for IPv6."
am: b1c4d90215

Change-Id: I62454f520192df9b600280b59704e7c0fe55687f
2016-09-28 17:35:47 +00:00
Treehugger Robot
b1c4d90215 Merge "adb: fix host-side serial number parsing for IPv6." 2016-09-28 17:30:29 +00:00
Josh Gao
a539d4c04c Merge "adb: fix IOKit handle leaks on OS X." am: a2aff3f809 am: 279a1ea5b0
am: dbb34a87b4

Change-Id: I18ab725e1895f58519cab7f2bd29065058d70700
2016-09-27 20:52:26 +00:00
Josh Gao
dbb34a87b4 Merge "adb: fix IOKit handle leaks on OS X." am: a2aff3f809
am: 279a1ea5b0

Change-Id: Ia45f5ae1943a0d5292da230e902751e127702be4
2016-09-27 20:45:55 +00:00
Josh Gao
279a1ea5b0 Merge "adb: fix IOKit handle leaks on OS X."
am: a2aff3f809

Change-Id: I24587b122c3d4d57eef137456c3628e4010d7b5c
2016-09-27 20:43:24 +00:00
Josh Gao
a2aff3f809 Merge "adb: fix IOKit handle leaks on OS X." 2016-09-27 20:38:37 +00:00
Josh Gao
b6a2f59515 adb: fix IOKit handle leaks on OS X.
Bug: https://code.google.com/p/android/issues/detail?id=219085
Test: Removed sleep in RunLoopThread, compared before/after this patch
Change-Id: Ia65bbedfb7d47bdb02bdfb69778784e5e855900b
2016-09-27 12:36:58 -07:00
Elliott Hughes
9daaf229d0 Merge "Switch adb to <android-base/properties.h>." am: d9a23b5733 am: 5dc7e6a79a
am: 8b7751d360

Change-Id: Ie02bbd139d522d930649ecb06da3f853d6995034
2016-09-26 22:25:21 +00:00
Elliott Hughes
8b7751d360 Merge "Switch adb to <android-base/properties.h>." am: d9a23b5733
am: 5dc7e6a79a

Change-Id: Ie2718d9f843b11feca003805569bb35acde62463
2016-09-26 22:22:48 +00:00
Elliott Hughes
5dc7e6a79a Merge "Switch adb to <android-base/properties.h>."
am: d9a23b5733

Change-Id: I09a1832143d9f54cd67128602c9e518a1b398b5c
2016-09-26 22:19:04 +00:00
Elliott Hughes
ffdec18017 Switch adb to <android-base/properties.h>.
Bug: http://b/23102347
Test: manual
Change-Id: Iffa66258c01f84f41b9af99ab5e768a0a2669106
2016-09-26 13:14:14 -07:00
Tao Wu
0e0cf74c52 Merge "Ignore setsid error in some cases." am: 3562fd0fa8 am: 324acdce69
am: f7756b89e9

Change-Id: I7bc3c1f46fec39fb8fd2fe597633b067ad0a8bda
2016-09-22 22:53:08 +00:00
Josh Gao
6d317aca93 Merge "adb: kill adb_mutex_t, adb_cond_t." am: 7e4d1db957 am: 72c679d6d0
am: 71970fc473

Change-Id: I77f0221da27abb337ce7d8896cd6ad94c04548cf
2016-09-22 22:52:16 +00:00
Tao Wu
f7756b89e9 Merge "Ignore setsid error in some cases." am: 3562fd0fa8
am: 324acdce69

Change-Id: I330be058b8c0d7b175845b30d59f091432d62f6c
2016-09-22 11:55:23 +00:00
Josh Gao
71970fc473 Merge "adb: kill adb_mutex_t, adb_cond_t." am: 7e4d1db957
am: 72c679d6d0

Change-Id: I3b726d03c8dc299191a68488e28fe83c3bd89a77
2016-09-22 11:54:05 +00:00
Tao Wu
324acdce69 Merge "Ignore setsid error in some cases."
am: 3562fd0fa8

Change-Id: I8ff768ce0e4ddd5e2810e40302bf597e2f39387b
2016-09-22 08:22:14 +00:00
Josh Gao
72c679d6d0 Merge "adb: kill adb_mutex_t, adb_cond_t."
am: 7e4d1db957

Change-Id: I3e10b6e3039e3aeb966f8ca27df69b61fa8aa0cc
2016-09-22 08:21:30 +00:00
Treehugger Robot
3562fd0fa8 Merge "Ignore setsid error in some cases." 2016-09-22 06:28:51 +00:00
Treehugger Robot
7e4d1db957 Merge "adb: kill adb_mutex_t, adb_cond_t." 2016-09-22 02:15:00 +00:00
Josh Gao
0cd3ae1c28 adb: kill adb_mutex_t, adb_cond_t.
Now that we have support for std::mutex and std::condition_variable on
Windows, remove our mutex compatibility layer in favor of the C++ one.

Bug: http://b/31653591
Test: mma && $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test && \
      python test_adb.py && python test_device.py
      (also on Windows)

Change-Id: I5b7ed9c45cc2a32edcf4e77b56dc28e441f15f34
2016-09-21 17:22:22 -07:00
Josh Gao
88e36027ed Merge "adb: parse tcp socket specs with base::ParseNetAddress." am: efee71c2de am: 67ed583564
am: 837f2cef9a

Change-Id: I4d7da8197397c2ab84f46733eeb3cd0eba82a01f
2016-09-21 20:38:59 +00:00
Josh Gao
837f2cef9a Merge "adb: parse tcp socket specs with base::ParseNetAddress." am: efee71c2de
am: 67ed583564

Change-Id: Ia820151b0c5fae600adb204421759b9cc5c92ad7
2016-09-21 20:31:28 +00:00
Josh Gao
67ed583564 Merge "adb: parse tcp socket specs with base::ParseNetAddress."
am: efee71c2de

Change-Id: I911b1bed18e1d1d55c585d78479a85d4d8ba2875
2016-09-21 20:28:57 +00:00
Josh Gao
efee71c2de Merge "adb: parse tcp socket specs with base::ParseNetAddress." 2016-09-21 20:26:36 +00:00
David Pursell
73d55aaab2 adb: fix host-side serial number parsing for IPv6.
When the adb client sends a command to the adb server targeting a
particular device serial, it looks something like this:
  host-serial:<serial>:<command>

But if <serial> happens to be an IPv6 address (e.g. when `adb connect`
targets IPv6), the current parsing code doesn't handle the additional
colons properly. This CL fixes the host-serial parsing to handle this
case.

This only affects commands that explicitly name a device serial, e.g.:
  adb -s <IPv6> shell
  adb -s <IPv6> forward <port> <port>
Implicitly using a single attached device was unaffected by this bug.

Bug: http://b/30891386
Test: `adb -s [fe80::ba27:ebff:feb1:934%eth2]:5555 shell` works now,
      and new unittests pass.
Change-Id: Iffe784e61432ae94eb96ed3c8477900a3e807329
2016-09-21 13:00:32 -07:00
Tao Wu
c8fab89f1b Ignore setsid error in some cases.
If the calling process has already been a leading process of session.
setsid just fail with EPERM, ignore such error.

Test: killall adb;exec 3>f;adb fork-server server --reply-fd 3 & cat f
Change-Id: I1aeac079f29e10aa63ed724b5a43663f25c25ad5
Signed-off-by: Tao Wu <lepton@google.com>
2016-09-20 18:15:22 -07:00
Josh Gao
11a172e5b7 Merge "base: rename unique_fd::clear() to unique_fd::reset()." am: 14d3a1ac9d am: 8c9ecb9c2c
am: bac29cb665

Change-Id: I078430bfdd43d3fa14a220debc7623f4931158e8
2016-09-21 01:12:57 +00:00
Josh Gao
bac29cb665 Merge "base: rename unique_fd::clear() to unique_fd::reset()." am: 14d3a1ac9d
am: 8c9ecb9c2c

Change-Id: I9e4a3f5b303464fe7c3c162446c72157015ffec2
2016-09-21 01:10:23 +00:00
Josh Gao
8c9ecb9c2c Merge "base: rename unique_fd::clear() to unique_fd::reset()."
am: 14d3a1ac9d

Change-Id: Ic00aaca61c8e9eb68c30de00b825fc73d8b3cace
2016-09-21 01:07:18 +00:00
Josh Gao
14d3a1ac9d Merge "base: rename unique_fd::clear() to unique_fd::reset()." 2016-09-21 01:03:06 +00:00
Josh Gao
1099215e30 adb: parse tcp socket specs with base::ParseNetAddress.
libbase already has IPv6-aware address parsing, so use it instead of
adb's handrolled IPv4-only parsing.

Bug: http://b/31537253
Change-Id: I4e9ce56b55d7d02787c0fa67b724490bf49ce479
Test: mma && adb start-server && \
      adb -L 'tcp:[::ffff:127.0.0.1]:5037' devices && \
      adb -L 'tcp:localhost:5037' devices && \
      adb -L 'tcp:127.0.0.1:5037' devices && \
      adb -L 'tcp:5037' devices && \
      $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
2016-09-20 13:55:43 -07:00
Tao Wu
502231b6be Merge "Fix bug: Doesn't respect ANDROID_ADB_SERVER_PORT" am: 4159568548 am: bcc419edad
am: 18b1a9901e

Change-Id: If85d3cf002bde9ee29b9aa4062e360646a1ebff0
2016-09-20 00:56:43 +00:00
Tao Wu
18b1a9901e Merge "Fix bug: Doesn't respect ANDROID_ADB_SERVER_PORT" am: 4159568548
am: bcc419edad

Change-Id: Ib9ea8fb0b2a571417a1bfd0c1e5a6fd75eb08ef4
2016-09-19 21:02:24 +00:00
Tao Wu
bcc419edad Merge "Fix bug: Doesn't respect ANDROID_ADB_SERVER_PORT"
am: 4159568548

Change-Id: I8f2b4b1a5914642790e18e58d376ffcd37311d1f
2016-09-19 20:53:48 +00:00
Treehugger Robot
4159568548 Merge "Fix bug: Doesn't respect ANDROID_ADB_SERVER_PORT" 2016-09-19 20:35:11 +00:00
Josh Gao
5d1b1a8b91 base: rename unique_fd::clear() to unique_fd::reset().
unique_fd is modeled on unique_ptr, so make this consistent.

Test: m checkbuild
Change-Id: Ia6a77095dc18746fbb432e96bb8dccfc049c57f6
2016-09-19 11:24:58 -07:00
Tao Wu
135f4ab3dd Fix bug: Doesn't respect ANDROID_ADB_SERVER_PORT
BUG: 31549442
Test: export ANDROID_ADB_SERVER_PORT=12345;killall adb;adb devices

Change-Id: If2bfaf44c6567af16cae0d4def2f11be39c2d437
Signed-off-by: Tao Wu <lepton@google.com>
2016-09-16 17:13:48 -07:00
Pirama Arumuga Nainar
48b0a6b471 Merge "Use <condition_variable> and <mutex.h> from MinGW" am: a3d7b240f1 am: 331ec060ca
am: 11836956bc

Change-Id: I9317665b9cf3f415b3c3e64e95a5ee4f2e3c2798
2016-09-16 22:24:27 +00:00
Pirama Arumuga Nainar
11836956bc Merge "Use <condition_variable> and <mutex.h> from MinGW" am: a3d7b240f1
am: 331ec060ca

Change-Id: I8205259a82445aa6ff50509c58c58bb1429f3c49
2016-09-16 22:21:24 +00:00
Pirama Arumuga Nainar
331ec060ca Merge "Use <condition_variable> and <mutex.h> from MinGW"
am: a3d7b240f1

Change-Id: I319a164694fe67a008915249811dc39567184d08
2016-09-16 22:15:21 +00:00
Pirama Arumuga Nainar
a3d7b240f1 Merge "Use <condition_variable> and <mutex.h> from MinGW" 2016-09-16 21:59:35 +00:00
Josh Gao
264b3465dd adb: let adb push follow symlinks. am: 94dc19ff57 am: 30ecda227c
am: 3e64efbced

Change-Id: Ifbedcf881b2724f6203059037b37032b7a2d3ddd
2016-09-15 02:32:35 +00:00
Josh Gao
3e64efbced adb: let adb push follow symlinks. am: 94dc19ff57
am: 30ecda227c

Change-Id: I10dfdd0265403628c2ef163771cdb576c90419c6
2016-09-15 02:29:35 +00:00
Josh Gao
30ecda227c adb: let adb push follow symlinks.
am: 94dc19ff57

Change-Id: I408ebb7b3091e67bd7025b3a6404f57c7f3af377
2016-09-15 02:27:33 +00:00
Josh Gao
94dc19ff57 adb: let adb push follow symlinks.
Bug: http://b/31491920
Test: touch foo; ln -s foo bar; adb push bar /data/local/tmp
Test: python test_device.py
Change-Id: I0a00b3d49fdf7206e27d66ac110b56e22449a1ad
2016-09-14 17:08:22 -07:00
Pirama Arumuga Nainar
7eaef8a494 Use <condition_variable> and <mutex.h> from MinGW
New MinGW prebuilts update includes pthreads and C++11 threads support.
Use mutex.h and condition_variable provided by MinGW.

Test: Build AOSP with new MinGW prebuilts
Change-Id: Ia8f890f86652612df3fc2618c2bfbb450a5a2f52
2016-09-06 13:49:07 -07:00
Eyal Lezmy
cdf8fba6a1 Merge "Precise command constants on adb/protoxol.txt" am: 85a78f19b1 am: f8188895a1
am: 7bcc5bd0d0

Change-Id: Ic9d0fd2fc6336ac0c2883e32983c855e10dc4a95
2016-09-06 05:19:15 +00:00
Eyal Lezmy
7bcc5bd0d0 Merge "Precise command constants on adb/protoxol.txt" am: 85a78f19b1
am: f8188895a1

Change-Id: Iaf6f8f2b7a13f733d8a9612ada75876031938a9d
2016-09-06 05:15:45 +00:00
Eyal Lezmy
f8188895a1 Merge "Precise command constants on adb/protoxol.txt"
am: 85a78f19b1

Change-Id: Ied63c7e5fe798a646d5428aba4fdfa94cf1c53f1
2016-09-06 05:12:47 +00:00
Treehugger Robot
85a78f19b1 Merge "Precise command constants on adb/protoxol.txt" 2016-09-06 05:04:13 +00:00
Josh Gao
5195499e97 Merge "Fix adb." am: 50d606528d am: ff6d1a9656
am: e95214c467

Change-Id: Ibd72432b3572eab1559faed63ab60f69c22fbea4
2016-09-02 08:52:05 +00:00
Josh Gao
e95214c467 Merge "Fix adb." am: 50d606528d
am: ff6d1a9656

Change-Id: I270efbd5555b7ef8088225f5ea8cdc6ea0cd343d
2016-09-02 08:49:04 +00:00
Josh Gao
ff6d1a9656 Merge "Fix adb."
am: 50d606528d

Change-Id: I55b6c174b4e57086b370e44ff7c0de053f2b4ad6
2016-09-02 08:46:07 +00:00
Elliott Hughes
7f4ab76240 Fix adb.
9460de1ce80a41cd6171a7e03d9fa7aef2db9dce had a backwards test that means
all adb commands abort. Fix the sense of the test.

Bug: http://b/30445394
Change-Id: I4b8ee697f7d305b57f9cd1a70ae919869dee994d
2016-09-01 20:48:45 -07:00
Josh Gao
b6e4f08cb7 adb: allow use of arbitrary socket specs for command socket. am: 9c869b58a8 am: 15f75ef520
am: df3b28c002

Change-Id: Id4e66150fa1591edfcd51ebed86ce30d66b7fb6e
2016-09-02 01:15:15 +00:00
Josh Gao
8e6cbca28d adb: extract the adb-specific unique_fd out into its own header. am: 924d35a8d5 am: 2c6ff3d2b5
am: d70699ef75

Change-Id: I68baa3ce5c91882fe5edc43a4fc2ff287e334af7
2016-09-02 01:15:12 +00:00
Josh Gao
0c17ae6217 adb: add helper to get the ~/.android directory. am: e0b7502c7f am: 36796df275
am: 74693b9ea6

Change-Id: Ie69aae9d28fadab70753c26418bd9753f71a0a8a
2016-09-02 01:15:08 +00:00
Josh Gao
df3b28c002 adb: allow use of arbitrary socket specs for command socket. am: 9c869b58a8
am: 15f75ef520

Change-Id: Iab390aeb784541535da85cc8d6f734339f0c1ed7
2016-09-02 01:11:44 +00:00
Josh Gao
d70699ef75 adb: extract the adb-specific unique_fd out into its own header. am: 924d35a8d5
am: 2c6ff3d2b5

Change-Id: I921ef808d09872901454a6ed92e2c164df435c0c
2016-09-02 01:11:41 +00:00
Josh Gao
74693b9ea6 adb: add helper to get the ~/.android directory. am: e0b7502c7f
am: 36796df275

Change-Id: I1a070b831ec9e749d5a8dd4f7481f13068b20685
2016-09-02 01:11:37 +00:00
Josh Gao
15f75ef520 adb: allow use of arbitrary socket specs for command socket.
am: 9c869b58a8

Change-Id: Ide2b50bf204657de7d93908970c4e7ab85f7eed5
2016-09-02 01:08:45 +00:00
Josh Gao
2c6ff3d2b5 adb: extract the adb-specific unique_fd out into its own header.
am: 924d35a8d5

Change-Id: Ib557fbafefe6c281230fdeaaea4db03f6cbd7df0
2016-09-02 01:08:41 +00:00
Josh Gao
36796df275 adb: add helper to get the ~/.android directory.
am: e0b7502c7f

Change-Id: I2859a6b3022a97d2b01d6850bcefe77307726904
2016-09-02 01:08:38 +00:00
Treehugger Robot
1f5a49f77a Merge changes from topic 'adb_cmd_socket'
* changes:
  adb: allow use of arbitrary socket specs for command socket.
  adb: extract the adb-specific unique_fd out into its own header.
  adb: add helper to get the ~/.android directory.
2016-09-02 01:03:12 +00:00
Josh Gao
ccccbeca43 Merge "libcutils: try all addresses in socket_network_client_timeout." am: f3d43032d2 am: b7011e0410
am: 03da262702

Change-Id: I59153454f926ce0bcb68b2c5774f275cbc7db3bd
2016-09-02 00:59:06 +00:00
Josh Gao
03da262702 Merge "libcutils: try all addresses in socket_network_client_timeout." am: f3d43032d2
am: b7011e0410

Change-Id: Iabdfba4a3546e7a6f335d3d8b7ad2bb75f47d972
2016-09-02 00:56:06 +00:00
Josh Gao
b7011e0410 Merge "libcutils: try all addresses in socket_network_client_timeout."
am: f3d43032d2

Change-Id: I373ce6f43a7164754930c62c7fe249ed6530cfd0
2016-09-02 00:52:38 +00:00
Josh Gao
78cc20f007 libcutils: try all addresses in socket_network_client_timeout.
If a connection fails to an address that resolves to multiple
sockaddrs, attempt connecting to subsequent addresses if the initial
connection fails to a reason other than timeout. This is primarily
useful for localhost, which can resolve to both an IPv4 and and IPv6
address.

Also, add an adb test to verify that this behavior.

Bug: http://b/30313466
Change-Id: Ib2df706a66cf6ef8c1097fdfd7aedb69b8df2d6e
Test: python test_adb.py (+ the test fails before this patch)
2016-09-01 15:56:58 -07:00
Josh Gao
9c869b58a8 adb: allow use of arbitrary socket specs for command socket.
Bug: http://b/30445394
Change-Id: I474ede35ec3c56ad86da503c9703f83ef5e80862
2016-09-01 15:49:06 -07:00
Josh Gao
924d35a8d5 adb: extract the adb-specific unique_fd out into its own header.
Some POSIX-only files would like to use functions declared in
adb_utils.h without being forced to use the sysdeps stuff for open,
close, etc. Extract the adb-specific unique_fd into its own header so
those files can use adb_utils.h alongside the real unique_fd.

Change-Id: I10344ef26b7e72fce46bf7e3033f89aa54bd6118
Test: mm
2016-09-01 15:49:06 -07:00
Josh Gao
e0b7502c7f adb: add helper to get the ~/.android directory.
Extract the logic for creating ~/.android out of get_user_key_path into
its own function. Also, fall back to getpwuid_r when $HOME isn't
defined.

Change-Id: I676a7c750cb364f89b544818ffda07903d14fb97
Test: ran adb with ~/.android missing
2016-09-01 15:43:22 -07:00
Josh Gao
c5adf7774b Merge "Add android::base::GetExecutablePath, switch adb and fastboot over." am: 945d1aaa32 am: 289240f0bf
am: feb044f575

Change-Id: Id634d43107687664bb8afbc51190d35c51d0cb7b
2016-09-01 18:55:54 +00:00
Josh Gao
feb044f575 Merge "Add android::base::GetExecutablePath, switch adb and fastboot over." am: 945d1aaa32
am: 289240f0bf

Change-Id: I5a8ccc66a82b75db495c8461550339c2ec7e639e
2016-09-01 18:52:55 +00:00
Josh Gao
289240f0bf Merge "Add android::base::GetExecutablePath, switch adb and fastboot over."
am: 945d1aaa32

Change-Id: I978edcc27401c174a771ab22be1a8b9abcb55d5f
2016-09-01 18:50:01 +00:00
Elliott Hughes
82ff315bb0 Add android::base::GetExecutablePath, switch adb and fastboot over.
We'd long had two copies of this stuff, so rather than rewrite both
Linux versions to use android::base::Readlink, let's kill the duplication
too...

Bug: http://b/30988271
Change-Id: I4de58a94a22a4b1faf969a6fc70ca1560a4d5121
2016-09-01 09:24:24 -07:00
Felipe Leme
680f4a4888 DO NOT MERGE: Split 'generating' and 'pulling' in 2 messages.
BUG: 30799929
Change-Id: I0af0ad2478c57ffc5b2c953118e01677f788d14a
(cherry picked from commit 9c0be90528)
(cherry picked from commit 321c21e2df)
2016-08-30 13:06:37 -07:00
Felipe Leme
f33fcb6418 DO NOT MERGE: Ignore bugreportz output when it's not supported.
On devices running M or below, calling 'bugreportz -v' writes
'/system/bin/sh: bugreportz: not found' in the stdout output, which must
be redirected to stderr so it's not shown in the flat-file bugreport,
above the bugreport header.

BUG: 30451114

Change-Id: I942c92fdf6ae85e0cde7b9f94b9eb0b1fecad77a
(cherry picked from commit 9a882a3ef3)
(cherry picked from commit b0022b036e)
2016-08-30 13:06:35 -07:00
Felipe Leme
b3239728bb DO NOT MERGE: Deprecated 'adb bugreport' with flat files.
Starting on Android N, zipped bugreports contain more information than
flat-file, text bugreports. On N, calls to 'adb bugreport' would still
generate a flat-file bugreport, but with a warning.

With this change, 'adb bugreport' will generate a zipped bugreport in
the current directory, using the bugreport name provided by the
device. Similarly, calling 'adb bugreport dir' will generate a bugreport
with a device-provided name, but in such directory.

BUG: 30451114
BUG: 29448020

Change-Id: Ibc8920dd44a5f62feb15bf3fefdcb0bdbf389a90
(cherry picked from commit 307951e124)
(cherry picked from commit f8d9e4eb00)
2016-08-30 13:06:33 -07:00
Felipe Leme
6e2869680c DO NOT MERGE: Minor improvements on bugreport generation.
- Skipped artificial 100/100 message, since pulling will take care of
  the final 100% progress.
- Consolidated unsupported lines in just one message.
- Let user know the bugreport can still be recovered when it could not
  be copied to the destination directory.

BUG: 30451114

Change-Id: Icfce9c1e8e7ed407719728b9874679ac40b21eab
(cherry picked from commit 80a65d03c9)
(cherry picked from commit 5f6eacaeda)
2016-08-30 13:06:32 -07:00
Felipe Leme
daf4628f36 DO NOT MERGE: Removed extra 'pulling file' message.
Taking a zip bugreport has 2 phases: generating the bugreport and
pulling the file.

Initially adb was printing 2 messages, but since the latter is almost
instantaneously, it could be confusing to have 2 lines...

Fixes: 30451250
Change-Id: I1c6cc6163492c1fb6064667dfdb7aaf6ed4c4c6f
(cherry picked from commit f7c38b4c03)
(cherry picked from commit 33ae849fef)
2016-08-30 13:06:30 -07:00
Felipe Leme
6f5080faa5 DO NOT MERGE: Show bugreport progress.
adb calls bugreportz to generate a bugreport; initially, bugreportz
would only report the final status of the operation (OK or FAIL), but
now it sends intermediate PROGRESS lines reporting its progress (in the
form of current/max).

Similarly, the initial implementation of 'adb bugreport <zip_file>'
would print an initial 'please wait' message and wait for the full
stdout before parsing the result, but now it uses a new callback class
to handle the stdout as it is generated by bugreportz.

BUG: 28609499

Change-Id: I6644fc39a686279e1635f946a47f3847b547d1c1
(cherry picked from commit cd42d658b2)
(cherry picked from commit 97b73a0daf)
2016-08-30 13:06:28 -07:00
Felipe Leme
0d4f0508c0 DO NOT MERGE: Refactored functions that copy sdout and stderr to strings to use a callback.
BUG: 28609499

Change-Id: I04aea346e18678ea00797f7f659480edba4436c2
(cherry picked from commit 07ac8554b4)
(cherry picked from commit d18854218e)
2016-08-30 13:06:26 -07:00
Felipe Leme
698e065e14 DO NOT MERGE: Split bugreport() into its own file and added unit tests.
bugreport() will be soon refactored to track progress, which will
require more comprehensive unit tests.

As such, it's better to move it to its own files, which in turn also
requires moving send_shell_command() and usage() to commandline.h.

Fixes: 30100363
Bug: 30268737

Change-Id: I3cdf114a0b5547293320042ff0749a60886440b0
(cherry picked from commit 78e0963e4b)
(cherry picked from commit 218e1ff759)
2016-08-30 13:06:23 -07:00
Todd Kennedy
248722e7eb DO NOT MERGE: use 'cmd' command for install-multiple
adb install-multiple makes a minimum of 3 calls to the 'pm' command. This
causes at least 3 separate "pm" processes to be spun up. Instead, use the
'cmd' command which runs in the existing system_server process.

Bug: 27483932
Change-Id: Ia1bed405c3d7e675a1a56ff82c692aaa94388a5c
(cherry picked from commit 4838ae1ab5)
2016-08-30 13:06:12 -07:00
Christopher Tate
c42f1bb3e9 DO NOT MERGE: Ensure the target sees a proper EOD marker during restore
Malformed or corrupt archives may be missing their in-band EOD
content, so make sure that the target sees one regardless rather
than continuing to block on read, expecting in-band signaling.

Bug 28056941

Change-Id: Ic39966d3448787a8c511783d39172032ed9589c3
(cherry picked from commit 2bcdda8e5d)
2016-08-30 13:06:05 -07:00
Eyal Lezmy
39e999e991 Precise command constants on adb/protoxol.txt
Try to improve the documentation by adding, for each commands explained
on the adb/protocol.txt file (CONNECT, WRITE, AUTH, ...), the
corresponding constant used by the protocol (A_CNXN, A_WRTE,
A_AUTH, ...).

I've seen a few engineers having problems matching these both
information by simply reading the doc and they loose time before
getting it. Most of the time they understand it by finally reading the
source code.

By adding this simple information at the end of each command
description I'm sure it will help onboarding developers to
understand more quickly the way the ADB protocol works.

Change-Id: Ibb949fd6a6d34a2bc7f47f0e7af2f57138c9a369
Signed-off-by: Eyal Lezmy <eyal.lezmy@gmail.com>
2016-08-30 01:30:12 +02:00
Josh Gao
b1cadcfc5b Merge "adb: factor out socket specification." am: bd7d2e2ec0 am: f95e728431
am: 4c58c8a892

Change-Id: Idcb03acf63ba3e64f81f55c6b7708eb2cf945d8d
2016-08-27 03:05:48 +00:00
Josh Gao
4c58c8a892 Merge "adb: factor out socket specification." am: bd7d2e2ec0
am: f95e728431

Change-Id: Ibbed2dea019538491650eab41bd75e4f7546a909
2016-08-27 03:02:17 +00:00
Josh Gao
cfb21412e5 adb: factor out socket specification.
Move the logic for string socket specification out to separate
functions to facilitate using arbitrary sockets for the adb command
socket.

Bug: http://b/30445394
Change-Id: Icd8fdb853272edc029fb3a0f5b18e941dc8ef52c
Test: adb_test, adbd_test, test_device.py
2016-08-25 17:12:26 -07:00
Josh Gao
7424dfa361 Merge changes I0ee130db,I33d356fd am: e461b37965 am: 59561a64b7
am: 87ff463d6e

Change-Id: I72ac706e6866b6f391cc950a677a598df79fa9a0
2016-08-25 02:09:55 +00:00
Josh Gao
87ff463d6e Merge changes I0ee130db,I33d356fd am: e461b37965
am: 59561a64b7

Change-Id: If05615e9e5e69bb496fa9eb3c49ba7f9f5a41c45
2016-08-25 02:06:55 +00:00
Josh Gao
e461b37965 Merge changes I0ee130db,I33d356fd
* changes:
  adb: remove unnecessary addr arguments to accept.
  adb: check our socketpair ends in our win32 emulation.
2016-08-25 01:59:23 +00:00
Josh Gao
78e1eb1949 adb: remove unnecessary addr arguments to accept.
Follow up to https://android-review.googlesource.com/#/c/261412/

Change-Id: I0ee130db302940f3224cc823a26b02fc45da0fca
Test: mma
2016-08-24 13:06:06 -07:00
Josh Gao
5990191c4e adb: check our socketpair ends in our win32 emulation.
In our Win32 socketpair emulation, check that the ends are properly
connected before returning.

Change-Id: I33d356fd9ebcac89fc6a89a5200e926032220383
Test: no additional failing tests in adb_test.exe
2016-08-24 13:06:06 -07:00
Elliott Hughes
0426ecaf82 Merge "Most accept/accept4 calls in system/core don't actually want the remote address." am: 299d64144b am: 8615d79d85
am: 66e5e2432a

Change-Id: I5d7b98fa3e9c2d8c16a1aa73e3d5a197dc150c2b
2016-08-23 23:14:44 +00:00
Elliott Hughes
66e5e2432a Merge "Most accept/accept4 calls in system/core don't actually want the remote address." am: 299d64144b
am: 8615d79d85

Change-Id: I89aeabf6efa8217c9acd3f8a766bbd18f7e994fa
2016-08-23 23:05:59 +00:00
Elliott Hughes
8615d79d85 Merge "Most accept/accept4 calls in system/core don't actually want the remote address."
am: 299d64144b

Change-Id: I3fb9678dfed08f0b1d6e90e547ecae6cdcabc9a1
2016-08-23 23:03:20 +00:00
Elliott Hughes
3dcfa3fb1c Most accept/accept4 calls in system/core don't actually want the remote address.
So don't write the extra code for it or waste the kernel's time
copying it around.

Change-Id: I93de64064c2d4fe58ba5b5322cfa69bf31a76dad
2016-08-23 12:50:00 -07:00
Josh Gao
5bb5dd0eb6 Merge "adb: increase the authentication throttling limit." am: 393e5258f6 am: e4d79532de
am: a2408aaf2f

Change-Id: Ibc53b45c09cc4462175d52daa532ff305ce19145
2016-08-23 01:24:23 +00:00
Josh Gao
a2408aaf2f Merge "adb: increase the authentication throttling limit." am: 393e5258f6
am: e4d79532de

Change-Id: I4a0b0700cdee5f3b0e1577132080860402318851
2016-08-23 01:18:03 +00:00
Josh Gao
e4d79532de Merge "adb: increase the authentication throttling limit."
am: 393e5258f6

Change-Id: I483cf75ced8d9fb896c2f5e417d258970d7cabb1
2016-08-23 01:11:28 +00:00
Josh Gao
536c5ad0f3 Merge changes I9761298a,I8d3312b2 am: 0b4fcb75d4 am: 8270912ed0
am: 7f3a776ac4

Change-Id: Ia348ecf331e2e10365a5b23e257888f4794a06ea
2016-08-22 21:46:41 +00:00
Josh Gao
7f3a776ac4 Merge changes I9761298a,I8d3312b2 am: 0b4fcb75d4
am: 8270912ed0

Change-Id: I4eafebc37f15f817ac2fa035a03e0aae90aa6fb0
2016-08-22 21:42:33 +00:00
Josh Gao
8270912ed0 Merge changes I9761298a,I8d3312b2
am: 0b4fcb75d4

Change-Id: I330c467e408bc10ebdab0f5708d24d2297cf39a2
2016-08-22 21:38:53 +00:00
Josh Gao
c8cb38803a adb: increase the authentication throttling limit.
Previously, after 10 failed authentications, we'd sleep for a second,
and we're up to 11 vendor keys in internal now...

Bug: http://b/30927527
Change-Id: I094e830521f6a2768a880c6684f32ff1ce2a3c2e
2016-08-22 13:12:32 -07:00
Josh Gao
8a0d0773bd adb: fix public key authorization.
This was broken by commit e8b663fe, which removed the null-terminator
from the message sent. For some reason, adbd requires the key to be
null terminated, despite an explicit length being part of the message.

Bug: http://b/30971808
Change-Id: I9761298a57ed76ca2bc02b05490f98cdffbaa0c3
Test: manually tested, adb authorization dialog box shows up
2016-08-22 12:58:38 -07:00
Josh Gao
2e671202c3 adb: add support for vendor key directories.
Allow directories to be specified in ADB_VENDOR_KEYS. On Linux, monitor
this directory for new keys to be added.

Additionally, deduplicate keys by hashing their public key.

Bug: http://b/29273531
Bug: http://b/30927527
Change-Id: I8d3312b216b7f2c11900f2235f1f1b1d1c7aa767
Test: manually tested by adding a key to a directory, and verifying
      that devices became authorized after replugging.
2016-08-19 17:32:50 -07:00
Felipe Leme
e965ddd835 Split 'generating' and 'pulling' in 2 messages.
am: 321c21e2df

Change-Id: I0099c4da6f88a9b6804365c81cd28b6b5a9bbdcc
2016-08-17 21:44:01 +00:00