Commit graph

24084 commits

Author SHA1 Message Date
Elliott Hughes
5a7ad84ede Log failed load_properties_from_file calls.
These events are _somewhat_ normal, in that not all devices have all
partitions, but not logging anything makes it unnecessarily hard for
folks to debug simple failures.

Bug: http://b/31186390
Test: booted, checked dmesg
Change-Id: I403377c585ea35cfe73b0bed9443b75e3a84dc8d
2016-09-30 16:30:00 -07:00
Treehugger Robot
e5976bea7a Merge "[qemu]: Fix payload size format in qemu_pipe_frame_send()" 2016-09-30 17:39:48 +00:00
Elliott Hughes
50cb973b49 Merge "Improve "adb help" output." 2016-09-30 15:43:43 +00:00
Miodrag Dinic
192be1dcae [qemu]: Fix payload size format in qemu_pipe_frame_send()
The following change introduced regression for booting AOSP
on emulator for all architectures:

7c7990e Fix warnings in system/ headers

qemu_pipe expects payload size in the message header to be in hex format,
as stated in the comment for qemu_pipe_frame_send().

Change-Id: I32cfa9c9b2af56f93bbda0ea5597451c389ae45e
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
2016-09-30 13:58:11 +02:00
Treehugger Robot
06460bf466 Merge "Update escaping in Android.bp files" 2016-09-30 04:17:59 +00:00
Connor O'Brien
a2d4a6b598 Merge "Add basic tests for ashmem" 2016-09-29 21:32:02 +00:00
Colin Cross
af933290f6 Update escaping in Android.bp files
Strings like cflags in Android.bp files are parsed by blueprint,
written to build.ninja files, parsed by ninja, and then passed to
/bin/sh -c.  This had resulted in a combination of blueprint
(\"), ninja ($$), and shell (\$) escaping being necessary.

Soong has been updated to automatically handle ninja and shell
escaping, remove extra escaping from Android.bp files.

Bug: 31221587
Test: m -j
Change-Id: I78003c7a18028d27dff444af7d84901345d323a1
2016-09-29 14:07:08 -07:00
Colin Cross
18fbd80504 Merge "Fix more system/core/include warnings" 2016-09-29 17:20:30 +00:00
Elliott Hughes
833df5cd54 Merge "Use readdir instead of readdir_r." 2016-09-29 16:38:45 +00: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
Elliott Hughes
9f206938ed Use readdir instead of readdir_r.
http://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html

Test: boots.
Change-Id: If75532e24fe4d17743bf8e8c9590156dee378a63
2016-09-28 14:04:12 -07:00
Treehugger Robot
dfd30c4a16 Merge "liblog: fix errno issues with event tag map" 2016-09-28 18:07:09 +00:00
Treehugger Robot
b1c4d90215 Merge "adb: fix host-side serial number parsing for IPv6." 2016-09-28 17:30:29 +00:00
Treehugger Robot
1dfa8112ce Merge "liblog: free event tag map in __android_log_close()" 2016-09-28 14:58:39 +00:00
Colin Cross
1811d156e9 Fix more system/core/include warnings
The warnings in these files were hidden by -isystem
framework/native/include.

Bug: 31752268
Test: m -j
Change-Id: I2a54376aea380ee24e6483fb7d35fdfe8991c490
2016-09-27 16:21:12 -07:00
Treehugger Robot
b98317ff1c Merge "Migrate liblog to ndk_library." 2016-09-27 20:38:45 +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
Treehugger Robot
8d8545120c Merge changes from topic 'b/31458381'
* changes:
  init.rc: have hwservicemanager start the HAL class
  Add hwbinder dev node permissions.
2016-09-26 23:54:54 +00:00
Treehugger Robot
d9a23b5733 Merge "Switch adb to <android-base/properties.h>." 2016-09-26 21:58:16 +00:00
Treehugger Robot
60a99eb8f7 Merge "Add fastboot --skip-reboot flag" 2016-09-26 21:08:07 +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
Mitchell Wills
31dce302db Add fastboot --skip-reboot flag
Add a flag to fastboot that will cause it to not reboot the device after
performing commands like update and flashall.

Fixed: 31743001
Test: run fastboot update with and without --skip-reboot flag
Change-Id: I7f4056249a52779c7fc752c9d1009a58a44762df
2016-09-26 11:27:16 -07:00
Mark Salyzyn
70a83dc7b3 liblog: fix errno issues with event tag map
Cleanup.

Save the errno for the calls that fail, and reinstate them for
return. Drop fprintf stutter, one succinct line. Solve a memory
leak in close.  Change android_lookupEventTag() to use an
unsigned int so that we can use the full range of uint32_t tags.

Make sure this file compiles clean in C++.

Test: gTest liblog-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: I6a5efa6fb7e991431caba75ef0971e111968f6bf
2016-09-26 09:23:55 -07:00
Mark Salyzyn
ba1a798fd8 liblog: free event tag map in __android_log_close()
There is no leak since a reference always remained and could get
reused.  It just makes sense to also close the event tag map as well
if logging is closed.  If we close we also have to fix a tagArray
leak in android_closeEventTagMap().

NB: __android_log_close() already makes an assumption that another
thread is not logging at the same time, which is true in all callers
at this time.  There are some partial mitigation strategies if
__android_log_close() is called asynchronously, but not completely
solved at the cost of a lock for every logging call.

Test: gTest liblog-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: Ib76ad9302dba4d3f35250213f4dfef22498af238
2016-09-26 08:21:13 -07:00
Iliyan Malchev
57d66b8447 init.rc: have hwservicemanager start the HAL class
b/31458381
Test: passing build and runtime tests

Change-Id: I1d26af5ca1d0e9c7bbd97cfd88d0b432b50b7216
Signed-off-by: Iliyan Malchev <malchev@google.com>
2016-09-26 00:23:51 -07:00
Martijn Coenen
f5110ea029 Add hwbinder dev node permissions.
b/31458381
Test: pass

Change-Id: I8ec92a29287b17636c363c55a8565dacab19043d
Signed-off-by: Iliyan Malchev <malchev@google.com>
2016-09-26 00:23:51 -07:00
Treehugger Robot
aa00f5852f Merge "Base: Remove LOG_S variants." 2016-09-26 00:37:13 +00:00
Andreas Gampe
1f5fb43047 Base: Remove LOG_S variants.
Partially reverts commit 436f5a031f.

Remove the variants taking a fully qualified LogSeverity. Instead
use a lambda with "using" statements to translate both qualified
and unqualified names into valid expressions.

Compile-time regression was measured as 0.1s for a thousand LOG
statements on a z840.

Update tests.

Bug: 31338270
Test: m
Test: mmma system/core/base && $ANDROID_HOST_OUT/nativetest64/libbase_test/libbase_test64
Change-Id: I36fdf30a9d535b19543307b85d1b3c19a97f20dd
2016-09-24 10:18:38 -07:00
Treehugger Robot
3f049c3f19 Merge "Add std::string system property functions." 2016-09-24 04:52:59 +00:00
Treehugger Robot
19a7696488 Merge "Base: Check severity in destructor" 2016-09-23 23:12:09 +00:00
David Pursell
b2356a6993 Merge "Flattenable: switch from assignment to memcpy()." 2016-09-23 22:46:03 +00:00
Dan Albert
ddce8c70c4 Migrate liblog to ndk_library.
Test: make native
Bug: http://b/30465923
Change-Id: I3db7ede817a57b3505c0556ea28f08b9e8331e1a
2016-09-23 15:43:23 -07:00
Elliott Hughes
1e88c8c0ac Add std::string system property functions.
Makes it easier to write correct code in a world where the maximum
property key/value lengths change.

Bug: http://b/23102347
Test: libbase_test64
Change-Id: I100f00904221bbcef9e8786a4e6e30428039bb49
2016-09-23 15:30:22 -07:00
David Pursell
2ebce7384b Flattenable: switch from assignment to memcpy().
FlattenableUtils read() and write() currently use assignment to copy
bytes. However, by casting the void* buffer to type T, the compiler is
allowed to assume that buffer obeys the alignment requirements of T,
which is not necessarily the case during serialization. On some
architectures, we can get SIGBUS when this alignment is violated.

We don't want the users of these routines to have to worry about
alignment when packing structures, so use memcpy() instead which should
always be safe since the compiler won't assume any alignment for the
void* buffer.

On architectures that can handle unaligned direct read/write of type T,
the compiler should be smart enough to optimize this code back to a
direct read/write anyway, but architectures that can't handle it will
fall back to memcpy; this means that this change shouldn't have any
impact on current Android devices. See the linked bug for more details.

Bug: http://b/31671510
Test: libgui Sensor serialization no longer gives SIGBUS.
Test: libgui.so unchanged on Shamu before and after this CL.
Change-Id: I2197127e8cbfb43f4f553bda6464f6ebe087febd
2016-09-23 13:56:40 -07:00
Treehugger Robot
4b5abcdba2 Merge "Move android_get_control_socket out of line" 2016-09-23 20:49:19 +00:00
Andreas Gampe
19ff8f1e57 Base: Check severity in destructor
Bug: 31338270
Test: m
Test: mmma system/core/base && $ANDROID_HOST_OUT/nativetest64/libbase_test/libbase_test64
Change-Id: Ic077822bcfd591bd11f4fa9d4b6e440b461c70c1
2016-09-23 13:31:52 -07:00
Colin Cross
e8ffa449fd Move android_get_control_socket out of line
android_get_control_socket has a warning from the implicit cast from
long to int.  The warning was being hidden because cutils/sockets.h was
included with -isystem.  Move android_get_control_socket to sockets.cpp,
since we don't want header only dependencies anyways, and fix the
warning with a range check and a static_cast.

Bug: 31492149
Test: m -j <module that uses sockets.h and -Wall>
Change-Id: I1f394ab26d4ec8a7dd0e7907c10416d7f8647624
2016-09-23 11:26:08 -07:00
Treehugger Robot
6fc7eaaad0 Merge "Give wifi_hal_legacy access to netlink" 2016-09-23 16:27:41 +00:00
Treehugger Robot
58af713d8a Merge "Base: Add more log macros" 2016-09-22 23:56:48 +00:00
Treehugger Robot
65a1633ec3 Merge "Fix warnings in libutils headers" 2016-09-22 21:24:49 +00:00
Colin Cross
17b5b82d64 Fix warnings in libutils headers
system/core/include is included in the global include path using
-isystem, which hides all warnings.  Fix warnings in libutils
headers in preparation for moving from -isystem to -I.

- Fix implicit cast from int64_t to long in Condition.h.  Remove
  the __LP64__ check and always compare against LONG_MAX before
  casting.
- Fix implicit cast from size_t to ssize_t in KeyedVector.h
- Fix -Wshadow-field-in-constructor warnings in Looper.h and RefBase.h
- Move destructors for MessageHandler and LooperCallback to Looper.cpp
  and ReferenceRenamer and VirtualLightRefBase to RefBase.cpp to prevent
  vtables in every compilation unit.
- Declare template variables in Singleton.h
- Fix old-style casts in StrongPointer.h and TypeHelpers.h
- Use template metaprogramming in TypeHelpers.h to avoid warnings on
  memmove on non-trivial types.
- Add an assignment operator to key_value_pair_t to complete
  rule-of-three
- Use memcpy instead of dereferencing a reinterpret_casted pointer to
  treat the bits of a float or double as int32_t or int64_t
- Escape unicode sequences inside doxygen comments between \code and
  \endcode
- Remove WIN32 ZD definition in Compat.h, %zd works fine with mingw
- Fix WIN32 printf warnings in Filemap.cpp
- Initialize mNullValue with 0 in LruCache.h, some of the tests use a
  non-pointer type for TValue.

Test: m -j native
Bug: 31492149
Change-Id: I385a05a3ca01258e44fe3b37ef77e4aaff547b26
2016-09-22 13:03:15 -07:00
Andreas Gampe
436f5a031f Base: Add more log macros
Add WOULD_LOG to determine whether a given severity would be logged.

Add LOG_STREAM to have direct access to a logging stream.

Add LOG_S variants that take a fully qualified severity. This allows
complex expressions as parameters, e.g., ternaries for conditional
severity levels.

Add tests.

Bug: 31338270
Test: m
Test: mmma system/core/base && $ANDROID_HOST_OUT/nativetest64/libbase_test/libbase_test64
Change-Id: I242b960594e68caff6db9cd8aaa4ce8aaf90474c
2016-09-22 12:47:40 -07:00
Colin Cross
588b3b0c03 Merge "Remove has_trivial_move trait from Vector<T>" 2016-09-22 19:44:28 +00:00
Colin Cross
097395532b Remove has_trivial_move trait from Vector<T>
Vector<T> objects are a dynamic type with a vtable, which is not
trivially moveable.

Impact on aapt for frameworks-res is negligible, ~3%.

Bug: 31595853
Test: m -j framework-res
Change-Id: I8a3269c35d95affb6e86d60588bcfca46db7f445
2016-09-22 10:14:05 -07:00
Treehugger Robot
53171e5f97 Merge "We should break from loop after getting connected." 2016-09-22 06:41:49 +00:00
Treehugger Robot
3562fd0fa8 Merge "Ignore setsid error in some cases." 2016-09-22 06:28:51 +00:00
Treehugger Robot
55123dfa39 Merge "Add missing include." 2016-09-22 05:40:11 +00:00
Treehugger Robot
d7f60fd871 Merge "Fix warnings in system/ headers" 2016-09-22 02:46:51 +00:00
Tao Wu
9b7341fe57 We should break from loop after getting connected.
Now it always connects to multiple address of same host and just
return one socket while other sockets get leaked.

Also, it cause trouble on machine with dual stack.
adb connect localhost:* just connect to IPv4 and IPv6 at same time
and finally it doesn't work since emulator can only handle one adb
connection.

To test this, start an emulator with non-standar port and killall adb
daemon on linux work station and then do following test.

Test: adb connect localhost:12345;lsof -n -p `pgrep adb`
Change-Id: I1e0f6824efc1db8e179377de068e3b5535aff3f7
2016-09-21 19:45:54 -07:00