path: root/include
AgeCommit message (Collapse)Author
2016-05-23Fix SharedBuffer. Remove aref.Hans Boehm
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 3e4c076ef204c4b572d02bd1c8dbf8c599e0014d)
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-18Remove a dead header (<netutils/dhcp.h>).Elliott Hughes
9c07eb9dd83a4b62a24836cc82a0ab5e7ae08f7d removed the implementation, but missed the header file. Bug: http://b/27192644 Change-Id: I809a3eb0081b05783b70dbca0274cdde6b1b31a6
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-08Merge "Move canned_fs_config into libcutils" into nyc-devMohamad Ayyash
2016-04-07Move canned_fs_config into libcutilsMohamad Ayyash
It's no longer specific to make_ext4fs, will be used for mksquashfs as well. BUG: 27467028 Change-Id: I41b8c2b168ada45c8378dee522391edfb8f6b9a6 Signed-off-by: Mohamad Ayyash <>
2016-04-07Merge "graphics.h: Add android_hdr_t" into nyc-devDan Stoza
2016-04-06graphics.h: Add android_hdr_tDan Stoza
Adds android_hdr_t, which specifies different types of high dynamic range encodings to be used throughout the system. Bug: 25684127 Change-Id: Ic92bb5dc64494e643b828a8e24af8760e74e2360
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-28Merge "Rename single buffer mode to shared buffer mode" into nyc-devPablo Ceballos
2016-03-24graphics.h: Add android_color_transform_tDan Stoza
Adds android_color_transform_t, which specifies a range of color transforms which may be applied to the whole display. Bug: 22767098 Change-Id: Iaf03915c09ac0bdd18512b5f78c39da1705bda08
2016-03-22liblog: add __android_log_pmsg_file_readMark Salyzyn
(cherry pick from commit 864e8e80e4f6b325ddacc25b0bd5d621eff0fb3a) - This is considered an Android Private function, not exported for general use. - goal is to retreive a file's content from a series of log messages from pmsg, to be retrieved after a reboot for transfer to a persistent location. - files are presented in reverse sorted order, first based on _any_ numerical content, then by alphanumeric order. - Add a gTest for this function, relies on gTest for liblog.__android_log_pmsg_file_write from prior to reboot. Bug: 27176738 Change-Id: If37ef423009bd28b598b233af3bccef3429bdc22
2016-03-22liblog: add __android_log_pmsg_file_writeMark Salyzyn
(cherry pick from commit d4b061bde280fce9b5426b5738a02d42ec263c48) - This is considered an Android Private function, not exported for general use. - goal is to record a file's content into a series of log messages into pmsg, to be retrieved after a reboot for transfer to a persistent location. - filename reference is converted to a tag-unique "<dirbase>:<filebase>". - buffer and length representing the filename contents are recorded, along with a sequence number placed into the nsec time field to ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE. - Add a gTest for this function. Bug: 27176738 Change-Id: If93df3ae8bfc1bb75516d4a1fd8dae0301af644b
2016-03-17Rename single buffer mode to shared buffer modePablo Ceballos
Change-Id: If5d45b2955d1219687c624395799b81e432dcfcc
2016-03-12system/core: Make Thread::run threadName argument requiredBrian Carlstrom
Bug: 27557176 Change-Id: Iae83a1e5489c86c2858fc8481f246b8480f0eec4
2016-03-10Add error reporting mechanism for failing Unwind.Christopher Ferris
Remove the logging of an error if a thread disappears before the unwind can begin. This can happen, so allow the caller to determine if this is really a problem worth logging. Bug: 27449879 (cherry picked from commit 206a3b9798e3622c906a3cafdb113c271c1c927c) Change-Id: If9e7cfeb6eb7b122679a734c1a9eacee8354ef18
2016-03-09libziparchive: ensure ReadAtOffset is atomicAdam Lesinski
ag/880725 modified ReadAtOffset to seek then read from the open file descriptor. Previously pread64 was used to provide atomic behaviour. This causes races when multiple threads are trying to access data from the file. This is supported, so this change reverts the relevant parts of the above CL to restore the old behaviour. Bug:27563413 Change-Id: I7bffd78da8c558745dfc3c072ba9691b1b15bb5b
2016-02-26Merge "Fix windows 64-bit builds" into nyc-devStephen Hines
2016-02-26Merge "keep legacy HAL_DATASPACE enums unchanged" into nyc-devLajos Molnar
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
2016-02-25liblog: add android_log_write_string8_lenMark Salyzyn
(cherry pick from commit 67d7eafd56010f154137e4316e938f802b2b0732) 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-24keep legacy HAL_DATASPACE enums unchangedLajos Molnar
Bug: 25975353 Change-Id: I092b568420aa605425c12de9b245bca7ed602f43
2016-02-23Merge "Move libnativeloader headers into libnativeloader." into nyc-devDimitry Ivanov
2016-02-23liblog: event log list logging handlerMark Salyzyn
(cherry pick from commit bd1ad049b2494c70f671dbd6a0566f30dc420d1a) Based off an initial request and effort by - Added the following functions: * Composing and Writing: android_log_context create_android_logger(uint32_t tag) int android_log_write_list_begin(android_log_context ctx) int android_log_write_list_end(android_log_context ctx) int android_log_write_int32(android_log_context ctx, int32_t value) int android_log_write_int64(android_log_context ctx, int64_t value) int android_log_write_string8(android_log_context ctx, const char *value) int android_log_write_float32(android_log_context ctx, float value) int android_log_write_list(android_log_context ctx, log_id_t id) * Reading and Interpreting: android_log_context create_android_log_parser(const char *msg, size_t len) android_log_list_element android_log_read_next(android_log_context ctx) android_log_list_element android_log_peek_next(android_log_context ctx) * Destroy context used above: int android_log_destroy(android_log_context *ctx); - Added unit gTests We moved implemented android_log_buffer_to_string() to the test since it is an alternate for already existing logprint functionality. Please move into liblog should it be of some common use, otherwise as is it is a good means of stessing the reading and interpreting handlers. Signed-off-by: Mark Salyzyn <> Bug: 19235719 Change-Id: I4aa1927e8e6a75f0a129d15a27c891cf1ccd4f5c
2016-02-22Move libnativeloader headers into libnativeloader.Elliott Hughes
Change-Id: I227676276da1b08a84486f29fb0e1502c8dbdf4a (cherry picked from commit e2b4e1e00cc5263ca7c0adbe8f8418f5c98ea5fe)
2016-02-22Merge "Create profiles folders" into nyc-devCalin Juravle
2016-02-20Merge "Add the setAutoRefresh interface in ANativeWindow" into nyc-devPablo Ceballos
2016-02-19Create profiles foldersCalin Juravle
Current profiles (the ones which have not been used for compilation) are stored in /data/misc/profiles/cur/0/pkgname/. Reference profiles (the merged of all user profiles, used for compilation) are stored in /data/misc/profiles/ref/pkgname/. Add a method to get the shared app gid from an uid or appid. Bug: 26719109 Bug: 26563023 Change-Id: I89601d7dbeb3041df882c141a9127dac200a645e
2016-02-09Add the setAutoRefresh interface in ANativeWindowPablo Ceballos
Bug 24940410 Change-Id: I6c0d149c63236f169897c64b21563630fb034338
2016-02-10Expand HAL_DATASPACE to include range, standard and transfer bitfieldsLajos Molnar
Bug: 25975353 Change-Id: Id2668508b523130e5fa3496440d9423682b31632
2016-02-03Merge "graphics: Include stddef.h for size_t."Mattias Nissler
2016-02-03graphics: Include stddef.h for size_t.Mattias Nissler
graphics.h uses size_t, but doesn't pull in a declaration. This results in compile errors if code that includes graphics.h (such as hardware/hardware.h) doesn't happen to have a size_t declaration from elsewhere. Change-Id: I0f3882c3dce20425697d25366d49930b2251ef7f
2016-02-03Merge "libcutils/fastboot: improve multi-buffer write." am: f6f800ef3cDavid Pursell
am: ef0e01c346 * commit 'ef0e01c346b2f60b1941bf3335906de5996785d8': libcutils/fastboot: improve multi-buffer write.
2016-02-03libcutils/fastboot: improve multi-buffer write.David Pursell
Fixes libcutils multi-buffer write interface to be more friendly and hooks into it from the fastboot Socket class. Bug: http://b/26558551 Change-Id: Ibb3a8428fc379755602de52722c1260f9e345bc0
2016-02-02Merge "libcutils: add multi-buffer socket send." am: d95ecfc432David Pursell
am: d56499b21d * commit 'd56499b21d1411a7c799cdad316fb2138db26a7c': libcutils: add multi-buffer socket send.
2016-02-02Merge "libcutils: add socket_get_local_port()." am: d90adbc45bDavid Pursell
am: 9875e6c7e3 * commit '9875e6c7e318fe11a888b6b53c0472f5586410e4': libcutils: add socket_get_local_port().
2016-02-02libcutils: add multi-buffer socket send.David Pursell
Unix and Windows both have functions to write multiple buffers to a socket with a single call but they have very different signatures. This CL creates some cross-platform functions to be able to perform these operations in a uniform way, which will be required for upcoming fastboot functionality. This CL also fixes some inconsistent spacing in the touched files. Bug: http://b/26558551 Change-Id: I8f14d52d3a1de1f3b464267666d6cd3b54263238
2016-02-02libcutils: add socket_get_local_port().David Pursell
Tests that require a local server currently hardcode a test value, which can run into conflicts depending on what's currently running on the machine. This CL adds socket_get_local_port(), which lets us pass 0 so the system picks an open port and we can query which port it chose. Bug: http://b/26236380 Change-Id: I01d1558884e7636081d9a357db6faa86929934f6
2016-02-01Enable top-app cpuset support.Tim Murray
Allows ActivityManager to use the top-app cpuset to grant the currently focused app exclusive access to a CPU core. Change-Id: I45bca5170477e413dec6e5889338399d0859706c
2016-01-28Merge "Name the pixel format and transform enums" am: 53529ecacdDan Stoza
am: 65823b7820 * commit '65823b78207f7636e4d7ad8a4104ed663336c159': Name the pixel format and transform enums
2016-01-28Merge "Name the pixel format and transform enums"Dan Stoza
2016-01-25Restart cameraserverChien-Yu Chen
Bug: 24511454 Change-Id: Ia27f4ef0eb71f891c789f637a21b04afe0b1c4e9
2016-01-25Merge "uid for codec process" am: c7096b5e42Marco Nelissen
am: e40b58328f * commit 'e40b58328f13c19d4954c760f7c7f7f86a8f2aa1': uid for codec process
2016-01-25uid for codec processMarco Nelissen
Change-Id: Iadf8012e6c177bcf487048e1b5a9b4fc51a0aeba
2016-01-22Merge "fastboot: use cutils socket functions." am: bbedd9523fDavid Pursell
am: f0bfaf9503 * commit 'f0bfaf95038241c3f8ed65099c7d532a6c112e86': fastboot: use cutils socket functions.
2016-01-21fastboot: use cutils socket functions.David Pursell
Now that cutils has cross-platform socket functionality, we can restructure fastboot to remove platform-dependent networking code. This CL adds socket_set_receive_timeout() to libcutils and combines the fastboot socket code into a single implementation. It also adds TCP functionality to fastboot sockets, but nothing uses it yet except for the unit tests. A future CL will add the TCP protocol which will use this TCP socket implementation. Bug: http://b/26558551 Change-Id: If613fb348f9332b31fa2c88d67fb1e839923768a
2016-01-21Merge "libcutils: share Windows networking code." am: 1906de1e0fDavid Pursell
am: 7a568dbdd6 * commit '7a568dbdd6c1a39a90c01ab89092cb67a9a86198': libcutils: share Windows networking code.
2016-01-21Merge "libcutils: share Windows networking code."David Pursell
2016-01-19Merge "Allow setting an arbitrary alignment for an entry." am: ad12df20e9Christopher Ferris
am: 5633ccf042 * commit '5633ccf042f76a894fa31fe1579846ac516fa60c': Allow setting an arbitrary alignment for an entry.
2016-01-19Merge "Allow setting an arbitrary alignment for an entry."Christopher Ferris