Commit graph

21674 commits

Author SHA1 Message Date
Josh Gao
48bc0d7853 adb: cleanup file skipping logic.
Bug: http://b/26355212
Change-Id: Iafa250ce6c5ea8da9f5f00125165e5b67ef1013f
(cherry picked from commit a31ea55c55)
2016-03-03 15:46:51 -08:00
Josh Gao
74e0fe73c0 adb: symlinks to dirs count as dirs for pull destination.
This matches scp's behavior when pulling a directory that collides
with a symlink to a directory.

Bug: http://b/27362811
Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
(cherry picked from commit 1e611a33d5)
2016-03-03 15:46:50 -08:00
David Pursell
802c54ebb7 adb: relax serial matching rules.
Currently targeting a device by serial requires matching the serial
number exactly. This CL relaxes the matching rules for local transports
to ignore protocol prefixes and make the port optional:
  [tcp:|udp:]<hostname>[:port]

The purpose of this is to allow a user to set ANDROID_SERIAL to
something like "tcp:100.100.100.100" and have it work for both fastboot
and adb (assuming the device comes up at 100.100.100.100 in both
modes).

This CL also adds some unit tests for the modified functions to make
sure they work as expected.

Bug: 27340240
Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
(cherry picked from commit 3f902aad5b)
2016-03-03 15:46:50 -08:00
Josh Gao
f22bc60fc9 adb: report progress for small files.
Bug: http://b/27407725
Change-Id: I7515144402a487fb3d4d403e2f5f82423c1b5ed6
(cherry picked from commit 9fd2f77dcc)
2016-03-03 15:46:50 -08:00
Ying Wang
f48503b4a0 Also archive adb.exe/fastboot.exe when building win_sdk.
On linux we archive both Linux and Windows binaries.

Bug: 27315911
Change-Id: I17d25cd1ea611a9c917f1e78b47f21a8959eea20
(cherry picked from commit 71edfc8b9a)
2016-03-03 15:46:50 -08:00
Josh Gao
a63b17f76c adb: fix directory creation logic.
Previously, for `adb pull $remote $local`, we would do the equivalent of
mkdir -p on `dirname $local`. This patch changes the behavior to only
creating directories that are being pulled, like scp.

Bug: http://b/27362811
Change-Id: I79f975ee9f2d9bc9e8be6a7c4f2de6d7ae2d2d23
(cherry picked from commit 71728ca300)
2016-03-03 15:46:50 -08:00
Josh Gao
d382d2bb51 adb: fix mistaken use of PLOG.
Change-Id: I60bfa3d8cf1572a877d6f0c9369d8f72f10e5aef
(cherry picked from commit 443a52c298)
2016-03-03 15:46:50 -08:00
David Pursell
a76e5f035e adb: use TCP keepalive.
Currently adb only realizes a TCP transport has gone away when it tries
to send a packet, which caused problems in particular for `adb reboot`
since no packets are sent, leading to the client hanging until Ctrl+C.

This CL turns on TCP keepalive packets to send 1 packet every second,
allowing up to 10 failures before disconnecting. Using built-in TCP
functionality turns out to be much cleaner in this case than trying to
implement our own keepalive packets at the application layer, and
should be more lightweight since it's all done in the TCP stack.

Bug: http://b/23093474

Change-Id: Ifb41cbb85b9752a9f394e1eed3c6ac4da47a4e4d
(cherry picked from commit bfd9503d1d)
2016-03-03 15:42:11 -08:00
Elliott Hughes
263d140895 Merge "Revert "Introduce unique_fd"" into nyc-dev 2016-03-03 21:47:14 +00:00
Elliott Hughes
468da57bb2 Revert "Introduce unique_fd"
This reverts commit 97b3e66d3e.

This cherrypick was actually obsolete. The file had already moved elsewhere.

Change-Id: Ia209f230b2f5d621ec890d901dea8e5fa135fc87
2016-03-03 19:03:34 +00:00
Andreas Gampe
a7a7369343 Revert "Do not do local unwinds through .oat or .dex maps."
This reverts commit 4265ed7cc8.

Workaround in libunwind instead: change-id I98be5754cc4de4071616db334dc0c9862d3a2504

Bug: 27391690

(cherry picked from commit 04dcb00ab7)

Change-Id: Id77dc081b655dc0fcb513ad0ee95221d91a301f9
2016-03-02 13:20:35 -08:00
Mark Salyzyn
07522c6e9b logd: check return values
(cherry pick from commit bf7d0b8875)

The setgid() and setuid() call failure in logd.daemon thread
do not block overall functionality, so clearly tell static
analyzer and developers that we do not care to check their
return values.

SideEffects: None

Bug: 27434072
Change-Id: I6fdc87e8311ebc0173716080bbd72c86b3f00f78
2016-03-02 11:37:21 -08:00
Mark Salyzyn
c348416198 logd: clarify release_Locked() for static analyzer
(cherry pick from commit 0ecdec7a09)

release_Locked() is called with a reference count and threadRunning,
the static analyzer can not tell this and estimates that a call to
delete this will occur. So let us invent a new call
release_nodelete_Locked() to ensure it is clear we will not be
arranging a delete this in the context of this code path. The
delete this will follow in the immediate codepath in this function
after threadRunning is cleared, and decRef_Locked() is called.

Change will also remove any developer FUD regarding release_Locked()
usage at this location.

SideEffects: None

Bug: 27434831
Change-Id: I91b060b2dadc72cc449fa381c934afb577bee037
2016-03-02 11:37:21 -08:00
Elliott Hughes
539a79e529 Make toolbox top a little more like everyone else's.
The use of PR to mean PSR rather than PR was confusing, so let's just
use PR and NI the same way everyone else does.

Also remove bogus blank lines and unnecessary delays (both before first
showing anything and after having shown the final iteration).

Bug: http://b/27447491

(cherry picked from commit fd64c5d07e)

Change-Id: I4aa0bcebe08fbb5d3430311fd501a50352e58a0d
2016-03-02 08:42:18 -08:00
Andreas Gampe
bb7ed0141b Merge "Do not do local unwinds through .oat or .dex maps." into nyc-dev 2016-03-02 03:40:41 +00:00
Christopher Ferris
b035a19e4f Do not do local unwinds through .oat or .dex maps.
Bug: 27391690

(cherry picked from commit 4265ed7cc8)

Change-Id: I88a49537544b507a3b0bfa61eafc27400a05281b
2016-03-01 18:19:42 -08:00
bohu
8ac1b044af Emulator: fix adbd qemu pipe partial write
It does happens that the adb_write only writes to the
qemu pipe partially which throws host side's adb backend
into confusion and crashes.

This CL replaces adb_write with WriteFdExactly;
adb_read with ReadFdExactly.

(cherry picked from commit f66c5938be)

Change-Id: I684f5df79b1e3f00b4b7a2452c2712a73c15973c
2016-03-01 17:39:31 -08:00
Keun Soo Yim
2d750b266b Merge "mkdir /data/misc/cameraserver for AVD's camera HALs" into nyc-dev 2016-03-01 22:49:48 +00:00
Keun Soo Yim
be54c543bd mkdir /data/misc/cameraserver for AVD's camera HALs
cameraserver from nyc uses cameraserver as its username.
thus this change is needed for AVD (android virtual device)'s
camera HAL which is attached to cameraserver to work as that
HAL writes some files to /data/misc/media. the backward compatibility
issue should be handled as separate changes. this approach is 
preferred for finer-grained security isolation.

Change-Id: If028667d62df8fcac634ff1001759c39703b00dd
2016-03-01 22:44:59 +00:00
Colin Cross
c3dc3304c6 Merge changes from topic 'unreachable' into nyc-dev
* changes:
  libmemunreachable: fix long timeout on error
  imprecise mark and sweep native memory leak detector
2016-02-29 22:19:41 +00:00
Sami Tolvanen
78d2766143 Merge "logd: stop log spam when integrity enforcement is suppressed" into nyc-dev 2016-02-29 21:30:46 +00:00
Dimitry Ivanov
34d5a20c8b Fix locking of libnativeloader
This commit fixes race condition introduced in
d047c925af

Bug: http://b/27189432
Bug: http://b/22548808
Change-Id: I5d94f130937f18d3443878b3521715a8f87427e0
2016-02-29 13:21:43 -08:00
Sami Tolvanen
89e0429ce7 logd: stop log spam when integrity enforcement is suppressed
Bug: 27389331
Change-Id: I9f3bc21eb1b85b9fda4fa0a5c5b4da94e5e7cc1c
(cherry pick from commit abda9340e6)
2016-02-29 13:18:46 -08:00
Nick Kralevich
99fb01e42a Revert "logd: Don't trigger an integrity failure on permissive SELinux denials"
external/sepolicy commit bca98efa575bedab68f2d5eaee2cd1fd1741962b
ensures that no permissive domains can be on user builds, and
external/sepolicy commit 3872ee396898fcb23bdc49c37fd02d81014aaa5f
re-enables enforcing mode on cameraserver.

The conditions which lead to the integrity failure detection
triggering can no longer occur. Revert the patch which relaxed
the detection.

This reverts commit 33ee84f871.

Bug: 27313768
Bug: 26902605
Change-Id: I8ee97d0858345695f9df8240de4e696f4a9ba008
2016-02-27 08:31:57 -08:00
Nick Kralevich
33ee84f871 logd: Don't trigger an integrity failure on permissive SELinux denials
Only trigger an integrity failure if a policy is reloaded or
SELinux is disabled. Don't trigger the integrity failure if
we see a permissive=1 denial, which could occur if an SELinux
domain is in permissive mode.

Bug: 27313768
Bug: 26902605
Change-Id: Ib85a2799eb6378ae8acdb965b1812d691183fdd3
2016-02-26 17:00:15 -08:00
Stephen Hines
242393fec1 Merge "Fix windows 64-bit builds" into nyc-dev 2016-02-26 23:34:39 +00:00
Ruchi Kandoi
1d043484d4 Merge "healthd: Correct the scaling factor for maxVoltage and maxCurrent." into nyc-dev 2016-02-26 21:27:47 +00:00
Ruchi Kandoi
5c09ec1726 healthd: Correct the scaling factor for maxVoltage and maxCurrent.
Change-Id: I93a4c916d0c742710c00c0b15d8d1de6b8f8d1c2
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2016-02-26 10:09:28 -08:00
Dimitry Ivanov
94da34a8fa Merge "Added function to explicitly initialize a namespace" into nyc-dev 2016-02-26 18:03:56 +00:00
Todd Kjos
d125f6e8a9 Merge "Mount schedTune cgroup as /dev/stune" into nyc-dev 2016-02-26 17:35:50 +00:00
Lajos Molnar
1e86e1ba1a Merge "keep legacy HAL_DATASPACE enums unchanged" into nyc-dev 2016-02-26 05:06:13 +00:00
Dan Willemsen
9dddd137c7 Fix windows 64-bit builds
pid_t is 64-bit in 64-bit mingw, but the windows process/thread
functions return a DWORD(uint32_t). Instead of promoting to a pid_t and
fixing the format strings, just use a uint32_t to store the values.

android_thread_id also cannot be a 64-bit pointer, so for windows just
force it to be a uint32_t.

libutils/ProcessCallStack only works under Linux, since it makes heavy
use of /proc. Don't compile it under Windows or Darwin.

Bug: 26957718

(cherry picked from commit 86cf941c48)

Change-Id: I8d39d1951fea1b3011caf585c983e1da7959f7c0
2016-02-25 18:43:55 -08:00
Casey Dahlin
97b3e66d3e Introduce unique_fd
unique_fds are wrappers for integer file descriptors that automatically
close when they go out of scope. They are movable but not copyable and
generally mimic the semantics of std::unique_ptr

(cherry-pick from 918b9e8dc6)

Change-Id: I0657b848b6536d5ad9fc06686e240ea5c387b0ac
Test: Considerable exercise in new AIDL integration tests
Bug: None
Signed-off-by: Casey Dahlin <sadmac@google.com>
2016-02-25 17:02:17 -08:00
Mark Salyzyn
dad8361a0e Merge changes Ic15a87f4,I8a53ad3a,I6a03d405 into nyc-dev
* changes:
  liblog: __android_log_error_write use event list library
  liblog: test: __android_log_error_write accuracy
  liblog: add android_log_write_string8_len
2016-02-25 23:55:59 +00:00
Mark Salyzyn
a4f2ef1b05 liblog: __android_log_error_write use event list library
(cherry pick from commit 81f407be36)

Switch to the event list library to compose the associated event.

SideEffects: Instead of composing event on a stack buffer of 512
             bytes in size, a PAGE is allocated temporarily.

Bug: 27356456
Change-Id: Ic15a87f49385834c2287ed82c26439b2c5eb4f77
2016-02-25 15:54:28 -08:00
Mark Salyzyn
d9aee653d1 liblog: test: __android_log_error_write accuracy
(cherry pick from commit 5cecedc6e8)

Add a test to confirm exact expected content using the testframe
setup for the events log handler. Remove dependency on 512 truncation
in liblog->
android_errorWriteWithInfoLog__android_logger_list_read__data_too_large
to something more liberal.

Bug: 27356456
Change-Id: I8a53ad3a16cf16b14856efe5b95417e857c7e09b
2016-02-25 15:53:44 -08:00
Tim Murray
b43225eefb Fix build break with uninitialized boost_fd.
Change-Id: Icf209e2e0f4835db01f61dbf83b4715db9ef03a9
(cherry picked from commit def6c151f4)
2016-02-25 23:53:08 +00:00
Mark Salyzyn
1d5afc9e08 liblog: add android_log_write_string8_len
(cherry pick from commit 67d7eafd56)

android_log_write_string8_len(android_log_context ctx,
                              const char *value, size_t maxlen)

Caps the supplied string to a maxlen length. Alter API to handle
a NULL pointer for the value string for this and
android_log_write_string8() and instead of returning -EINVAL,
act like a null string "" was supplied to preserve the list
location. API is also changed to report the number of characters
actually placed into the android_log_context.

Bug: 27356456
Bug: 19235719
Change-Id: I6a03d405eac1d741555dd05555513ec691e7a46e
2016-02-25 15:53:00 -08:00
Christopher Ferris
82d84897b1 Fix incorrect handling of snprintf return value.
The code assumed that snprintf would never return a value less than
the passed in size of the buffer. This is not accurate, so fix all
of the places this assumptions is made. Also, if the name is too large,
then truncate just the name to make everything fit.

Added a new set of tests for this code. Verified that the old code passes
on the _normal and _exact version of the tests, but fails with the
FORTIFY error on the _truncated version of the tests. All tests pass
on the new code.

Bug: 27324359

(cherry picked from commit 626efb78a6)

Change-Id: Iba60a926cf5a1d6b517a6bfd8c797d724f093010
2016-02-25 14:02:00 -08:00
Dimitry Ivanov
aa2cf3facf Merge "Make libutils symbols protected" into nyc-dev 2016-02-25 21:08:48 +00:00
Mark Salyzyn
d26b2cacad logd: sock_alloc_send_pskb starves pruning
(cherry pick from commit 5c77ad55d0)

Allow socket send syscall to terminate after 32 seconds if reader
stalled because of memory pressure allocating new network buffers

Add a gTest to catch regressions, add security buffer to log_dump

Bug: 27242723
Change-Id: Idaa6699d9d284e7f5f723ae0e76b3d6aa3371489
2016-02-25 12:43:12 -08:00
Mark Salyzyn
317bfb923c logd: Allow (some) headers to be individually importable
(cherry pick from commit 2ad0bd0a9b)

LogReader.h needs to be individually importable.

Fix a few others, drop includes of local includes, let them be
included in source instead and allow headers to be included
alphabetically. Was not a complete audit since goal was to
separate LogReader.h out from the pack.

Bug: 27242723
Change-Id: Ic7759ef90995e5bd285810706af33550c73cf5b5
2016-02-25 12:42:31 -08:00
Ruchi Kandoi
df09aefc16 Merge "healthd: Read the max power supply voltage" into nyc-dev 2016-02-25 20:28:19 +00:00
Alex Klyubin
8a67c09e7d Merge "Only debuggable packages can be downgraded." into nyc-dev 2016-02-25 20:26:54 +00:00
Badhri Jagan Sridharan
40e1df4488 healthd: Read the max power supply voltage
With Type-C PD, VBUS can no longer be assumed to
to be at 5V. Read the "voltage_max" field from the
power_supply class node and export it through
BatteryProperties service.

Bug: 25229483
Change-Id: I04e32d9783a21bab375f1724758a9eeace2a047c
2016-02-25 12:15:54 -08:00
Dimitry Ivanov
2c7960c8d9 Make libutils symbols protected
This change is a workaround for apps linking
libutils statically and dynamically which causes
them to crash for newer version of Android.

Bug: http://b/27313399
Change-Id: I47ac4146041b6eeef03cb605ea436719d552ec8f
2016-02-25 11:44:35 -08:00
Dimitry Ivanov
d047c925af Added function to explicitly initialize a namespace
This change replaces lazy get-or-create logic for
linker namespaces with the explicit one.

ApplicationLoaders.getClassLoader(..) is now resposible for
the namespace initialization for PathClassLoaders.

Bug: http://b/27189432
Bug: http://b/22548808
Change-Id: Ife987c3ca1db33a47c20f363a5ed61512be8b5a7
2016-02-25 11:33:32 -08:00
Josh Gao
2eaa41a6df adb: fix leak of framework_fd.
Move the fdevent for the framework authentication connection out of
atransport into its own static variable in adb_auth_client, since its
lifetime is completely unrelated to that of the USB connection.

Bug: http://b/27297963
Change-Id: Ie6180d0b59d133120c5755e239e76ab33ed3cc1d
(cherry picked from commit 9f48611554)
2016-02-25 11:01:59 -08:00
Josh Gao
b6117c4397 adb: bail out if wait_for_device fails in send_shell_command.
Bug: http://b/27166186
Change-Id: Ib7e9d7e6b909d67a3af94c3517a6a0b54cf17db7
(cherry picked from commit f56c39194f)
2016-02-25 11:01:38 -08:00
Lorenzo Colitti
b046e74bef Merge "Delete dhcpcd code in system/core, since dhcpcd is no more." into nyc-dev 2016-02-25 07:56:16 +00:00