Commit graph

2012 commits

Author SHA1 Message Date
Josh Gao
470622f064 adb: fix test_sighup.
Bug: http://b/32336914
Test: python test_device.py
Change-Id: I34ba5757b5e650d79327dc6779064acd850ce28e
2016-10-24 13:34:20 -07:00
Josh Gao
e76b9f3dde adb: fix race condition in test_non_interactive_sigint.
Fix race condition in the test_non_interactive_sigint test by
looping for a while.

Bug: http://b/32336914
Test: python test_device.py
Change-Id: Ie65a762ad6f04815231add5444762c4c0ffd31cb
2016-10-24 13:34:17 -07:00
Mark Salyzyn
97787a00e6 adb: use __android_log_is_debuggable()
Test: compile and months of adb functionality use
Bug: 27566046
Bug: 31456426
Change-Id: I6568eea0eda8dc67dec2ba34cd4c3f56fb0ff0e9
2016-10-14 11:12:24 -07:00
Treehugger Robot
955648a915 Merge "Rely on the platform -std default." 2016-10-14 02:28:38 +00:00
Elliott Hughes
a4398c1abe Merge "Move off std::sto* function which abort on failure." 2016-10-14 01:51:10 +00:00
Elliott Hughes
da46b392f1 Move off std::sto* function which abort on failure.
Bug: http://b/31403370
Test: builds, boots, libbase tests pass
Change-Id: I89cd7ca3d8f1c8a1bad0ddf3043439449d19a293
2016-10-13 15:34:05 -07:00
Tao Wu
7b700763f5 Fallback to IPv6 when IPv4 is not available in adb
Test: manual - make sure it works in both IPv4/IPv6 env.
BUG: 31537253
Change-Id: Ica492bff34a8c0441516a213d0e8b78fcdfd3282
Signed-off-by: Tao Wu <lepton@google.com>
2016-10-13 08:54:43 -07:00
Elliott Hughes
58f7f61266 Merge "Start retiring socket_loopback_client." 2016-10-13 14:38:48 +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
Treehugger Robot
bd6c6eb0e4 Merge "Remove useless arguments from is_adb_interface." 2016-10-10 22:50:13 +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
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
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
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
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
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
Treehugger Robot
b1c4d90215 Merge "adb: fix host-side serial number parsing for IPv6." 2016-09-28 17:30:29 +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
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
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
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
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
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
a3d7b240f1 Merge "Use <condition_variable> and <mutex.h> from MinGW" 2016-09-16 21:59:35 +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
Treehugger Robot
85a78f19b1 Merge "Precise command constants on adb/protoxol.txt" 2016-09-06 05:04:13 +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
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
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
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