- 13 Jul, 2015 1 commit
-
-
Arman Uguray authored
This CL adds GN build files for libchrome, which is the ChromeOS/Brillo library for many C++ tools, include libbase. I added a new GN build target for "base" under secondary sources with a GN build file for libchrome which currently lives in platform/external/libchrome in AOSP. To build, clone libchrome into third_party/libchrome and remove third_party/libchrome/base/BUILD.gn. Also clone external/modp_b64 into third_party/modp_b64. Eventually I will have scripts set up to do this automatically. This means that we can start developing against libbase while running GN builds on Goobuntu but this would break the tree until libchrome is buildable within the Android build system (http://r.android.com/158392). So Brillo/Android builds will depend on libchrome using the conventional Android.mk means. Bug: 22175181 Change-Id: I9a737aa785488e5bc0ca1adc087d1d5dfcdf3bea
-
- 06 Jul, 2015 1 commit
-
-
Marie Janssen authored
Update the LOG_* functions to take a tag argument which makes them more consistent with the Android Log.*(TAG, s) common syntax and removes some #define-dependency with osi/include/log.h. Also update to never use Android log functions directly. Also contains minor cleanup of some header includes. Bug: 21569831 Change-Id: If07385cafbea062232ecdbc7c673f908d5ef8921
-
- 24 Jun, 2015 1 commit
-
-
Miao Chou authored
Eliminate cutils/sockets dependencies by pulling sources files from core/libcutils into osi/. - Pulled source files from cutils/ into osi/ and modified GN files and Android.mk - Updated includes to use the headers in osi/ and removed unused/duplicated headers. - Renamed the functions of osi/sockets and updated wherever they are called to avoid usign symbols from cutils/sockets, since other cutils dependencies have not been eliminated yet. Bug: 21667795 Change-Id: I3dd4371d585f120d97ac0433ab1f35edb820dbb9
-
- 15 Jun, 2015 1 commit
-
-
Sharvil Nanavati authored
This patch improves RFCOMM throughput and reduces CPU utilization. Instead of using a counting semaphore to measure bytes and reading one at a time from the eager reader's buffer, read in bulk based on the incoming read request size. Change-Id: I17046bfbc3ca49576a9c82b38911aeb84234881a
-
- 12 Jun, 2015 1 commit
-
-
Arman Uguray authored
This CL introduces macros for safe pointer to integer conversion (and vice versa). Also fixed a small style issue in log.h Bug: 21570302 Change-Id: If76bf5e35970f9b33f9bef53fbd03a7effae08dc
-
- 11 Jun, 2015 1 commit
-
-
Sharvil Nanavati authored
Change-Id: I007b2211d9b52422b4442765bb97c0ba90613c50
-
- 10 Jun, 2015 3 commits
-
-
Pavlin Radoslavov authored
Also, removed the OSI module's start_up and shut_down steps, because now they are no-op. Bug: 21558791 Change-Id: I24259b327f399af57c37937111158baa9704f644
-
Pavlin Radoslavov authored
Temporary disable the allocation tracker initialization (even for BLUEDROID_DEBUG) when initializing Bluetooth. This is a short-term workaround solution for several issues related to the usage of the allocation tracker. * Inconsistent usage of osi_malloc()/osi_calloc() and osi_free() - Within some of the Bluetooth-related unit tests we have two copies of the same libosi library: one copy statically linked against the unit test, and another dlopen() at runtime as part of bluetooth.default.so Each of those copy has its own static variables. - For the dlopen() copy we do call allocation_tracker_init(), while for the static copy within the unit test we don't call allocation_tracker_init() - Occasionally, there is a memory allocation via osi_calloc() within the dlopen()-ed library, and then it is osi_free()-ed within the statically linked library. Such (mis)usage creates issues in two ways: (1) free()-ing incorrect pointer, and (2) the osi hash_map() in the dlopen()-ed library still considers the osi-tracked memory as allocated. NOTE: (1) could trigger random crashes, while (2) is the reason the unit test triggers an assert * Avoid potential issues that could result from the fact that calling allocation_tracker_init() is not mandatory; i.e., the same issue described above could be triggered if osi_malloc()/osi_callod() was called before the call to allocation_tracker_init() * There is still code that uses malloc(3)/calloc(3) and free(3) instead of osi_malloc()/osi_calloc() and osi_free() Also, add missing pthread_mutex_lock()/pthread_mutex_unlock() guards, and fix the allocation_tracker_uninit() implementation so it works properly even if void allocation_tracker_init() wasn't called. Bug: 21561735 Change-Id: Ic83d6cd40af1189c4ee9c1dbfd0ad8e4666e1502
-
Pavlin Radoslavov authored
Now the OSI module's shut_down processing is split into "shut_down" and "clean_up". Previously, there was an ordering issue manipulating some of the internal state during graceful shutdown/cleanup. Some of the modules had two steps: shut_down, followed by clean_up, while other had only shut_down step. This triggered the following assert in file alarm.c alarm_cancel: assertion "alarms != NULL" failed Bug: 21406940 Change-Id: Iab1f033a69cbff646a6b0f346760ae82f8b00b8f
-
- 08 Jun, 2015 4 commits
-
-
Zach Johnson authored
Ensures all alarm resources are torn down before the test ends, so the allocation tracker is happy and doesn't assert-fail the tests. Also guard alarm_shutdown to make sure it only runs if lazy_initialize was run (to avoid undefined behavior) Change-Id: Iaf78fe85edd2fc65b9c5ee11c74665a11a3bc9ba
-
Andre Eisenbach authored
Change-Id: Iecf1e2258da012bdac69a4f57d38b12a272e3edd
-
Andre Eisenbach authored
Includes support for BTSnoop logging in memory. Bug: 18508263 Change-Id: I175da528cbcdc00d40622647d518a74210cfe6fd
-
Pavlin Radoslavov authored
Bug: 20884459 Change-Id: Id010cb29cf09b95800dc9f5fd5b660e71e4a47bc
-
- 01 Jun, 2015 1 commit
-
-
Arman Uguray authored
Removed unnecessary library and include flags from build files. To make the initial build outputs more similar to Android, this CL changes the usage of the GN "source_set" idiom to "static_library". This comes at a performance loss while keeping the builds similar until we get the whole stack to compile. BUG=21339022 Change-Id: I46f70b3b64b2537634a1dbb517a5168566230efb
-
- 29 May, 2015 1 commit
-
-
Arman Uguray authored
Added tinyxml2 as a secondary source. Moved //build/secondary/testing to //build/secondary/third_party in the process. This means that all third_party sources (gtest, tinyxml2) should be placed in a top-level third_party directory. BUG=21339022 Change-Id: If324ef1eb0d5061e005f62a80d23fef25e7e78a4
-
- 28 May, 2015 1 commit
-
-
Ian Coolidge authored
Bug: 20427982 Change-Id: I003469d6dfce681a38baa71b5709236a1a4a2189
-
- 26 May, 2015 2 commits
-
-
Arman Uguray authored
This CL adds support to build the net_test_osi target using GN + ninja. The BUILD.gn file now pulls in gtest as a dependency. Missing libc includes have been added to sources that prevented compilation on Goobuntu (14.04). The osi/include/log.h header has been modified to conditionally call the Android log utilities vs plain-old printf on non-Android builds. BUG=21339022 Change-Id: If3c356360c56c63b3bf551b41dc8d3269d8e7e09
-
Arman Uguray authored
BUG=21339022 Change-Id: I946fad7bf8116054f9081e064748793e79a6f85a
-
- 12 May, 2015 1 commit
-
-
Scott James Remnant authored
BUG=20491586
-
- 07 May, 2015 1 commit
-
-
Chih-Hung Hsieh authored
These patches will allow us to compile the whole AOSP with clang/llvm before all the following problems are fixed. * Suppress warnings on unused variables. * Remove unused static variables. * Use only gcc to compile code that requires gcc atomic functions. They should be converted to standard atomic functions later. * Suppress warnings on redefined typedefs. BUG: 20765701 Change-Id: Ib1d6e2ef86c255ba87c1d51f9fdeabe5c8de2ada (cherry picked from commit 23546918)
-
- 16 Apr, 2015 1 commit
-
-
Mark Salyzyn authored
- This was a clang complaint, not a gcc complaint - memset event to be portable to all compile environments - error as follows: external/bluetooth/bluedroid/osi/./src/reactor.c:90:34: error: missing field data initializer [-Werror,-Wmissing-field-initializers] struct epoll_event event = { 0 }; ^ external/bluetooth/bluedroid/osi/./src/reactor.c:151:34: error: missing field data initializer [-Werror,-Wmissing-field-initializers] struct epoll_event event = { 0 }; ^ external/bluetooth/bluedroid/osi/./src/reactor.c:174:34: error: missing field data initializer [-Werror,-Wmissing-field-initializers] struct epoll_event event = { 0 }; ^ 3 errors generated. make: *** [out/target/product/hammerhead/obj/STATIC_LIBRARIES/libosi_intermediates/./src/reactor.o] Error 1 Change-Id: I14b884cf1665c68aff1e5afd3df65ac10af474d2
-
- 15 Apr, 2015 1 commit
-
-
Vinit Deshpande authored
Change-Id: Ia856311187a0b2168cb859bd8b2300ff59df6569
-
- 07 Apr, 2015 1 commit
-
-
Chris Elliott authored
Change-Id: I56cca343e07df83999b0ef0fb672dc8bcfae4bc4
-
- 02 Apr, 2015 4 commits
-
-
Scott James Remnant authored
glibc doesn't declare strlcpy(), strlcat() or gettid(). Add a header of compatibility routines that only get included when compiling on this. Change-Id: I889ac7f1d22cf7056757890fcff0403107488d62
-
Scott James Remnant authored
'inline' is only a hint for the compiler, and if ignored this results in extern functions being created. Add 'static' so that the resulting functions are also only local to the compilation unit. Change-Id: I947201b8170c8c73f15e7ccdd68cfc7f07cde1e9
-
Scott James Remnant authored
Some standard library functions are used while relying on bionic headers including the headers the functions were actually declared on. Add those missing #includes so that bluetooth.default.so will compile on glibc. Change-Id: Ied9f89ce5a05911fca63f6bfe1b8cc8196ab3b1c
-
Nitin Arora authored
This change uses generic format specifier for logging the pointers which can be 64 bit or 32 bit depending upon the system used for compilation. Also address of operator is used before casting a int variable to void pointer. Change-Id: Ie9dec408f3a5f674079f77c047d8192f65a004ca
-
- 01 Apr, 2015 1 commit
-
-
Etan Cohen authored
Change-Id: I0d3e93ea61dd03505fe9db902ed90bdd4141cab2
-
- 30 Mar, 2015 1 commit
-
-
Nitin Arora authored
This change uses generic format specifier for logging the pointers which can be 64 bit or 32 bit depending upon the system used for compilation. Also address of operator is used before casting a int variable to void pointer. Change-Id: Ie9dec408f3a5f674079f77c047d8192f65a004ca
-
- 27 Mar, 2015 3 commits
-
-
Zach Johnson authored
If we're rescheduling a periodic timer in the context of an alarm expiration we want to force rescheduling to happen. The alarm at the front of the list after scheduling the next instance may be a different alarm. The old code would assume it was already scheduled correctly, meaning nothing would ever get scheduled after that. Change-Id: I8accf5d004e69dfd6477ab7ec529eea42b3a88f8
-
Zach Johnson authored
Turns out the posix timers we're dealing with aren't well behaved. If the timer is TIMER_ABSTIME the following is supposed to be true: "If the specified time has already passed, the function shall succeed and the expiration notification shall be made." But alas, this is not the case. If the expiration time happens to be in the past (e.g. very short timer which gets hit with a context switch before the timer can be set) the timer decides to disarm itself. This means no more callbacks happen, and no more alarms are processed ever. sadness. But thankfully, we can use timer_gettime to check the state of the timer after timer_settime. If timer_gettime tells us the timer is disarmed right after we armed it, we want to perform the alarm callback ourselves. Put all timer callbacks on the same thread (as would be the case in the underlying timer implementation already) and used a sempahore to signal when an alarm expires in the normal posix timer callback and also in the timer didn't set case. Change-Id: I39854b241369b2da52afbaaba0c01d3167a47e32
-
Zach Johnson authored
This means we lose the ability to send the intended alarm as context with the posix timer, but this can be handled gracefully enough by making sure we actually have an expired alarm at the front of the list when the timer callback occurs. Change-Id: I909195b5c3155075096328c529655eeb5b7d80d0
-
- 26 Mar, 2015 3 commits
-
-
Zach Johnson authored
If we're rescheduling a periodic timer in the context of an alarm expiration we want to force rescheduling to happen. The alarm at the front of the list after scheduling the next instance may be a different alarm. The old code would assume it was already scheduled correctly, meaning nothing would ever get scheduled after that. Change-Id: I8accf5d004e69dfd6477ab7ec529eea42b3a88f8
-
Zach Johnson authored
Turns out the posix timers we're dealing with aren't well behaved. If the timer is TIMER_ABSTIME the following is supposed to be true: "If the specified time has already passed, the function shall succeed and the expiration notification shall be made." But alas, this is not the case. If the expiration time happens to be in the past (e.g. very short timer which gets hit with a context switch before the timer can be set) the timer decides to disarm itself. This means no more callbacks happen, and no more alarms are processed ever. sadness. But thankfully, we can use timer_gettime to check the state of the timer after timer_settime. If timer_gettime tells us the timer is disarmed right after we armed it, we want to perform the alarm callback ourselves. Put all timer callbacks on the same thread (as would be the case in the underlying timer implementation already) and used a sempahore to signal when an alarm expires in the normal posix timer callback and also in the timer didn't set case. Change-Id: I39854b241369b2da52afbaaba0c01d3167a47e32
-
Zach Johnson authored
This means we lose the ability to send the intended alarm as context with the posix timer, but this can be handled gracefully enough by making sure we actually have an expired alarm at the front of the list when the timer callback occurs. Change-Id: I909195b5c3155075096328c529655eeb5b7d80d0
-
- 24 Mar, 2015 1 commit
-
-
Zach Johnson authored
Also improve names of some functions. Change-Id: Ia5aeebc8226ce5c36abdd372ea4de5195314e273
-
- 16 Mar, 2015 4 commits
-
-
Chris Manton authored
-
Sharvil Nanavati authored
-
Sharvil Nanavati authored
There's a race condition on shutdown between Java and native code. A stack shutdown is issued from Java and in the meantime the calling thread calls System.exit(0). If that line is reached before the native code has had a chance to shut down cleanly, the system could be stuck in a bad state. This change uses rename(2) to replace an existing config file atomically instead of truncating, writing, and then flushing. In case of a crash or the race condition above, the config file will still be valid. There's an implementation gotcha. The config saving code uses ".new" as a suffix on the original filename to write to a temporary file. If a file by that name already exists, it will be overwritten.
-
Zach Johnson authored
Adds alarm_set_periodic so the alarm code can have more contextual information when rescheduling alarms. Problem: A2DP would stream for a few seconds and then stop working. Cause: The Java garbage collector. Bluedroid reaches out to javaland to acquire and release the wake lock. Alarm was always reaching out to get the wake lock when it scheduled a short timeout. If GC kicked in during that call out to make sure we have the wake lock, it could take more than 100ms to get back us. That would screw over the alarm implementation particularly for small 20ms timers. So now if the wake lock was already acquired, we don't try to reacquire it. Cool. But we still have thrashing. Why? Because the alarm code doesn't know the alarm is actually being used in a periodic way. Here's what used to happen: alarm expires alarm is removed reschedule alarm callback is called alarm callback sets the alarm again alarm is added reschedule The problem is the first reschedule will get rid of the wake lock if the next alarm is too far out or doesn't exist, meaning the next reschedule needs to get the wake lock again. With the extra periodicity information we can eliminate the unnecessary intermediate reschedule, meaning no thrashing on the wake lock. yay!
-