Commit graph

468 commits

Author SHA1 Message Date
Vishwath Mohan
fc3f57acbb Formatting changes for TypeHelpers.h and Vectors.h
This CL nukes all spurious whitespace in the two files.

Bug: 36219323
Test: Device builds and boots.
Test: All 98 libutils_tests pass
Change-Id: I8054a0f0ba5df95f5115dc06597eb9fd539da942
2017-03-15 22:48:27 -07:00
Dan Willemsen
5dfa912f03 Merge "Enable more modules on linux_bionic builds" am: 75c414d1a3 am: 5bb9220b75
am: 5e30ce0ca0

Change-Id: I8d1ba8749e9c0e6433236b42bda7da5188e5f810
2017-03-16 02:40:00 +00:00
Dan Willemsen
e0cd1e043d Enable more modules on linux_bionic builds
Bug: 31559095
Test: Enable host bionic, run soong
Change-Id: Ib4ebd909322cf464b6a40040e4b60ece7d905b6f
2017-03-15 15:44:00 -07:00
Mathias Agopian
f520b73103 Get rid of LinearTransform
It had 3 clients
- one in vendor/google_athome which was disabled
- one in a device specific folder, which will die out
- and one in frameworks/base

This reverts commit 6c942304ed.

Test: compile/run
Bug: treble cleanup

Change-Id: Ia76009d550c294198c083cf89718bc498b5c9e3e
2017-03-15 14:16:13 -07:00
Ian Pedowitz
6c942304ed Revert "get rid of LinearTransform"
This reverts commit bcd592053a.

Bug: 36206160
Test:  Fugu compiles, didn't before the revert
Change-Id: Id80fd4ce9db3fce03b049cf81f938187c7ddb8b0
2017-03-14 08:11:41 +00:00
Mathias Agopian
bcd592053a get rid of LinearTransform
it had a single client in frameworks/base

Test: compile & run
Bug: treble cleanup
Change-Id: I9a17bbffed4724f8a329c5a15d621293bb800d45
2017-03-13 12:27:35 -07:00
Steven Moreland
aa47993b23 Merge "libutils: String\d+ make std_string private" am: 76850afa52 am: 2ebb1e5404
am: 4ba3f784ef

Change-Id: I14f003992db222ef285551c6d9a8ffe71620f70d
2017-03-11 09:07:23 +00:00
Steven Moreland
2aac335128 libutils: String\d+ make std_string private
This method is still used by prebuilts, but making it private to start
the process of removing it from everywhere.

Test: pass
Bug: 35363681
Change-Id: I4d53f68d10c9abcca32023c4d930e99912afa697
2017-03-10 22:51:55 -08:00
TreeHugger Robot
decccc2e8f Merge "Remove BlobCAche from libutils" 2017-03-11 01:32:47 +00:00
Mathias Agopian
f088e4e238 Remove BlobCAche from libutils
it has moved to libEGL which was the only client.


Test: compiled & Run
Bug: vndk-stable
Change-Id: Ife18727fa1c48b1be6910058867016348b7f02c1
2017-03-10 12:27:46 -08:00
Steven Moreland
d21cfab244 Add missing includes.
Includes are transitively imported by <string> in String8.h + String16.h
but that include is being removed.

Test: pass
Change-Id: Ide5c011b40b4a4f031dd26ead08b5c8d5d299693
2017-03-10 09:05:30 -08:00
Tom Cherry
101573e3f5 Merge "Clarify that Condition::wait() can spuriously wake up" am: 514e0aa2e2 am: 675e05c48a
am: df8fc09716

Change-Id: Id99d721415d93b2d3f0539bf5a2acb1995f01000
2017-03-06 20:06:03 +00:00
Tom Cherry
514e0aa2e2 Merge "Clarify that Condition::wait() can spuriously wake up" 2017-03-06 19:26:30 +00:00
Mathias Agopian
22dbf3947f clean-up libutils includes
moved Foo.h as first include of Foo.cpp, and
removed redundant includes.

Made NativeHandle non virtual.


Test: run & compile
Bug: n/a

Change-Id: I37fa746cd42c9ba23aba181f84cb6c619386406a
2017-03-03 14:47:47 -08:00
Tom Cherry
f1147f7dde Clarify that Condition::wait() can spuriously wake up
Also, remove the clarification that Condition::signal() wakes exactly
one thread as in the presence of spurious wake ups, this clarification
does not provide a safe guarantee to developers.

Bug: 34592766
Test: Build
Change-Id: I34df02e44a70a18fe04ceda858d002ef129c1fd9
2017-03-02 12:36:45 -08:00
Colin Cross
a4ca06b3b3 Merge changes I975ba933,Ica9d211b am: a9ef4dc7a2 am: 9ece9401a4
am: f695f6e842

Change-Id: I570c55be7a7cf3ad44e32717040689a68f67ada2
2017-02-28 20:37:29 +00:00
Colin Cross
a0931ebd64 Add tests for multiton issue
Test accessing a singleton from two libraries, the second of which
depends on the first but is dlopen'd after the first is already
loaded.

Bug: 35674422
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: I975ba933a19b941a52bdb6e9c221a6910ffb8081
2017-02-28 16:34:35 +00:00
Colin Cross
62a6b16c4b Merge "Make libutils test compile on the host" am: f5fd4888ce am: a05a666c01
am: 3bc7d607d4

Change-Id: I00ac6f6871d925c805953eff0fa0c918cee3600a
2017-02-24 21:25:24 +00:00
Colin Cross
155c983ad1 Make libutils test compile on the host
Reapply of Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78 with
RefBase_test.cpp and Looper_test.cpp removed from mac builds.

Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Test: out/host/darwin-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: I5979b296a8500b5697d94d64fc441363047adcea
2017-02-24 08:10:06 -08:00
Richard Uhler
2aa94cfaf9 Merge "Revert "Make libutils test compile on the host"" am: 16f4fb9c4e am: 5682e001e9
am: 0d461283ce

Change-Id: I82132fc1e9eda421ed44a65029d389fdde67d5e8
2017-02-24 11:20:20 +00:00
Richard Uhler
16f4fb9c4e Merge "Revert "Make libutils test compile on the host"" 2017-02-24 11:10:43 +00:00
Richard Uhler
26bfee52b3 Revert "Make libutils test compile on the host"
Fails mac build: "system/core/include/utils/Looper.h:25:10: fatal error: 'sys/epoll.h' file not found"

This reverts commit afa891e85e.

Change-Id: Ib558b8f5a303b55ab32a399d338d8aac0fae32b2
2017-02-24 09:36:13 +00:00
Colin Cross
23eff4621f Merge changes Icd5f39ae,I2a4e956c am: 6d795c2883 am: 92466ff6ea
am: 9cb1d219bd

Change-Id: Ic79f7efd0090a940ac1cb7be1e863c2668790bd3
2017-02-24 07:09:41 +00:00
Treehugger Robot
6d795c2883 Merge changes Icd5f39ae,I2a4e956c
* changes:
  Make libutils test compile on the host
  Fix ODR issue in StrongPointer_test.cpp
2017-02-24 06:59:11 +00:00
Colin Cross
afa891e85e Make libutils test compile on the host
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
Change-Id: Icd5f39ae71b57167e9b2fe7ec09c5400bcb90e78
2017-02-23 21:25:19 -08:00
Colin Cross
fe06c63301 Fix ODR issue in StrongPointer_test.cpp
StrongPointer_test.cpp's Foo was colliding with RefBase_test.cpp's
Foo.

Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
      from later CL
Change-Id: I2a4e956c88a07cec72d7ce734cf06c58134a4235
2017-02-23 21:25:18 -08:00
Colin Cross
477b3fc355 Merge "Fix multiton issue" am: 78b285b367 am: 6d7751a13b
am: dafd687617

Change-Id: I7e7369361dda3df0e97169c0d06ce24c57490c7d
2017-02-24 04:12:20 +00:00
Treehugger Robot
78b285b367 Merge "Fix multiton issue" 2017-02-24 04:03:11 +00:00
Colin Cross
b0145091a7 Fix multiton issue
I385a05a3ca01258e44fe3b37ef77e4aaff547b26 broke Singleton in the
same way that 544e3e3606 had already
fixed once.  Fix it again, the next CL will add tests.

This affected cases where two libraries referenced the same singleton,
the one that was supposed to define the singleton was already loaded,
and then the second library was dlopen'd.

Bug: 35674422
Test: out/host/linux-x86/nativetest64/libutils_tests/libutils_tests
      from later CL
Change-Id: I87c64f95ed294a887e67a6c11be3072299789f01
2017-02-23 18:22:46 -08:00
Tom Cherry
917cca2f04 Merge "Make Condition use CLOCK_MONOTONIC" am: 7f932afefc am: 36ba2fbef7
am: 83f76a20a8

Change-Id: I214548f856db2826b7a4ea96a98950fee7d20a27
2017-02-23 22:09:39 +00:00
Tom Cherry
1fb04ff4e5 Make Condition use CLOCK_MONOTONIC
Changes to the REALTIME clock can cause Condition::waitRelative() to
timeout early or delayed.  This behavior is undesired and new since
https://android-review.googlesource.com/#/c/181058/ moved the
underlying pthread_cond_timedwait() implementation to use absolute
timeouts rather than relative ones.  Having Condition use
CLOCK_MONOTONIC prevents these timeout issues.

Bug: 34592766
Bug: 35678943
Test: Boot bullhead
Test: Ensure time changes do not cause Condition::waitRelative() to
timeout early or delayed

Change-Id: I3a8d7a48f9b42fe990c3c7331313b6d85aa546f9
2017-02-23 10:58:05 -08:00
Steven Moreland
870a065800 Merge "Vector.h: remove unused import <new>" am: 1a4e2dfdf5 am: c50fce7dac
am: 4fbff753ba

Change-Id: I8581d836ee94d691f7a7a6b01dd9f7f8017fe093
2017-02-17 23:51:41 +00:00
Treehugger Robot
1a4e2dfdf5 Merge "Vector.h: remove unused import <new>" 2017-02-17 23:37:06 +00:00
Steven Moreland
40c7ddfc09 Vector.h: remove unused import <new>
Test: pass
Change-Id: I9d04c909a1bc82352f1eebe36602bf095ec3ca30
2017-02-17 13:19:08 -08:00
Steven Moreland
cee1918b08 Merge "Remove unused primes.py python file." am: 325eeebc47 am: e9ce5716ce am: 72ff4d5360
am: 374ef9d1c4

Change-Id: I349611742f6ccd8e4be97b1f45b1a316e61469e8
2017-02-17 01:33:00 +00:00
Steven Moreland
16afa6a0f0 Remove unused primes.py python file.
primes.py was used to calculate primes for BasicHashTable which no
longer exists.

Change-Id: I8c6e9b7882bcb8a3832c55249be6db9421d1f771
2017-02-16 14:30:44 -08:00
Steven Moreland
5717abf233 Merge "RefBase.cpp remove unused include typeinfo" am: 141e98474e am: d253899e1e am: 1bc2c960ee
am: 878f0c6bd6

Change-Id: I8230b912145a755c7c36bd4b3f3c26784c35e19a
2017-02-16 05:35:44 +00:00
Steven Moreland
1a055a8957 RefBase.cpp remove unused include typeinfo
Test: pass
Change-Id: Iec9b9e1e9b6c974124b2043f550fb110cc22846d
2017-02-15 19:04:40 -08:00
Elliott Hughes
b7d71b7f16 Merge "Make __android_log_assert behave more like libc asserts." am: 9df286012c am: ad2927d744 am: a7063b8257
am: 5647620cef

Change-Id: Iab197b5798c8754b5b824a8e6a7663ce7e69ef5f
2017-02-07 17:10:03 +00:00
Elliott Hughes
5bae1b866d Make __android_log_assert behave more like libc asserts.
If we don't output to stderr too, not only is it annoying to shell users (who
won't see anything), it prevents us from writing better gtests that actually
make assertions about the assert message.

Bug: http://b/23675822
Test: libutils tests still pass
Change-Id: I62b3144c385cba4dde485f0b0f9b42aeaef51e9a
2017-02-06 10:54:00 -08:00
Vijay Venkatraman
a040114bcb Merge "Exporting C++ headers from system/core" am: 812b7d5d52 am: f484dd3401 am: a252f11da3
am: 5a8f555e49

Change-Id: Id449aadc3b9e6e263d351ce031b1f7f7bb4672b8
2017-01-26 02:03:45 +00:00
Vijay Venkatraman
75acc7bf81 Exporting C++ headers from system/core
Moved headers from include/libutils and include/libsysutils to
libutils/include and libsysutils/include respectively, so they can be
exported via these libs. They needed to be moved since Soong does
not allow export from external folder.

Added symlink from old locations. They are needed since Soong
includes system/core/include by default. Once all modules are
cleaned up to explicitly add the required libs, the symlinks will be
removed.

Moved headers of libutils to libutils_headers. They should be used
by modules for header-only inlines. Added libutils_headers as
dependency of libutils.

Split of C++ headers into those that have no dependency and those that
have dependency on libutils.so will be handled in a later CL.

Test: Add above libs to shared lib of local module
Change-Id: I122db72056b26b1f39bad1d9a0c2a1c5efda3550
2017-01-24 22:51:36 +00:00
Mark Salyzyn
271a1a7cda resolve merge conflicts of a45b1d6f3 to master
Test: compile
Bug: 30465923
Change-Id: I648855539df3cfa176c6ecac19b6a562ba6feaf7
2017-01-11 11:41:38 -08:00
Mark Salyzyn
30f991f251 liblog: use log/log.h when utilizing ALOG macros
Test: compile
Bug: 30465923
Change-Id: Id6d76510819ebd88c3f5003d00d73a0dbe85e943
2017-01-11 09:31:15 -08:00
Dan Willemsen
00ae90ff80 Enable libbase/libutils/libziparchive on host bionic am: ab34b47b35 am: 69b0123549 am: 5bc670c841
am: 55d4de90a6

Change-Id: I11d8cb68123cedddd1450d05bef473037d41d550
2016-11-30 06:22:30 +00:00
Dan Willemsen
ab34b47b35 Enable libbase/libutils/libziparchive on host bionic
Bug: 31559095
Test: Test linux_bionic compile
Change-Id: Ib42c063532c1cbeb3e1418ab16a1fb54d5902aab
2016-11-29 13:38:53 -08:00
Mark Salyzyn
b4c9ab960e Merge "system/core: preparation to pull back interfaces from android/log.h" am: 27d2d49f48 am: 8a7297a09f
am: c561af07ae

Change-Id: I7bfb6dd925739345624a1ed16c0c3cb2106ad098
2016-10-20 18:21:18 +00:00
Mark Salyzyn
cfd5b080af system/core: preparation to pull back interfaces from android/log.h
Point to log/log.h where necessary, define LOG_TAG where necessary.
Accept that private/android_logger.h is suitable replacement for
log/logger.h and android/log.h.

Correct liblog/README

Effectively a cleanup and controlled select revert of
'system/core: drop or replace log/logger.h' and
'system/core: Replace log/log.h with android/log.h'.

Test: compile
Bug: 30465923
Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
2016-10-20 08:11:39 -07:00
Elliott Hughes
c2b3b5fade Merge "Test for _WIN32 in instead of USE_MINGW." am: ec99158580 am: 2e7e065db9 am: 04819403d6
am: c9dc124e2f

Change-Id: I2cfb73fc12da1bb6396bfdd8f638b9ce977f84bc
2016-10-05 18:44:02 +00:00
Elliott Hughes
34a4f0b8c7 Test for _WIN32 in instead of USE_MINGW.
Bug: http://b/23392815
Test: builds
Change-Id: I7fce8de1f0e2314170cce456cd49346dcee9d134
2016-10-05 09:37:44 -07:00
Mark Salyzyn
7a7b066e5e system/core Replace log/log.h with android/log.h am: ff2dcd9af9 am: cac331afd9 am: 0308b0eabd
am: 9f6b98dec0

Change-Id: I1a1384253e4fce0489b7d1aa77b0f67ee12185c3
2016-10-01 00:43:22 +00:00
Mark Salyzyn
4bf372ae30 system/core Replace cutils/log.h with android/log.h am: 66ce3e08c5 am: eb189f147b am: 16f7786032
am: 0abff8fc61

Change-Id: I8c9d221094f0c27838e120aeb41fff276fbab4b2
2016-10-01 00:43:07 +00:00
Mark Salyzyn
ff2dcd9af9 system/core Replace log/log.h with android/log.h
Should use android/log.h instead of log/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-09-30 12:47:05 -07:00
Mark Salyzyn
66ce3e08c5 system/core Replace cutils/log.h with android/log.h
Should use android/log.h instead of cutils/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
2016-09-30 12:47:05 -07:00
Colin Cross
910ab5ec75 Merge "Fix more system/core/include warnings" am: 18fbd80504 am: 5fe194a9fd am: b5ca47989c
am: 0763c30289

Change-Id: I4dcce9ecde9c7f1bf02952a1aafb6407a260d73b
2016-09-29 18:04:35 +00:00
Colin Cross
18fbd80504 Merge "Fix more system/core/include warnings" 2016-09-29 17:20:30 +00:00
Elliott Hughes
929f154c65 Merge "Use readdir instead of readdir_r." am: 833df5cd54 am: 16533c7c0b am: 1456ddd921
am: e96fcf044f

Change-Id: I1cd7b4264b7aaec8deccf4f05614cc817e7da0a6
2016-09-29 17:02:16 +00: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
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
Colin Cross
fd49e46c39 Merge "Fix warnings in libutils headers" am: 65a1633ec3 am: 0f79b62bf6 am: 1446cbac58
am: 28cda0bf38

Change-Id: I1190211b67e0c8d02ed1eb09c6b25401687069dd
2016-09-23 01:17:43 +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
Greg Kaiser
6b85354ec4 Merge "SharedBuffer: Refactor release() logic" 2016-09-13 15:47:08 +00:00
Sergio Giro
1cfa56d46c libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8
Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length
is causing a heap overflow.

Correcting the length computation and adding bound checks to the
conversion functions.

Test: ran libutils_tests
Bug: 29250543
Change-Id: I6115e3357141ed245c63c6eb25fc0fd0a9a7a2bb
(cherry picked from commit c4966a363e)
2016-08-25 20:07:51 +00:00
Sergio Giro
9de6776321 Unicode: specify destination length in utf8_to_utf16 methods
String16(const char *utf8) now returns the empty string in case
a string ends halfway throw a utf8 character.

Bug: 29267949
Clean cherry-pick from 1dcc0c8239

Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
2016-08-25 19:57:06 +00:00
Hans Boehm
a1709d5269 Merge "Make RefBase more robust and debuggable" am: daac359be7 am: 7bf3d21fde am: 7dddf9433c
am: 2d3545fe82

Change-Id: I65537ec0db45b05f96dae43b8f4a91bd4af2d39b
2016-08-25 00:14:54 +00:00
Hans Boehm
7dddf9433c Merge "Make RefBase more robust and debuggable" am: daac359be7
am: 7bf3d21fde

Change-Id: I643c4bd38062b80d382c50ed161f5440f35c1dd9
2016-08-24 23:49:14 +00:00
Hans Boehm
daac359be7 Merge "Make RefBase more robust and debuggable" 2016-08-24 23:36:13 +00:00
John Reck
48c35dbe50 Make wake() error fatal
If wake() fails to write to mWakeEventFd, the looper is
screwed. This is really a fatal, unrecoverable error,
so treat it as such.

This is possibly an explaination for the unexplained
random ANRs

Change-Id: I5af3e013493b475d8e902d8ee6340f331e5d86c8
2016-08-23 09:39:39 -07:00
Hans Boehm
23c857ebd6 Make RefBase more robust and debuggable
This prevents two different kinds of client errors from causing
undetected memory corruption, and helps with the detection of others:

1. We no longer deallocate objects when the weak count goes to zero
and there have been no strong references.  This otherwise causes
us to return a garbage object from a constructor if the constructor
allocates and deallocates a weak pointer to this. And we do know
that clients allocate such weak pointers in constructors and their
lifetime is hard to trace.

2. We abort if a RefBase object is explicitly destroyed while
the weak count is nonzero.  Otherwise a subsequent decrement
would cause a write to potentially reallocated memory.

3. We check counter values returned by atomic decrements for
plausibility, and fail immediately if they are not plausible.

We unconditionally log any cases in which 1 changes behavior
from before. We abort in cases in which 2 changes behavior, since
those reflect clear bugs.
In case 1, a log message now indicates a possible leak. We have
not seen such a message in practice.

The third point introduces a small amount of overhead into the
reference count decrement path. But this should be negligible
compared to the actual decrement cost.

Add a test for promote/attemptIncStrong that tries to check for
both (1) above and concurrent operation of attemptIncStrong.

Add some additional warnings and explanations to the RefBase
documentation.

Bug: 30503444
Bug: 30292291
Bug: 30292538

Change-Id: Ida92b9a2e247f543a948a75d221fbc0038dea66c
2016-08-13 11:17:51 -07:00
Hans Boehm
9fb33735be Merge "Improve RefBase documentation, especially for clients." am: 0f39fe22ae am: df6c464e9a am: f997434b06
am: e725c79831

Change-Id: Idbc29ea28c0a63a35340b052a30b0106f8eae46d
2016-08-10 16:33:00 +00:00
Hans Boehm
f997434b06 Merge "Improve RefBase documentation, especially for clients." am: 0f39fe22ae
am: df6c464e9a

Change-Id: I8fa12835ff648d78c68265facb5b63ca7b1eab6a
2016-08-10 16:26:59 +00:00
Hans Boehm
df6c464e9a Merge "Improve RefBase documentation, especially for clients."
am: 0f39fe22ae

Change-Id: I804989b192142dc9d69ca36f0122079822625e7e
2016-08-10 16:24:01 +00:00
Hans Boehm
0f39fe22ae Merge "Improve RefBase documentation, especially for clients." 2016-08-10 16:16:22 +00:00
Hans Boehm
9ba7192c1f Improve RefBase documentation, especially for clients.
Add basic interface documentation to RefBase.h.

Much, but not all, of this is cut-and-pasted from an email message
from Mathias Agopian. The rest is reconstructed from the code.

Delete some, now redundant, text from Refbase.cpp, and add a bit
more about the implementation strategy.

Some minor fixes to internal comments.

Bug: 30292291
Change-Id: I56518ae5553bc6de0cc2331778e7fcf2e6c4fd87
2016-08-09 15:12:19 -07:00
Greg Kaiser
29e672f9cb Merge "SharedBuffer: Fix bug in return value of release()" am: c064db48f1
am: f068856284

Change-Id: Id210794f288b4cd75438fb7490947a4997d48f31
2016-08-08 18:17:41 +00:00
Greg Kaiser
f068856284 Merge "SharedBuffer: Fix bug in return value of release()"
am: c064db48f1

Change-Id: I401318575ced17a94d19b47b2821ed4c310d9a03
2016-08-08 18:15:44 +00:00
Greg Kaiser
c9b23cbb54 SharedBuffer: Fix bug in return value of release()
Since the equality operator '==' has higher precedence than the
assignment operator '=', we were assigning 'prev' to the result of
our comparison and not the result of mRefs.fetch_sub().

This means that 'prev' would only receive the values 0 or 1.  In
the cases where fetch_sub() returned 0 or 1, we were happening to
get the correct value.  But if fetch_sub() was greator than 1,
we would return to the user 0, instead of the previous reference
count.

We fix this by properly adding parentheses.  We also adjust the
whitespace a little to hopefully make the groupings of the logic
easier to see.

Change-Id: Ib129798a7076854b9ca4f6385c42edbf4fb75e57
2016-08-08 06:55:10 -07:00
Greg Kaiser
476dbc48da SharedBuffer: Refactor release() logic
We refactor this mildly in the hopes of making this a little easier
to follow for future readers.  We also go through the dealloc()
method so if we decide to invoke the SharedBuffer destructor in
the future, we only need to remember it in one place.

In addition, this is slightly more efficient in the multi-owner
case, since we no longer subtract to 0 and then (redundantly) set the
reference count explicitly to 0 as well.

Change-Id: Ifc773bd7900c89c36ac24904b2716f02cb57c095
2016-08-05 17:04:45 -07:00
Greg Kaiser
dd55734dda SharedBuffer: Fix bug in return value of release()
Since the equality operator '==' has higher precedence than the
assignment operator '=', we were assigning 'prev' to the result of
our comparison and not the result of mRefs.fetch_sub().

This means that 'prev' would only receive the values 0 or 1.  In
the cases where fetch_sub() returned 0 or 1, we were happening to
get the correct value.  But if fetch_sub() was greator than 1,
we would return to the user 0, instead of the previous reference
count.

We fix this by properly adding parentheses.  We also adjust the
whitespace a little to hopefully make the groupings of the logic
easier to see.

Change-Id: Ib129798a7076854b9ca4f6385c42edbf4fb75e57
2016-08-05 06:28:10 -07:00
Hans Boehm
9fd3fffb13 Merge "Fix race bug in attemptIncStrong" am: 077135b18c am: 0152d34d1f am: 61b4d9f738
am: 2281f86eb7

Change-Id: I0e5e15912aab68d1791488c3b77152fc157bb7c3
2016-08-04 02:29:58 +00:00
Hans Boehm
61b4d9f738 Merge "Fix race bug in attemptIncStrong" am: 077135b18c
am: 0152d34d1f

Change-Id: I5c51b28714a34a4f854f921146b298df3238d93c
2016-08-04 01:48:05 +00:00
Hans Boehm
0152d34d1f Merge "Fix race bug in attemptIncStrong"
am: 077135b18c

Change-Id: Iaf24710f74e61d3465ea2e0794eda91f0e81d46d
2016-08-04 01:37:25 +00:00
Hans Boehm
077135b18c Merge "Fix race bug in attemptIncStrong" 2016-08-04 01:27:04 +00:00
Sergio Giro
8ee4cc5302 Merge "Unicode: specify destination length in utf8_to_utf16 methods" 2016-08-02 18:48:19 +00:00
Sergio Giro
1dcc0c8239 Unicode: specify destination length in utf8_to_utf16 methods
String16(const char *utf8) now returns the empty string in case
a string ends halfway throw a utf8 character.

Bug: 29267949

Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
2016-08-02 18:47:53 +00:00
Hans Boehm
7f27cbc3f4 Fix race bug in attemptIncStrong
The compensating onLastStrongRef call could be made even when there
was no onIncStrongAttempted call to compensate for.  This
happened in the OBJECT_LIFETIME_STRONG case when e.g. curCount
was initially zero, but was concurrently incremented by another
thread.

I believe the old code was also incorrect in the
curCount = INITIAL_STRONG_VALUE + 1 case,
which seems to be possible under unlikely conditions.
In that case, I believe the compensating call IS needed.
Thus the condition was also changed.

Bug: 30503444
Change-Id: I44bcbcbb1264e4b52b6d3750dc39b041c4140381
2016-07-29 14:39:10 -07:00
Chih-hung Hsieh
e59bc67fa4 Merge \\"Fix google-explicit-constructor warnings in system/core.\\" am: 6dc68cb5f9
am: 89cc78b77f

Change-Id: I71cb106685a21a0cd0e49af76bd457889d0b1f13
2016-07-29 17:04:17 +00:00
Chih-Hung Hsieh
89cc78b77f Merge \"Fix google-explicit-constructor warnings in system/core.\"
am: 6dc68cb5f9

Change-Id: I5a010465364b6e14423b19e8c0f9cffa58ee3152
2016-07-29 17:01:17 +00:00
Chih-Hung Hsieh
034c475931 Fix google-explicit-constructor warnings in system/core.
* Declare explicit conversion constructors.
* Add NOLINT for implicit conversion constructors.
* Fix also some misaligned indendations.

Bug: 28341362
Change-Id: Idf911f35923b408d92285cc1a053f382ba08c63e
Test: build with clang-tidy
2016-07-26 11:26:01 -07:00
Sergio Giro
d20120ae1f Merge \\"LruCache: avoid copying keys in lookup\\" am: 896c6b14ae
am: 4476929073

Change-Id: I3c49a22c68c8a66c912f08e3b7cdd8340de69532
2016-07-20 19:51:07 +00:00
Sergio Giro
4476929073 Merge \"LruCache: avoid copying keys in lookup\"
am: 896c6b14ae

Change-Id: If8223e90988510385378506cd3a05d382ab73fc9
2016-07-20 19:48:44 +00:00
Sergio Giro
4c56e0a222 LruCache: avoid copying keys in lookup
Create objects of type KeyedEntry for lookups that only have
a key reference

Bug: 27567036
Change-Id: I5e609a3db63d3b9277ff1547a3cca37dce70251c
2016-07-20 18:38:44 +00:00
Sergio Giro
71d9f83fa9 Merge \"libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8\" into nyc-dev
am: 757f4ef340

Change-Id: I29dfaa3968597fc3b0cdadd140b5790c1e61008d
2016-07-14 18:08:00 +00:00
Sergio Giro
570dbfb8b8 libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8
Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length
is causing a heap overflow.

Correcting the length computation and adding bound checks to the
conversion functions.

Test: ran libutils_tests
Bug: 29250543
Change-Id: I6115e3357141ed245c63c6eb25fc0fd0a9a7a2bb
(cherry picked from commit c4966a363e)
2016-07-14 13:40:43 +00:00
Hans Boehm
2b67ca305e Merge \"Add test for RefBase etc.\"
am: dc9fbc3440

Change-Id: I77ead7f91c17ee8c5614da783152ac3478fc5342
2016-07-14 00:44:58 +00:00
Hans Boehm
4a8276c779 Add test for RefBase etc.
Add some basic tests for RefBase, as well as a more ambitious memory
ordering test.

Add a README.txt with instructions to run the tests.

Comment out a couple of BlobCache tests that failed consistently and
appeared to be incorrect.  With that fix, I managed to run
libutils_tests successfully on device.

Bug: 28705989
Change-Id: I8ad29995097a149a0cc38615d6ed37117ec6cb5c
2016-07-13 12:03:03 -07:00
Dan Willemsen
8333a913b8 Merge \"libutils: Limit integer sanitize to target only\"
am: fc36f6fab6

Change-Id: I6bab757829cffa84f6bdae3edfa81597567704ce
2016-07-13 08:21:40 +00:00
Dan Willemsen
e16bdb1bd1 libutils: Limit integer sanitize to target only
This matches what the Android.mk defined, and should temporarily fix
builds that were broken with:

system/core/libutils/Unicode.cpp:225:12: runtime error: unsigned integer
overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned
long')

Change-Id: I0363b42fc2d62dfd2d05649c9aa9ef0be573e20a
2016-07-13 00:20:20 -07:00
Colin Cross
2fedbf79bb resolve merge conflicts of 41e82a3 to stage-aosp-master
Change-Id: I5a7faca3249f0c038914540b1dd29edf0084c0e1
2016-07-12 23:53:04 -07:00
Dan Willemsen
2e1591bef9 Convert libbacktrace, libutils to Soong
Change-Id: I8b578f671f92246aca61f98937d75a60b56bc5c6
2016-07-12 17:20:18 -07:00
Hans Boehm
12f788e763 Merge "Fix SharedBuffer. Remove aref." am: 069517574e
am: 1e081a8c5f

* commit '1e081a8c5f2d6e6cb55658bb289db1f0b4f5774a':
  Fix SharedBuffer. Remove aref.

Change-Id: I5849137bb49d727d1c1d245f0f61d11c4ee10859
2016-05-23 22:22:18 +00:00
Hans Boehm
54828dc739 Fix SharedBuffer. Remove aref.
Add comment that SharedBuffer is deprecated.

Both aref and SharedBuffer had memory ordering bugs.  Aref has no
clients.

SharedBuffer had several bugs, which are fixed here:

mRefs was declared neither volatile, not atomic, allowing the
compiler to, for example, reuse a stale previously loaded value.

It used the default android_atomic release memory ordering, which
is insufficient for reference count decrements.

It used an ordinary memory read in onlyOwner() to check whether
an object is safe to deallocate, without any attempt to ensure
memory ordering.

Comments claimed that SharedBuffer was exactly 16 bytes, but
this was neither checked, nor correct on 64-bit platforms.

This turns mRef into a std::atomic and removes the android_atomic
dependency.

Bug: 28826227
Change-Id: I39fa0b4f70ac0471b14ad274806fc4e0c0802e78
(cherry picked from commit 3e4c076ef2)
2016-05-23 15:19:53 -07:00
Hans Boehm
3e4c076ef2 Fix SharedBuffer. Remove aref.
Add comment that SharedBuffer is deprecated.

Both aref and SharedBuffer had memory ordering bugs.  Aref has no
clients.

SharedBuffer had several bugs, which are fixed here:

mRefs was declared neither volatile, not atomic, allowing the
compiler to, for example, reuse a stale previously loaded value.

It used the default android_atomic release memory ordering, which
is insufficient for reference count decrements.

It used an ordinary memory read in onlyOwner() to check whether
an object is safe to deallocate, without any attempt to ensure
memory ordering.

Comments claimed that SharedBuffer was exactly 16 bytes, but
this was neither checked, nor correct on 64-bit platforms.

This turns mRef into a std::atomic and removes the android_atomic
dependency.

Bug: 28826227
Change-Id: I39fa0b4f70ac0471b14ad274806fc4e0c0802e78
2016-05-23 17:28:52 +00:00
Hans Boehm
70a46d674a Fix memory order and race bugs in Refbase.h & RefBase.cpp
Convert to use std::atomic directly.

Consistently use relaxed ordering for increments, release ordering
for decrements, and an added acquire fence when the count goes to
zero.

Fix what looks like another race in attemptIncStrong:
It seems entirely possible that the final adjustment for
INITIAL_STRONG_VALUE would see e.g. INITIAL_STRONG_VALUE + 1,
since we could be running in the middle of another initial
increment.

Attempt to somewhat document what this actually does, and
what's expected from the client. Hide the documentation in
the .cpp file for now.

Remove a confusing redundant test in decWeak. OBJECT_LIFETIME_STRONG
and OBJECT_LIFETIME_WEAK are the only options, in spite of some
of the original comments.

It's conceivable that either of these issues has resulted in
actual crashes, though I would guess the probability is small.
It's hard enough to reason about this code without the bugs.

Bug: 28705989
Change-Id: I4107a56c3fc0fdb7ee17fc8a8f0dd7fb128af9d8
(cherry picked from commit e263e6c633)
2016-05-19 16:18:26 -07:00
Hans Boehm
fdad5af164 Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp" am: 62212954ef
am: d657e639cf

* commit 'd657e639cf74e0ee5a32d0f67efe0097c3df17a1':
  Fix memory order and race bugs in Refbase.h & RefBase.cpp

Change-Id: I79106bb0399e7699d51d526235843504ab52708b
2016-05-19 22:12:01 +00:00
Hans Boehm
62212954ef Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp" 2016-05-19 22:01:41 +00:00
Hans Boehm
e263e6c633 Fix memory order and race bugs in Refbase.h & RefBase.cpp
Convert to use std::atomic directly.

Consistently use relaxed ordering for increments, release ordering
for decrements, and an added acquire fence when the count goes to
zero.

Fix what looks like another race in attemptIncStrong:
It seems entirely possible that the final adjustment for
INITIAL_STRONG_VALUE would see e.g. INITIAL_STRONG_VALUE + 1,
since we could be running in the middle of another initial
increment.

Attempt to somewhat document what this actually does, and
what's expected from the client. Hide the documentation in
the .cpp file for now.

Remove a confusing redundant test in decWeak. OBJECT_LIFETIME_STRONG
and OBJECT_LIFETIME_WEAK are the only options, in spite of some
of the original comments.

It's conceivable that either of these issues has resulted in
actual crashes, though I would guess the probability is small.
It's hard enough to reason about this code without the bugs.

Bug: 28705989
Change-Id: I4107a56c3fc0fdb7ee17fc8a8f0dd7fb128af9d8
2016-05-17 16:11:11 -07:00
Michael Wright
30a1db7045 Merge "Fix strstr16." into nyc-dev
am: a34a383607

* commit 'a34a383607007d632878929c6c9278221242d457':
  Fix strstr16.

Change-Id: I8fa1fab977f974c861cecb8b24b72cd175c27752
2016-05-17 17:28:02 +00:00
Michael Wright
0fd60eb9b4 Fix strstr16.
strcmp needs a limit, otherwise it will compare the null terminator
with the next character in the haystack, which results in the compare
failing for all searches except where the needle is found at the very
end.

Bug: 28663748
Change-Id: I1939dc4037c2f2a75d617943b063d2d38a8c5e3a
2016-05-16 21:23:07 +01:00
Greg Hackmann
1e18e78601 Merge "SystemClock: elapsedRealtimeNano() should use clock_gettime() on Linux" am: e3ff256228
am: 6d28bd81f5

* commit '6d28bd81f55236d1a82f00f8ac568ad61a03128d':
  SystemClock: elapsedRealtimeNano() should use clock_gettime() on Linux

Change-Id: Id5ecad63fb6cd79cc7db641d992e9525bc2b8779
2016-05-16 18:23:42 +00:00
Greg Hackmann
8f9a6372f6 Merge "SystemClock: add test" am: 282e8fb037
am: a91a1a990f

* commit 'a91a1a990f1d629377dcd2c3f2b57ccab48dc8cf':
  SystemClock: add test

Change-Id: I547a4c3422eb468530e3cdd02eb2bb157a444a15
2016-05-16 18:23:41 +00:00
Treehugger Robot
e3ff256228 Merge "SystemClock: elapsedRealtimeNano() should use clock_gettime() on Linux" 2016-05-16 18:18:57 +00:00
Treehugger Robot
282e8fb037 Merge "SystemClock: add test" 2016-05-16 18:18:30 +00:00
Michael Wright
2a9a993af9 Merge commit '8b452b876b90dcfff1dab9012b65b5e67c4531a4' into manual_merge_8b452b8
Change-Id: Iacdc2d521f669661b4979c03b0476512abdb37c7
2016-05-16 15:06:22 +01:00
Michael Wright
5bacef33c9 Add String16#contains and strstr16 methods.
These are needed for aapt to find javadoc comments that contain
"@removed" in order to skip them when printing styleable docs.

Bug: 28663748
Change-Id: I8866d2167c41e11d6c2586da369560d5815fd13e
2016-05-09 19:45:07 +01:00
Greg Hackmann
e94c92cd48 SystemClock: elapsedRealtimeNano() should use clock_gettime() on Linux
We've removed the Android alarm driver from our supported kernels.
clock_gettime(CLOCK_BOOTTIME) has been a viable option since 2.6.39, so
there's no need for the legacy code path anymore.

We can use this on Linux hosts too, since no one should be building
Android on hosts with kernels that old.

Bug: 28357356

Change-Id: I0aa164383c95e77c53d2c85883d83f85d4abc7b1
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-05-02 14:00:02 -07:00
Greg Hackmann
340079df26 SystemClock: add test
Bug: 28357356

Change-Id: Idf66c048bda09cd8cb08adf89ed0edd3770c4e39
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-05-02 13:59:58 -07:00
Chih-hung Hsieh
fb44ca5178 Merge "Fix google-explicit-constructor warnings." am: 7bdd6a8b5a
am: 427d8d840f

* commit '427d8d840f6ec5ce5767b2ee521e4ac5b7ebd619':
  Fix google-explicit-constructor warnings.

Change-Id: I26dc45aca83f991aa7993f6d4233e0439dd44a22
2016-04-30 05:16:35 +00:00
Chih-Hung Hsieh
1c563d96f0 Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I4504e98a8db31e0edcbe63c23f9af43eb13e9d86
2016-04-29 15:44:04 -07:00
Elliott Hughes
7b2d2d6afa Merge "Remove debugging code for a fixed 3.6 kernel bug." am: af61acc
am: 058fd2e

* commit '058fd2edbcea9a6d224a3473fe8fdcb2f7735d37':
  Remove debugging code for a fixed 3.6 kernel bug.

Change-Id: I40ce05d262ab8e718fff4df8df7a41d2d6923e05
2016-04-09 00:31:32 +00:00
Elliott Hughes
ad19af7132 Remove debugging code for a fixed 3.6 kernel bug.
Change-Id: If17d41d6151cd7b81677afc5d341d7aa788170e4
2016-04-04 16:06:53 -07:00
Brian Carlstrom
de6d6041c1 system/core: Make Thread::run threadName argument required
am: e71b914775

* commit 'e71b9147756ab4da306e4c16461ad23936769603':
  system/core: Make Thread::run threadName argument required
2016-03-14 15:24:54 +00:00
Brian Carlstrom
e71b914775 system/core: Make Thread::run threadName argument required
Bug: 27557176
Change-Id: Iae83a1e5489c86c2858fc8481f246b8480f0eec4
2016-03-12 21:32:52 -08:00
George Burgess IV
02f689e11a Merge "Cleanup uses of sprintf so we can deprecate it." am: 2c5b89a64a
am: 3368bdebba

* commit '3368bdebba02316710bafc5bce120eec388365fb':
  Cleanup uses of sprintf so we can deprecate it.
2016-03-08 07:41:39 +00:00
George Burgess IV
e7aa2b2c83 Cleanup uses of sprintf so we can deprecate it.
Also cleans up two instances of open() with useless mode params, and
changes a few uses of snprintf to use sizeof(buffer) instead of
hardcoded buffer sizes.

Change-Id: If11591003d910c995e72ad8f75afd072c255a3c5
2016-03-07 18:40:40 -08:00
James Hawkins
650ba8b8d6 Merge "system/core/lib[c]utils: Fix signedness comparison warnings." am: bba2151b29
am: 65df16b05f

* commit '65df16b05f8d590e1fccc19e9a28833d6a71567d':
  system/core/lib[c]utils: Fix signedness comparison warnings.
2016-03-01 20:32:09 +00:00
James Hawkins
b898075f30 system/core/lib[c]utils: Fix signedness comparison warnings.
* Store the output of a length variable in size_t.
* Annotate unsigned constant values as such.

Bug: 27384813
Change-Id: I8504c0a8f5840d4d42e5c0df797a4e5d02d13eb9
2016-03-01 11:21:53 -08: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
Dimitry Ivanov
ca0c8ce614 Merge "Make libutils symbols protected" into nyc-dev
am: aa2cf3facf

* commit 'aa2cf3facf8d26a3642c90cbf5b83e18934da48c':
  Make libutils symbols protected
2016-02-25 21:10:24 +00:00
Dimitry Ivanov
96ccb85fa2 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
(cherry picked from commit 2c7960c8d9)
2016-02-25 13:09:40 -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
James Hawkins
22b6f7a559 resolve merge conflicts of 0f5d443d0c to nyc-dev-plus-aosp
Change-Id: I850bda0808ae17ade5bc0e667211a599d284d6e3
2016-02-19 11:10:30 -08:00
James Hawkins
bd04bb0d29 Merge "system/core: Cleanup direct calls to opendir by containing in a std::unique_ptr." 2016-02-19 17:49:13 +00:00
Samuel Tan
cf1649da00 Merge "libutils: add String8 and String16 std_string utility methods" am: fb0670d650
am: 941d48f0ee

* commit '941d48f0eeb98fac7c869beee22833ff659318bc':
  libutils: add String8 and String16 std_string utility methods
2016-02-19 04:49:17 +00:00
Samuel Tan
4b2e76966e Merge "libutils: remove whitespace from String8 files" am: e771e846a8
am: 450b9b7068

* commit '450b9b7068cac286ca442c404a90a8a8b57a79e8':
  libutils: remove whitespace from String8 files
2016-02-19 04:49:08 +00:00
Samuel Tan
9ac4e005b4 libutils: add String8 and String16 std_string utility methods
Add utility methods that convert String16 and String8 into
std::string.

Also, remove a repeated include of <utils/Unicode.h> in
String16.h, since it is not used in that header file,
and is already included in String16.cpp.

BUG: 27200800
Change-Id: I5238aeb70689499763060a99dff9950fbb7adb3e
TEST: libutils builds successfully.
2016-02-18 17:04:23 -08:00
Samuel Tan
95fd527065 libutils: remove whitespace from String8 files
Remove trailing whitespace from String8 header and
cpp files.

BUG: None
Change-Id: Ie77da3f0fbce9cdce20225ce1310cf62295179a4
2016-02-18 17:04:20 -08:00
James Hawkins
588a2cad7f system/core: Cleanup direct calls to opendir by containing in a
std::unique_ptr.

Bug: 26643633
Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
2016-02-18 14:52:46 -08:00
Samuel Tan
9518b9db5b Merge "libutils: remove whitespaces in String16.cpp and String16.h"
am: 8c09555aac

* commit '8c09555aac6f00cb7fa7d62cb5c356e2f07a268b':
  libutils: remove whitespaces in String16.cpp and String16.h
2016-02-17 00:38:10 +00:00
Samuel Tan
f9d16ef106 libutils: remove whitespaces in String16.cpp and String16.h
Remove trailing whitespaces in both these files.

BUG: None
Change-Id: I18eca5162871b5b2bf7757a7ef36a4e80073798c
2016-02-16 15:21:34 -08:00
Dan Willemsen
cf1381c834 Merge "Fix windows 64-bit builds"
am: 3f68ba4dc6

* commit '3f68ba4dc67360d4c242110005e36bfe65c66098':
  Fix windows 64-bit builds
2016-02-08 23:59:59 +00:00
Dan Willemsen
86cf941c48 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
Change-Id: I4e43e7cf18a96f22b3a9a08dbab8c3e960c12930
2016-02-05 16:10:10 -08:00
Nick Kralevich
261952e570 Merge "more O_CLOEXEC" am: 920d637d25
am: 890cd99709

* commit '890cd997098795b7a58c1d56c49c23895da7b4f9':
  more O_CLOEXEC
2015-12-18 23:05:34 -08:00
Nick Kralevich
c68c8862f9 more O_CLOEXEC
Change-Id: I330aef8d6f1fc35d6649995ef312954b84dff555
2015-12-18 20:57:25 -08:00
Sergio Giro
43f13d0d68 Merge "libutils: fix cache removal when callback invalidates the key" am: b0df9dca7c am: e483305e47
am: a96cd36afb

* commit 'a96cd36afbff682e24365092dd85bbe9c9165afc':
  libutils: fix cache removal when callback invalidates the key
2015-11-20 17:17:38 +00:00
Sergio Giro
b7170fe3fe libutils: fix cache removal when callback invalidates the key
Bug: 24785286
Change-Id: I9d17d2247258a56ef7776b3a701389e825a9c533
2015-11-20 14:54:51 +00:00
Dan Albert
8f3ef3fd09 Merge "Use std::unique_ptr instead of UniquePtr." am: 0f61f86870 am: 0c69e9f271
am: 40f76c2fed

* commit '40f76c2fedb18664adab73e40b8b64227601d4e6':
  Use std::unique_ptr instead of UniquePtr.
2015-11-05 21:11:03 +00:00
Dan Albert
f2d2509690 Use std::unique_ptr instead of UniquePtr.
Bug: http://b/22403888
Change-Id: I398fa43b8f33c9281d7ff238521d75f1dcb8a5e7
2015-11-05 01:09:22 -08:00
John Reck
dc7694eac5 Merge "Teach sp<> how to std::move" am: 518d043c86 am: bb12b91ae1
am: a573d6b186

* commit 'a573d6b18686266667c8efd9d7291ecd28efa67c':
  Teach sp<> how to std::move
2015-11-03 00:14:15 +00:00
John Reck
bb12b91ae1 Merge "Teach sp<> how to std::move"
am: 518d043c86

* commit '518d043c8693835061b02ecbbee4b82fc61a776e':
  Teach sp<> how to std::move
2015-11-02 21:39:24 +00:00