Commit graph

25572 commits

Author SHA1 Message Date
Andreas Gampe
1160b42e1b Merge "Base: Remove LOG_S variants." am: aa00f5852f am: 8ca0a71c51
am: b98acabcad

Change-Id: Iab564ecfc74e12b4f3a3d2a3271657398b9de1ee
2016-09-26 00:47:07 +00:00
Andreas Gampe
b98acabcad Merge "Base: Remove LOG_S variants." am: aa00f5852f
am: 8ca0a71c51

Change-Id: Idcb11642acb230afe2f509ad75451729249bea86
2016-09-26 00:44:59 +00:00
Andreas Gampe
8ca0a71c51 Merge "Base: Remove LOG_S variants."
am: aa00f5852f

Change-Id: Iac81601db10497ac7416752c25cc4cddb3434756
2016-09-26 00:42:28 +00: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
Elliott Hughes
3226b9f327 Merge "Add std::string system property functions." am: 3f049c3f19 am: 621127a2cb
am: 8fb1552b1f

Change-Id: I2907f254331a8739dcf09152271ceda009875367
2016-09-24 05:04:05 +00:00
Elliott Hughes
8fb1552b1f Merge "Add std::string system property functions." am: 3f049c3f19
am: 621127a2cb

Change-Id: I95ad7284a08d9903bd9712653ad225588ca6fb47
2016-09-24 05:01:56 +00:00
Elliott Hughes
621127a2cb Merge "Add std::string system property functions."
am: 3f049c3f19

Change-Id: Ib8c802c8c4e00e7b601c5eb1e6d64693954f5b94
2016-09-24 04:59:55 +00:00
Treehugger Robot
3f049c3f19 Merge "Add std::string system property functions." 2016-09-24 04:52:59 +00:00
Andreas Gampe
36055f1def Merge "Base: Check severity in destructor" am: 19a7696488 am: 1f03df8155
am: dee214ba77

Change-Id: I47256df073b07427c7ed9ed44c2ccea9853a773c
2016-09-23 23:20:06 +00:00
Andreas Gampe
dee214ba77 Merge "Base: Check severity in destructor" am: 19a7696488
am: 1f03df8155

Change-Id: Ib81ada30737497c41ba20d81b7e52fdf736e1a14
2016-09-23 23:18:50 +00:00
Andreas Gampe
1f03df8155 Merge "Base: Check severity in destructor"
am: 19a7696488

Change-Id: I07f89e907304d754523f9026f857b5c94601b6e3
2016-09-23 23:15:49 +00:00
Treehugger Robot
19a7696488 Merge "Base: Check severity in destructor" 2016-09-23 23:12:09 +00:00
David Pursell
7bc0052ff1 Merge "Flattenable: switch from assignment to memcpy()." am: b2356a6993 am: bb276d8555
am: 9f106bece8

Change-Id: I43e4e5c6bb0aa1fd23a1d0d9776c9e2c8028527e
2016-09-23 22:56:01 +00:00
David Pursell
9f106bece8 Merge "Flattenable: switch from assignment to memcpy()." am: b2356a6993
am: bb276d8555

Change-Id: I2d7317f601dcfc85705f2e71408c314de55a0f69
2016-09-23 22:53:48 +00:00
David Pursell
bb276d8555 Merge "Flattenable: switch from assignment to memcpy()."
am: b2356a6993

Change-Id: I3d4cb834d67693c65e71af6a7c360eb82b31b055
2016-09-23 22:51:49 +00:00
David Pursell
b2356a6993 Merge "Flattenable: switch from assignment to memcpy()." 2016-09-23 22:46:03 +00: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
Colin Cross
8e3427fb04 Merge "Move android_get_control_socket out of line" am: 4b5abcdba2 am: 4873829953
am: ea2b61c7a8

Change-Id: Ib406546b998d6d525829f0023a5f693c2e1dfd6c
2016-09-23 21:00:41 +00:00
Colin Cross
ea2b61c7a8 Merge "Move android_get_control_socket out of line" am: 4b5abcdba2
am: 4873829953

Change-Id: I45e8b86e43a47213664acf486a5de266bab6deb8
2016-09-23 20:58:40 +00: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
Colin Cross
4873829953 Merge "Move android_get_control_socket out of line"
am: 4b5abcdba2

Change-Id: If427dfca41a23d94f2f026edbeb0dc8cd73a4724
2016-09-23 20:56:39 +00: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
Mitchell Wills
a0a91241af Merge "Give wifi_hal_legacy access to netlink" am: 6fc7eaaad0 am: c3d7cb95cc
am: 9fef925542

Change-Id: I3e4439c4a873284d7dce3cab7c564d2c8c2991df
2016-09-23 16:37:01 +00:00
Mitchell Wills
9fef925542 Merge "Give wifi_hal_legacy access to netlink" am: 6fc7eaaad0
am: c3d7cb95cc

Change-Id: Id566bf979c479140de3316e945b43e3212f458cc
2016-09-23 16:35:01 +00:00
Mitchell Wills
c3d7cb95cc Merge "Give wifi_hal_legacy access to netlink"
am: 6fc7eaaad0

Change-Id: Ia3a6d48dab8123a5dc4e42d4b0d271d2e2c880e2
2016-09-23 16:32:57 +00:00
Treehugger Robot
6fc7eaaad0 Merge "Give wifi_hal_legacy access to netlink" 2016-09-23 16:27:41 +00:00
Andreas Gampe
9ce7b8f21b Merge "Base: Add more log macros" am: 58af713d8a am: 9148006e85
am: 4939e19354

Change-Id: Iafa634da74d64c8099425201b15d5dbb90434507
2016-09-23 00:15:45 +00:00
Andreas Gampe
4939e19354 Merge "Base: Add more log macros" am: 58af713d8a
am: 9148006e85

Change-Id: Ib18375fd6bef00321b5ee7b2e866554b389ffa58
2016-09-23 00:03:26 +00:00
Andreas Gampe
9148006e85 Merge "Base: Add more log macros"
am: 58af713d8a

Change-Id: Ia8a446e8e2609f2d7e31bcfb1eec83fc82bbeebb
2016-09-22 23:59:10 +00:00
Treehugger Robot
58af713d8a Merge "Base: Add more log macros" 2016-09-22 23:56:48 +00:00
Colin Cross
28cda0bf38 Merge "Fix warnings in libutils headers" am: 65a1633ec3 am: 0f79b62bf6
am: 1446cbac58

Change-Id: I94a39bb24224218ef1c48080ace3455c1fc7233a
2016-09-22 23:04:13 +00:00
Colin Cross
021899fa8a Merge "Remove has_trivial_move trait from Vector<T>" am: 588b3b0c03 am: 85942090f6
am: 749181c10b

Change-Id: Ie339e0ea27463d0c5b093e9a5e262367d1ca57a5
2016-09-22 22:58:13 +00:00
Tao Wu
485153bf44 Merge "We should break from loop after getting connected." am: 53171e5f97 am: 646a70b1fb
am: 298571ec19

Change-Id: I16093f42b297abdd94e97cd26219d86d4a465f09
2016-09-22 22:53:25 +00:00
Tao Wu
0e0cf74c52 Merge "Ignore setsid error in some cases." am: 3562fd0fa8 am: 324acdce69
am: f7756b89e9

Change-Id: I7bc3c1f46fec39fb8fd2fe597633b067ad0a8bda
2016-09-22 22:53:08 +00:00
Dan Albert
eb95b1ecca Merge "Add missing include." am: 55123dfa39 am: a8b88e1de7
am: 6f6d2eea16

Change-Id: I498d31c4bb52cd1fba606805000c4bd128708fba
2016-09-22 22:52:57 +00:00
Colin Cross
bd45ba6972 Merge "Fix warnings in system/ headers" am: d7f60fd871 am: 299df0bf01
am: 88fd7e2ec4

Change-Id: I94891ea3c3a00ee39b48531fcc8e5e3d6ebe724a
2016-09-22 22:52:44 +00:00
Josh Gao
6d317aca93 Merge "adb: kill adb_mutex_t, adb_cond_t." am: 7e4d1db957 am: 72c679d6d0
am: 71970fc473

Change-Id: I77f0221da27abb337ce7d8896cd6ad94c04548cf
2016-09-22 22:52:16 +00:00
Colin Cross
1446cbac58 Merge "Fix warnings in libutils headers" am: 65a1633ec3
am: 0f79b62bf6

Change-Id: I62fea8f4ed3f2a9d16d68539eb073965531944da
2016-09-22 22:51:15 +00:00
Ajay Panicker
531b201eb6 Merge "Remove net_bt_stack group and replace it with bluetooth" am: 7875407bb7 am: f924c252bd
am: b0db9714bb

Change-Id: I025c5301fecf0566d8184efce099a195fdbfc460
2016-09-22 21:58:27 +00:00
Colin Cross
0f79b62bf6 Merge "Fix warnings in libutils headers"
am: 65a1633ec3

Change-Id: I65b7448a5aeaa868e40dfdda2b7cd8a6eb54a9e2
2016-09-22 21:55:34 +00:00
Treehugger Robot
65a1633ec3 Merge "Fix warnings in libutils headers" 2016-09-22 21:24:49 +00:00
Colin Cross
749181c10b Merge "Remove has_trivial_move trait from Vector<T>" am: 588b3b0c03
am: 85942090f6

Change-Id: Ic41410047760bff11063d12839921ae008fe7e65
2016-09-22 20:33:40 +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
Colin Cross
85942090f6 Merge "Remove has_trivial_move trait from Vector<T>"
am: 588b3b0c03

Change-Id: I0af14f7684649780f2f98c4cd613d8b946e80466
2016-09-22 19:57:04 +00: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