Commit graph

19088 commits

Author SHA1 Message Date
Colin Cross
c2c0df900d Merge "Fix static analyzer issues caught by clang" 2016-02-01 21:16:20 +00:00
David Pursell
85c65dab42 Merge "adb: win32: handle incomplete UTF-8 in console output, other fixes" 2016-02-01 20:49:25 +00:00
David Pursell
79d8f07a6f Merge "base: add SystemErrorCodeToString() function." 2016-02-01 20:39:09 +00:00
David Pursell
5f787ed2b3 base: add SystemErrorCodeToString() function.
Pulls the Windows error string generation out of adb into libbase so
that it can be used by fastboot as well. Also makes a Unix equivalent
that just wraps strerror() so that upcoming fastboot error reporting
code can be platform-independent.

The intent here is just to provide a portable way to report an error to
the user. More general cross-platform error handling is out of scope.

Bug: http://b/26236380
Change-Id: I5a784a844775949562d069bb41dcb0ebd13a32bc
2016-02-01 12:18:26 -08:00
Colin Cross
1eb743ba8b Fix static analyzer issues caught by clang
system/core/libsparse/sparse_read.c:260:51: warning: Dereference of null pointer (loaded from variable 'crc_ptr')
                        ret = process_crc32_chunk(fd, chunk_data_size, *crc_ptr);
system/core/libsparse/sparse_read.c:404:9: warning: Potential leak of memory pointed to by 'buf'
        return 0;

Fixes leak in sparse_file_read_normal, and null pointer dereference
crash if an image with an obsolete CRC chunk was read with CRC checking
disabled.

Bug: 26904425

Change-Id: Ibc72cd37602929ae2c248bea1cdd1d22ea03baaf
2016-02-01 11:19:26 -08:00
Josh Gao
d18aea9974 Merge changes I93287b87,I30a3eb0b
* changes:
  adb: add nullability specifiers to adb_client.h.
  adb: add adb_get_feature_set.
2016-02-01 18:48:13 +00:00
Josh Gao
a166e71e21 adb: add nullability specifiers to adb_client.h.
Change-Id: I93287b876cb06d871b4330d2733ef6f43c58fbbf
2016-01-31 19:22:04 -08:00
Josh Gao
f3f6a1d0d4 adb: add adb_get_feature_set.
Extract a feature set getter function from commandline.cpp.

Change-Id: I30a3eb0b060a88379e29be16264637816e378978
2016-01-31 19:12:26 -08:00
Yabin Cui
aef26bb1a4 Merge "base: add API to remove file if it exists." 2016-01-30 04:27:44 +00:00
Yabin Cui
b6e314aa86 base: add API to remove file if it exists.
It is a function needed in different places like uncrypt, simpleperf.

Bug: 26883096
Change-Id: I26f4f30e8367867a88272625f00858569fc8e950
2016-01-29 19:24:55 -08:00
David Pursell
a9352202dd Merge "adb: fix subprocess termination for legacy shell." 2016-01-29 22:14:46 +00:00
Josh Gao
c1eb5ba0fb Merge "adb: SIGWINCH support for Windows" 2016-01-29 22:01:45 +00:00
Christopher Ferris
4602f2b77b Merge "Always have ps output to stdout at least one line." 2016-01-29 19:11:17 +00:00
Alex Vakulenko
bade73d9b4 Merge "metricsd: Removing brillo::Any from weaved's public APIs" 2016-01-29 17:01:05 +00:00
Spencer Low
2e02dc630f adb: SIGWINCH support for Windows
- Introduces unix_read_interruptible() which is like unix_read() except
  that it can return EINTR.

- The big idea is that the Windows ReadConsoleInput() API will return an
  event on window resize and then we return EINTR from
  unix_read_interruptible() just like Unix.

- Only handles horizontal resize since Windows doesn't seem to give an
  event for vertical resize when no special screen buffer is used. This
  should be sufficient for the primary use case of adb on Windows
  (people are not running vi in the first place).

Change-Id: Id8d1710b559834c8098f2d7fbecedf2d0ade4b88
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2016-01-28 23:01:56 -08:00
Spencer Low
a30b79a2d9 adb: win32: handle incomplete UTF-8 in console output, other fixes
Previously, the various adb_printf, adb_fwrite, etc. functions did not
correctly handle the case of the passed buffer ending with an incomplete
UTF-8 sequence. This is fixed by buffering up incomplete UTF-8 sequences
in g_console_output_buffer (protected by the mutex
g_console_output_buffer) and outputting it later once the full sequence
is available.

A unittest for the main worker function, ParseCompleteUTF8(), was added
to adb_test.

Other fixes:

- Fix the return value of number-of-chars written to be number of UTF-8
  bytes instead of number of UTF-16 characters.

- Don't overwrite errno in success cases of various adb_printf, etc.
  functions. This might be excessive, but might be useful in the case
  when these functions are used for debugging/tracing.

- Add missing UTF-8 stdio functions that aren't currently used by adb,
  but might be in the future: vprintf, putc, putchar, puts.

- stdin_raw_init: If we can't get the console handle, don't call
  SetConsoleMode(). Not a big deal, but this will prevent erroneous
  trace output.

Change-Id: I8730e8af92882c42b884ad921b39a17b54465085
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2016-01-28 16:31:28 -08:00
Christopher Ferris
78e08066f2 Always have ps output to stdout at least one line.
There is at least one app that assumes that you will always get at least
one line of output in stdout from ps.

To fix this, move error output to stdout, and move the check of whether
/proc can be opened until after the ps header is printed.

Bug: 26554285
Change-Id: I6d9342aafd5c6f728735507cdd87a48a8e0373ac
2016-01-28 16:08:08 -08:00
Dan Stoza
53529ecacd Merge "Name the pixel format and transform enums" 2016-01-28 23:18:43 +00:00
Alex Vakulenko
eca14e3722 metricsd: Removing brillo::Any from weaved's public APIs
Weaved replaces brillo::Any with base::Value in its client library,
so need to update clients.

Also this removes last D-Bus dependencies from metrics_collector.

BUG: 26558300
Change-Id: I82d571d7e2bd17347daeb1b70f48ec05378894f0
2016-01-28 14:44:28 -08:00
Todd Poynor
36ba2fad01 Merge "healthd: BatteryPropertiesRegistrar binder service ref count fixup" 2016-01-28 21:11:09 +00:00
Todd Poynor
e55356486f healthd: BatteryPropertiesRegistrar binder service ref count fixup
Call addService using a reference to a strong pointer to the service object,
such that the proper IBinder object is ref counted, instead of passing the
object's this pointer.

Bug: None
Change-Id: I72cac08c835a17b8cc263b2dc34864420b7a2841
2016-01-28 21:10:21 +00:00
Rubin Xu
8dfe21eaad Merge "ADB security logging" 2016-01-28 19:50:58 +00:00
David Pursell
57dd5ae1e3 adb: fix subprocess termination for legacy shell.
http://r.android.com/166419 changed `adb shell` behavior to not
allocate a remote PTY for non-interactive commands, but adbd relied on
having a PTY to properly terminate the subprocess.

One impact of this is that when using older versions of adb or passing
the -x flag, `adb screenrecord` wasn't properly terminating and closing
out the video file.

This CL restores the old behavior for legacy shell connections: always
use a PTY, but put it in raw mode if the client is doing local PTY
input/output processing itself.

Bug: http://b/26742824
Change-Id: I9ee630c0ff0d2d6a0db367387af7123deea79676
2016-01-27 17:13:41 -08:00
Calin Juravle
8b999d894f Merge "Revert "nativebrige: log code_cache access errors to stderr as well"" 2016-01-27 17:58:18 +00:00
Calin Juravle
5e11a2936b Revert "nativebrige: log code_cache access errors to stderr as well"
This reverts commit 6d5017803e.

Bug: 26675310

Change-Id: Id56b5e832c85f01fca0a2198499d24224c5a6878
2016-01-27 17:53:20 +00:00
Kevin Cernekee
fa432b0e2f Merge "ueventd.rc: Document the different rule formats for /dev and /sys nodes" 2016-01-26 23:44:56 +00:00
Mark Salyzyn
b5eb67ff23 Merge "liblog: check getgroups for AID_LOG for AID_LOG_SECURITY" 2016-01-26 22:54:47 +00:00
Mark Salyzyn
c85ce9ba8e Merge "Revert "logd: security buffer only AID_SYSTEM reader"" 2016-01-26 22:38:58 +00:00
Mark Salyzyn
674ce6ef58 Revert "logd: security buffer only AID_SYSTEM reader"
This reverts commit 756332e88b.

Change-Id: Ib8607ac758b7e88a9db716ec4274ec0e4e3dc596
2016-01-26 21:47:35 +00:00
Mark Salyzyn
9107c462ce liblog: check getgroups for AID_LOG for AID_LOG_SECURITY
Bug: 26792035
Change-Id: I634d3c8f9f3175956bd70e80daa479af40180f90
2016-01-26 13:32:02 -08:00
James Hawkins
dac84b5a1a Merge "bootstat: Hook up bootstat to record the boot complete signal and log boot events in the LOCAL_INIT_RC file, bootstat.rc." 2016-01-26 21:30:55 +00:00
Mark Salyzyn
69ce7c5483 Merge "logd: security buffer only AID_SYSTEM reader" 2016-01-26 20:41:51 +00:00
James Hawkins
6bff639c19 bootstat: Hook up bootstat to record the boot complete signal and log
boot events in the LOCAL_INIT_RC file, bootstat.rc.

This change also creates the /data/misc/bootstat dir during the
filesystem creation block in init.rc.

Bug: 21724738
Change-Id: I2ad6913c0235d5f926c6ef8b3c65d650159c6ed7
2016-01-26 11:23:31 -08:00
Mark Salyzyn
756332e88b logd: security buffer only AID_SYSTEM reader
Bug: 26029733
Change-Id: I140e5eb8bb39271fa674744651127e3fc545cbe8
2016-01-26 07:20:29 -08:00
Alex Deymo
1503538869 Merge "Add BinPackArguments: false to .clang-format" 2016-01-26 02:57:34 +00:00
Christopher Ferris
9adbf681a0 Merge "Put BacktraceOffline code into a separate library." 2016-01-26 01:50:25 +00:00
Alex Deymo
d830612305 Add BinPackArguments: false to .clang-format
Without this setting, arguments passed to a function can be packed in
more than one line, with more than one argument per line.

For example, the following code will be formated as this without the
BinPackArguments:

  CallMyFunction(
    with_more_than_one, argument_per_line,
    event_they_dont_fit_in_a_single_line);

On the other hand, with BinPackArguments: false, that code will be
split in:
  CallMyFunction(
    with_more_than_one,
    argument_per_line,
    event_they_dont_fit_in_a_single_line);

or all the arguments in the same line if they all fit.

Bug: None
TEST=None

Change-Id: I48627e66e2a841f89418c0763e7fe6c3e6ea7387
2016-01-25 17:46:21 -08:00
Christopher Ferris
8540216028 Put BacktraceOffline code into a separate library.
BacktraceOffline is the only code that uses libLLVM. Create
a new shared library, backtrace_offline.so, that references this
so that including libbacktrace.so doesn't wind up pulling in libLLVM.

Change-Id: I90c502d833f6c464c3810dffde52a0c6da241cce
2016-01-25 16:26:48 -08:00
Mark Salyzyn
1c92d83cda Merge "logd: test wrap functionality" 2016-01-25 22:45:28 +00:00
Josh Gao
506d233e7a Merge "Use dlmalloc from external/dlmalloc instead of bionic/." 2016-01-25 18:42:54 +00:00
Tom Cherry
d401eba04c Merge "init: Update readme.txt to reflect recent changes to init" 2016-01-25 18:15:33 +00:00
Marco Nelissen
c7096b5e42 Merge "uid for codec process" 2016-01-25 16:51:05 +00:00
Marco Nelissen
003c07238a uid for codec process
Change-Id: Iadf8012e6c177bcf487048e1b5a9b4fc51a0aeba
2016-01-25 07:49:39 -08:00
Tom Cherry
1fb20b8377 init: Update readme.txt to reflect recent changes to init
Best practice for services that reside on the system, vendor, and odm
partitions is to have a corresponding init .rc file in the
/{system,vendor,odm}/etc/init directory, which contains its service
entry and any related actions.

Change-Id: I26204f9a0f09ce8069f3791ccd9ee61d164a048f
2016-01-23 05:23:39 +00:00
Ian Pedowitz
4606c95760 Merge "Removing -std=c++14 from bootstat Android.mk" 2016-01-23 05:10:42 +00:00
Ian Pedowitz
5699ee889a Removing -std=c++14 from bootstat Android.mk
From comments in 7e04be06d1, this
is not needed.

Change-Id: I427efac8d5e0750ea5f4e77e1582d134d9cae089
2016-01-22 20:33:04 -08:00
Nick Kralevich
e04b60d2b9 Merge "init.rc: mix device-specific data into the Linux RNG" 2016-01-23 03:59:52 +00:00
Nick Kralevich
27cb410352 init.rc: mix device-specific data into the Linux RNG
Mix the contents of /proc/cmdline and /default.prop
into /dev/urandom. /proc/cmdline often contains
androidboot.serialno, a device-specific unique
identifier. Similarly, /default.prop contains the
build fingerprint and timestamp, which vary between
device families.

Change-Id: I8803b38c7089b2a1217b99a7c1808b29a3b138cf
2016-01-22 19:58:21 -08:00
Rom Lemarchand
738f0e3edf Merge "bootstat: Use Clang and c++14 standard" 2016-01-23 03:41:39 +00:00
Rom Lemarchand
7e04be06d1 bootstat: Use Clang and c++14 standard
Change-Id: Ic156eea4d8731e67b26da0a56a7e69b13df659cb
2016-01-22 19:11:20 -08:00