Commit graph

14020 commits

Author SHA1 Message Date
Elliott Hughes
15c6de7530 Merge "Start iterating USB pipe endpoints from 1." 2015-08-14 03:10:56 +00:00
Elliott Hughes
782daf892d Merge "Fix the Mac libbase build." 2015-08-14 03:10:34 +00:00
Elliott Hughes
2e5ae0044a Fix the Mac libbase build.
Change-Id: I34224fa66850915ef47c88ef4c79efbc53f3f38e
2015-08-13 20:09:29 -07:00
Elliott Hughes
2d4f852da4 Start iterating USB pipe endpoints from 1.
Bug: http://b/22829602
Change-Id: I5051880730ba8fadae5d78f1d19b5d527610d4a5
2015-08-13 16:00:12 -07:00
Siva Velusamy
4d40c03b0b Merge "adb: On Mac, clear both host and device endpoints at startup" 2015-08-13 21:51:34 +00:00
Siva Velusamy
d8b48a6281 adb: On Mac, clear both host and device endpoints at startup
This CL clears both the host and device endpoints right at the
beginning when the bulk endpoints are identified. This is in general
a "good idea", but more specifically for us, it fixes the issue
that sometimes when adb quits, it clears the endpoint on the host,
but not on the device which resulted in a subsequent invocation of
adb was seeing a stall.

Bug: https://code.google.com/p/android/issues/detail?id=182151

Change-Id: I331fa6805c40d1f50c153c010ceecd2f6a4045eb
2015-08-13 14:32:50 -07:00
Elliott Hughes
45288223d0 Merge "libbase: logging fixes" 2015-08-13 21:10:37 +00:00
Spencer Low
bdab59a861 libbase: logging fixes
Win32:

- getprogname(): call basename() which is available in mingw's crt.
  Don't potentially go recursive with DCHECK_GT().

- Use Win32 critical section instead of mutex.

Other:

- Change log_characters check to compile-time.

- Fix code that gets the basename of __FILE__. The previous code was not
  setting _file, so it didn't work.

- Save and restore errno for LOG calls. Inspired by similar Chromium code.

Change-Id: Ie7bb700918be726fa81d60177d1894d2daeff296
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-13 14:08:31 -07:00
Nick Kralevich
1efef4c49d Merge "Revert "init: add LOCAL_SANITIZE := integer"" 2015-08-13 18:15:11 +00:00
Nick Kralevich
c307b5b7f8 Revert "init: add LOCAL_SANITIZE := integer"
flounder isn't booting

This reverts commit aea73db1e3.

Bug: 23166814
Change-Id: I36c811d1ca30e2366066142d9282bb713dae315f
2015-08-13 18:10:50 +00:00
Elliott Hughes
57532b2a06 Merge "adb: improve network error info" 2015-08-13 17:49:21 +00:00
Elliott Hughes
8836031b27 Merge "adb: win32: fix shutdown deadlock" 2015-08-13 17:02:16 +00:00
Elliott Hughes
9537ca803f Merge "adb: start-server and kill-server error output" 2015-08-13 16:35:36 +00:00
Spencer Low
f18fc0879b adb: start-server and kill-server error output
- handle_host_request
  - When the host:kill command comes in, shutdown the socket before
    calling exit(). If we don't do this, the client will output error info
    even though everything is working ok.

- adb_connect()
  - If we can't parse the version string, explain this in error output
    and don't goto error which would try to close an fd we already closed.
  - If host:kill doesn't work, output error info. Don't try to close
    already closed fd.

- adb_main()
  - If writing the ACK somehow has an error, output error info (I doubt
    this will ever get hit).

- adb_commandline()
  - Fix typo about max port number.
  - Make 'adb kill-server' and 'adb start-server' output any detailed
    error info.

Change-Id: Id1a309cc1bf516f7f49bd332b34d30f148b406da
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-12 20:14:55 -07:00
Spencer Low
87e97ee305 adb: win32: fix shutdown deadlock
adb can hang at shutdown due to a deadlock relating to WSACleanup().
This works around the issue by not calling WSACleanup() which shouldn't
be done anyway since threads aren't done using Winsock at shutdown.

A quick way to reproduce the original problem is to run many instances
of adb, many of which will call exit() soon:

  for /l %i in (1,1,20) do @start adb nodaemon server

You may have to boost the 20 to 200, or set ADB_TRACE=1 or use Windows
10 instead of Windows 7, to affect the timing, but eventually there
should be hung adb processes with that repro.

A more complete fix to prevent problems like this from occuring in the
future, would be to additionally do the following:

- Investigate all static destructors that are called when exit() is
  called.

- If they don't do anything important, switch all calls to exit() to
  instead call _exit() and then ban exit() from being called.

Change-Id: Id1be3bf0053809a45f2eca4461e4c35b5ef9388d
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-12 18:19:16 -07:00
Riley Andrews
b81c410abe Merge "Added file permissions for binder tracing" 2015-08-12 23:28:08 +00:00
Scott Bauer
cd1d99e268 Added file permissions for binder tracing 2015-08-12 16:20:51 -07:00
Riley Andrews
a3a193ffd9 Merge "Added shell permisisons for memreclaim tracing" 2015-08-12 23:13:38 +00:00
David Pursell
6fefa36cf2 Merge "adb: Fix PTY logic for non-interactive shells." 2015-08-12 22:16:20 +00:00
David Pursell
d4093f191b adb: Fix PTY logic for non-interactive shells.
Change `adb shell` so that interactive sessions use a PTY but
non-interactive do not. This matches `ssh` functionality better
and also enables future work to split stdout/stderr for
non-interactive sessions.

A test to verify this behavior is added to test_device.py with
supporting modifications in device.py.

Bug: http://b/21215503
Change-Id: Ib4ba40df85f82ddef4e0dd557952271c859d1c7b
2015-08-12 14:16:22 -07:00
Yabin Cui
317acfb880 Merge "Remove confusing variable HOST." 2015-08-12 20:55:59 +00:00
Bertrand Simonnet
eeab5cd585 Merge "metricsd: Remove unused Chrome OS specific files." 2015-08-12 20:49:41 +00:00
Bertrand Simonnet
497e38db9d Merge "metricsd: Relicense as Apache 2." 2015-08-12 20:49:16 +00:00
Nick Kralevich
0b973da532 Merge "init: add LOCAL_SANITIZE := integer" 2015-08-12 19:09:58 +00:00
Elliott Hughes
2fb00423d4 Merge "Always include the adb version in the log." 2015-08-12 17:02:59 +00:00
Elliott Hughes
42ae2604f4 Always include the adb version in the log.
"Are you running the right version?" seems to be a common cause of debugging
confusion.

Change-Id: I4a4ba95e876dafc05e515058ca059ea370273f78
2015-08-12 08:32:10 -07:00
Elliott Hughes
9508dcb9aa Merge "adb: make stdin/stdout/stderr redirection errors fatal" 2015-08-12 15:18:34 +00:00
Mark Salyzyn
95e7cb5b8e Merge "healthd: logd: add timestamp to kernel logged battery messages" 2015-08-12 14:17:38 +00:00
Spencer Low
155159c545 adb: make stdin/stdout/stderr redirection errors fatal
Make these fatal errors:

- Win32 GetTempPathW() failures.

- Errors opening /dev/null (and don't use LOG(FATAL) for this error
  since that will do a crash-dump on Windows which isn't appropriate for a
  transient runtime error).

- Errors with dup2.

- Errors opening adb.log.

Change-Id: Ided76a5436d8c6f059d8f6799c49ba04c87181ae
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-11 23:36:55 -07:00
Elliott Hughes
b62f6c2a1c Merge "adb: call android::base::InitLogging even when adb tracing is disabled" 2015-08-12 03:20:04 +00:00
Dan Albert
cef3508bb6 Merge "Add missing includes." 2015-08-12 01:50:15 +00:00
Nick Kralevich
aea73db1e3 init: add LOCAL_SANITIZE := integer
Call abort() on undefined or sketchy integer behavior.
Protects against integer overflow attacks.

Change-Id: I5f542089753c8fcf7596fd70cfaa48a3caa5b140
2015-08-11 16:55:56 -07:00
Mark Salyzyn
ea56594c94 Merge "logd: sizes > 1M prune in smaller batches" 2015-08-11 23:51:31 +00:00
Spencer Low
bf7c605d87 adb: improve network error info
- handle_forward_request
  - Because we have detailed info about which syscall failed (at least
    on Win32), use a more generic prefix of "cannot bind listener" followed
    by the detailed info.

- install_listener
  - Return string errors for a few errors even though I don't think any
    callers actually output the string for those errors.

  - Remove the printf since the callers print the message themselves.

- adb_main
  - LOG(FATAL) calls abort() which on Windows calls the Windows Error
    Reporting service which pops up a dialog asking if you want a
    crashdump to be uploaded to Microsoft. So really, abort() is
    designed for app bugs. Windows isn't the only one doing this, Chromium
    also makes LOG(FATAL) crashdump-ready. Since an error here is not
    necessarily an app-bug, use a 'normal' error output API like fatal()
    which prints an error and just uses exit().

- sysdeps_win32.cpp
  - When Winsock APIs fail, make the string clarify which API failed.
    Use terse unix-style descriptions (like what you'd get from
    cp/mv/dd/etc.).

  - Don't trace WSAEWOULDBLOCK from recv() which is a normal occurrence.

  - Add a comment about WSAEWOULDBLOCK => EAGAIN.

Change-Id: I58e47f49fa2f6c1b4b92a36d0c4bfe369b456f2a
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-11 16:45:32 -07:00
Dan Albert
af9ba4dc6c Add missing includes.
Leaky header cleanup in libc++ means we don't get unistd.h
transitively any more.

Change-Id: I596c24eff418302b19afab6ad3caa55f52241e7c
2015-08-11 16:39:57 -07:00
Mark Salyzyn
62ab0fd4ef logd: sizes > 1M prune in smaller batches
Switch to 1% batch sizes from 10% when individual buffer size > 1M

Bug: 22351810
Change-Id: Ifee570a54643ceb0ba767e1787e937f70cc90b72
2015-08-11 16:20:54 -07:00
Spencer Low
7430916098 adb: call android::base::InitLogging even when adb tracing is disabled
This is a follow-up to https://android-review.googlesource.com/153623
which prevented android::base::InitLogging() from being called when
tracing was disabled.

It is ok to call InitLogging() on a device or host because calling it
does not imply that a logging file is used, which was the reason for
not calling it on a device.

So this change should preserve the device behavior of not using a
logging file when tracing is disabled, plus it will call InitLogging()
all the time in case logging APIs are called.

Change-Id: I3fd6ba2c567f67a2f111a85f174893fbf866ec57
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-11 15:48:15 -07:00
Elliott Hughes
7989a7c8d3 Merge "adb: win32: fix USB device hang when resuming from sleep/hibernation" 2015-08-11 21:43:32 +00:00
Yabin Cui
661327e8e4 Remove confusing variable HOST.
First, HOST is always 0 in adbd, which matches ADB_HOST=0.
Second, HOST is always 1 when adb_main is called, which matches ADB_HOST=1.
For adb client that doesn't call adb_main, it never touches local_init(),
init_transport_registration() and fdevent_loop(). So the changes in adb.cpp,
services.cpp and transport_local.cpp do nothing with it.
As a conclusion, I think we can remove HOST and use ADB_HOST instead.

Change-Id: Ide0e0eca7468b6c3c130f6b50974406280678b2e
2015-08-11 14:00:15 -07:00
Tom Cherry
5573e3d839 Merge "init: replace strdup() in parse_config()" 2015-08-11 20:53:11 +00:00
Yusuke Sato
162ec8e637 Merge "Ignore adb/*.pyc files" 2015-08-11 20:03:27 +00:00
Yusuke Sato
83cd266439 Ignore adb/*.pyc files
Python scripts in system/core/ such as perfboot.py may generate
the files.

Change-Id: I0506d47db414a678f1923e747ddce5acfcd7ce1b
2015-08-11 12:59:58 -07:00
Bertrand Simonnet
f71590ffbc Merge "metricsd: Only define the targets on linux." 2015-08-11 18:54:41 +00:00
Bertrand SIMONNET
0a94a3bf1c metricsd: Only define the targets on linux.
libchromeos (dependency of metricsd) is only defined for linux.
All metrics target must only be defined on mac too or the build system
will complain.

BUG: 22879597
Change-Id: I5bee816e001518a8053d1dfc7b39cca81a4314fd
2015-08-11 11:45:05 -07:00
Bertrand Simonnet
3670eab0ba Merge "metricsd: Add Android.mk." 2015-08-11 18:05:35 +00:00
Elliott Hughes
e329a3ec1b Merge "Remove watchprops." 2015-08-11 02:51:58 +00:00
Elliott Hughes
e8606c85c5 Remove watchprops.
Since watchprops would have to be rewritten anyway in the upcoming properties
rewrite, there seems little point in rewriting it for toybox first. Let's
see how many people actually use watchprops and decide whether it's worth
the effort...

Change-Id: I996e7209bc81633ee66602f09f130226336d9987
2015-08-10 19:27:18 -07:00
Elliott Hughes
1f36ae49b9 Merge "adb: win32: write ACK to separate pipe instead of stdout" 2015-08-11 01:38:55 +00:00
Elliott Hughes
5a1f9a3ef0 Merge "Remove the USB vendor id whitelist from fastboot." 2015-08-11 00:28:21 +00:00
Bertrand SIMONNET
8715c9396a metricsd: Remove unused Chrome OS specific files.
Change-Id: Iff19b6c83731c4eedebe20d307c079afb1e21491
2015-08-10 15:57:47 -07:00