path: root/include/utils
AgeCommit message (Collapse)Author
2016-05-19Fix memory order and race bugs in Refbase.h & RefBase.cppHans Boehm
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 e263e6c6337a24d56dc803792206e54981ad53a5)
2016-05-09Add String16#contains and strstr16 methods.Michael Wright
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-04-05Mutex: Note that STL is generally preferedGreg Kaiser
This class was designed prior to Android having usable C++11 support. With that support now in place, we prefer people to start using the STL threading classes, unless the code needs to build on Win32. Change-Id: If1b4d9bdfcb1e65824909376f022842bab9653d6
2016-03-12system/core: Make Thread::run threadName argument requiredBrian Carlstrom
Bug: 27557176 Change-Id: Iae83a1e5489c86c2858fc8481f246b8480f0eec4
2016-02-25Fix windows 64-bit buildsDan Willemsen
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 86cf941c480de8d5693a24d3feb45574f5c89a86) Change-Id: I8d39d1951fea1b3011caf585c983e1da7959f7c0
2015-11-20libutils: fix cache removal when callback invalidates the keySergio Giro
Bug: 24785286 Change-Id: I9d17d2247258a56ef7776b3a701389e825a9c533
2015-11-10libutils: Add UNEXPECTED_NULL status_tChristopher Wiley
We use this specifically in situations where we expect to read an object from a Parcel, but fail because the object is null. Bug: 25617251 Change-Id: Id0b6118b19a932998b5028e30dc15d70e4d7f9c3
2015-11-05Use std::unique_ptr instead of UniquePtr.Dan Albert
Bug: http://b/22403888 Change-Id: I398fa43b8f33c9281d7ff238521d75f1dcb8a5e7
2015-10-29Teach sp<> how to std::moveJohn Reck
Arguably we should migrate to std::shared_ptr but for now make std::vector<sp<>> a bit less horrible Change-Id: Ia458a2daff0b656b2f3310b3ea100565ec844c69
2015-10-12system/core: fix iterator for LruCacheSergio Giro
Was failing to return the first element Change-Id: Ic803f5d463a56519212014d0d190407cf4b859cf
2015-10-02am c6c6ab50: Merge "Implement C++11 move semantics for android::FileMap"Adam Lesinski
* commit 'c6c6ab50bc11d55f3135312ceccbcf0c400b437e': Implement C++11 move semantics for android::FileMap
2015-10-01Implement C++11 move semantics for android::FileMapAdam Lesinski
FileMaps should be movable, thereby not requiring them to be only used with a unique_ptr as they currently are. Change-Id: I0fb8013bf398a2ced5420d85ba888c2a7fc5a496
2015-10-01resolved conflicts for 70808827 to stage-aosp-masterSergio Giro
Change-Id: I2de8a63fa5be5423846df4c2e8ccc5f12e843f09
2015-10-01system/core: remove BasicHashtableSergio Giro
Towards deprecation of SharedBuffer Change-Id: Id6d1c8637583df38b6f28398b6804d9c1e96472a
2015-09-30am e0453334: Merge "system/core: remove methods returning SharedBuffer in ↵Sergio Giro
String8, String16" * commit 'e045333445ab3ebb8d602d25ed750169f135baa6': system/core: remove methods returning SharedBuffer in String8, String16
2015-09-30Merge "system/core: remove methods returning SharedBuffer in String8, String16"Sergio Giro
2015-09-30system/core: remove methods returning SharedBuffer in String8, String16Sergio Giro
Towards deprecation of SharedBuffer Change-Id: I3069837db32837bcc0f5d8f1118ccd502c9070dc
2015-09-30am 730fdbb1: Merge "system/core: change LruCache to use unordered_set ↵Sergio Giro
instead of BasicHashTable" * commit '730fdbb1ca4c39a4d69868f7a261b023f2bea296': system/core: change LruCache to use unordered_set instead of BasicHashTable
2015-09-30Merge "system/core: change LruCache to use unordered_set instead of ↵Sergio Giro
2015-09-30system/core: change LruCache to use unordered_set instead of BasicHashTableSergio Giro
Towards deprecation of BasicHashTable Change-Id: I3f3d904636a85a794cccf972f6e4a94e7f3808f5
2015-09-28am eccf0a45: Merge "utils: add pwrite64 to Compat.h for Mac"Sami Tolvanen
* commit 'eccf0a4502293d628152888be85d1cd6fa0b4751': utils: add pwrite64 to Compat.h for Mac
2015-09-28utils: add pwrite64 to Compat.h for MacSami Tolvanen
Compat.h has lseek64 and pread64, but it's missing pwrite64. Change-Id: I02b4adf5a5e15e55e008ff1ba8113a75faf1c4e9
2015-09-23resolved conflicts for 6ee734cf to stage-aosp-masterSergio Giro
Change-Id: Ia06c4d941d9b8828707299bb363f51fab5549897
2015-09-23libutils: hide SharedBuffer by moving SharedBuffer.h to the implementation ↵Sergio Giro
directory Some methods in header files of classes using SharedBuffer need to be moved to the implementation files accordingly Change-Id: I891f3ace2b940ab219e4e449040bfed71c0547db
2015-08-24am 4f0a7cb8: am 786e5e26: Merge "libutils: cleanups for -fsanitize=integer"Nick Kralevich
* commit '4f0a7cb8e15ce50f7da6a71c96335bd0b7394492': libutils: cleanups for -fsanitize=integer
2015-08-24libutils: cleanups for -fsanitize=integerNick Kralevich
* Hashing functions rely on integer overflow behavior. Mark those functions as safe. * abort() if a passed in size_t value is greater than UINT32_MAX. This can occur on 64 bit builds where size_t is larger than uint32_t. * Special case the index lookup for an empty sorted vector. Without the special case, size() == 0, and size()-1 underflows. Change-Id: I343a14b589fc8f0d221c1998ae5d6f0b9e2781f8
2015-08-19am 8c86e4e2: am d0cae5b9: Merge "Remove a HAVE_MS_C_RUNTIME I missed."Elliott Hughes
* commit '8c86e4e2c075c7a879a9f73b56ab075dde61176a': Remove a HAVE_MS_C_RUNTIME I missed.
2015-08-18Remove a HAVE_MS_C_RUNTIME I missed.Elliott Hughes
Change-Id: I063c6c802b8967d812d4f4a0972f00b0a88704af
2015-08-17am 8025096e: am 28595721: Merge "Replace HAVE_MS_C_RUNTIME with _WIN32 in ↵Elliott Hughes
system/core." * commit '8025096e2e523d6d03a35b19471793f85e03ec1a': Replace HAVE_MS_C_RUNTIME with _WIN32 in system/core.
2015-08-17Replace HAVE_MS_C_RUNTIME with _WIN32 in system/core.Elliott Hughes
Change-Id: I202c3185d177c85d02ee5d9f7e5bf3422c1422db
2015-08-06am 802c6fd0: am ff52e23f: Merge "Stop being silly."Elliott Hughes
* commit '802c6fd0900863b576b9d2c1b0b482988f14dd33': Stop being silly.
2015-08-06Stop being silly.Elliott Hughes
Change-Id: I9c18205457396d625502a83e374c1207a3d90b0b
2015-07-30am fb1ecbc5: am e6e71608: Merge "Use __ANDROID__ instead of HAVE_ANDROID_OS."Elliott Hughes
* commit 'fb1ecbc55e7edeafb138eb2a60ca89ba9a7b1f0f': Use __ANDROID__ instead of HAVE_ANDROID_OS.
2015-07-30Merge "Use __ANDROID__ instead of HAVE_ANDROID_OS."Elliott Hughes
2015-07-30Use __ANDROID__ instead of HAVE_ANDROID_OS.Elliott Hughes
Change-Id: I9967f3fd758c2a5b40be5b60ae72be7e2fb75136
2015-07-30am 42dbc4b1: am 44443bea: Merge "Use _WIN32 rather than HAVE_WINSOCK."Elliott Hughes
* commit '42dbc4b1859fe4de16b19e9b74324b345c5fcb9d': Use _WIN32 rather than HAVE_WINSOCK.
2015-07-29Use _WIN32 rather than HAVE_WINSOCK.Elliott Hughes
Change-Id: I9855b6fe72e2f2f3a8360c0993a67cb988024ee4
2015-07-30am 34c92f46: am fc2f1e61: Merge "Move libutils off AndroidConfig.h."Elliott Hughes
* commit '34c92f4652651697a7de7fa10c214afed9a6658a': Move libutils off AndroidConfig.h.
2015-07-29Move libutils off AndroidConfig.h.Elliott Hughes
Change-Id: Ia0e4a4f968c640eb44317821d2dc6b195f9f490e
2015-06-15am cb2d0c5a: am 7015b3be: Merge "TypeHelpers.h: Don\'t underflow unsigned int"Nick Kralevich
* commit 'cb2d0c5aadd2c8e979d696c0bbdc6783067f1c76': TypeHelpers.h: Don't underflow unsigned int
2015-06-13TypeHelpers.h: Don't underflow unsigned intNick Kralevich
When decrementing "n", eventually n will equal zero. When that happens, n-- underflows. This causes a crash when code which uses clang's -fsanitize=unsigned-integer-overflow is run. Avoid trigging an unsigned integer underflow. Change-Id: I9705be6580d61a164ef5fb1ec77e98a69d888438
2015-05-18Adding a build id check to blob cache.Michael Lentine
Add a build id field to the header structure in blob cache. Add build id support with reading and writing the cache. When the cache gets written it writes the build id at the end of the header. When read it checks to see if there is a match between the current version and the version in the cache. If not, it invalidates the cache which would typically only occur during an ota update. Also remove blob cache from the host build. bug: 18262905 Change-Id: I753b1de1986703a4c1c8691b9d2bb533b2546143
2015-04-23Move LinearAlloc to libhwuiJohn Reck
Change-Id: I83a70959ed0dcab2237faaf1dddc02b5eb0363c9
2015-04-21am 97147ef2: am a7d47092: am a75b3de2: Merge "Mark time conversion functions ↵Michael Wright
as constexpr" * commit '97147ef2cd09bef1f348375611905864fa0fd068': Mark time conversion functions as constexpr
2015-04-20Mark time conversion functions as constexprMichael Wright
Change-Id: I753c6975a8e1d78978c31175b2e1868eb374c442
2015-04-03am 6c7c6d04: am 7c194525: am ea975880: Merge "Only Windows doesn\'t have %zd."Elliott Hughes
* commit '6c7c6d0420ca837b81927b2f7c08cd9d92533043': Only Windows doesn't have %zd.
2015-04-03Only Windows doesn't have %zd.Elliott Hughes
Change-Id: Ie09619df212cf7c8aa18a6d46c3e6b6ca3f478cf
2015-03-27Use eventfd instead of pipe in Looper.Tim Kilbourn
Bug: 19933224 Change-Id: I6611e918db960bbb0e74f8308e10bdf79510b899
2015-03-27am 1188a4d8: am a596623f: am 6ccfabcf: Merge "O_CLOEXEC is O_NOINHERIT on ↵Dan Albert
Windows." * commit '1188a4d856f6c840a2d39c44e35ba3f3cd86b3a5': O_CLOEXEC is O_NOINHERIT on Windows.
2015-03-26O_CLOEXEC is O_NOINHERIT on Windows.Dan Albert
Change-Id: I714aa08344fa10684c99651f953834086cc162c7