summaryrefslogtreecommitdiffstats
path: root/libs/binder
Commit message (Collapse)AuthorAgeFilesLines
* Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator buildMike Lockwood2011-07-131-12/+0
| | | | | Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba Signed-off-by: Mike Lockwood <lockwood@android.com>
* Eliminate single-process mode.Jeff Brown2011-07-081-39/+12
| | | | | | Bug: 5010576 Change-Id: Id450dc83efed4897d1e4ff451530fed14457aace
* PermissionCache caches permission checksMathias Agopian2011-06-273-89/+114
| | | | | | | | | | | | | This is intended to absorb the cost of the IPC to the permission controller. Cached permission checks cost about 3us, while full blown ones are two orders of magnitude slower. CAVEAT: PermissionCache can only handle system permissions safely for now, because the cache is not purged upon global permission changes. Change-Id: I8b8a5e71e191e3c01e8f792f253c379190eee62e
* MemoryHeapBase: Save and binderize the offsetAnu Sundararajan2011-06-272-26/+42
| | | | | | | | | | The offset that is used in the creation of the MemoryHeapBase must be saved, so that it can be used to recreate the Heap when an IMemory object is passed across process boundary through the binder. Change-Id: Ie618fb5c0718e6711f55ed9235616fd801e648dc Signed-off-by: Anu Sundararajan <sanuradha@ti.com> Signed-off-by: Iliyan Malchev <malchev@google.com>
* Make sure binder ioctl structs don't contain uninitialized values.Evgeniy Stepanov2011-04-211-0/+3
| | | | Change-Id: I8a678f91262417bb120e65e32c244ce1512b46c2
* Merge "Parcel::appendFrom({const } Parcel *parcel, size_t, size_t)"Andreas Huber2011-04-181-3/+3
|\
| * Parcel::appendFrom({const } Parcel *parcel, size_t, size_t)Andreas Huber2011-04-131-3/+3
| | | | | | | | | | | | As far as I can tell "parcel" isn't actually modified by the implementation. Change-Id: Ib806eefdc13c97b932773e1dc9ca3a4aad4422b2
* | Rewrite battery history storage.Dianne Hackborn2011-04-141-7/+11
|/ | | | | | | | | | We now write battery history directly into a buffer, instead of creating objects. This allows for more efficient storage; later it can be even better because we can only write deltas. The old code is still there temporarily for validation. Change-Id: I9707d4d8ff30855be8ebdc93bc078911040d8e0b
* Clean up use of HAVE_ANDROID_OSKenny Root2011-02-162-8/+8
| | | | | | | | HAVE_ANDROID_OS was defined as "1" for targets, but never defined as "0" for non-targets. Changing them to #ifdef should be safe and matches all the other uses of HAVE_ANDROID_OS throughout the system. Change-Id: I82257325a8ae5e4e4371ddfc4dbf51cea8ea0abb
* am 6637e307: am bfb5f596: Merge "Fix for writing empty strings to ↵Jean-Baptiste Queru2010-12-281-1/+4
|\ | | | | | | | | | | | | Parcel::writeString8()" * commit '6637e307494475b85afe8869d312d4a2f832d8f4': Fix for writing empty strings to Parcel::writeString8()
| * Fix for writing empty strings to Parcel::writeString8()Pravat Dalbehera2010-12-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If writeString8 is called with the following sequence: writeString8(String8("")); writeString8(String8("TempString")); Then in the readString8, the 2nd String i.e. "TempString" is not read, instead an empty string is read. The bug comes because of the write call for String8("") where there are no String bytes present. In the write Statement, an extra ‘\0’ is written. During the Marshalling, Following bytes are written: 1 2 3 4 5 ... 0x0 0x0 0xB ‘T’ ‘e’ ... The readString8 function has a check that, if String length is 0, don’t read anything. So the first byte is read as the length for the first string. The second byte i.e. ‘\0’ is read as the length for the second string and hence the second string becomes empty too. Change-Id: Id7acc0c80ae16e77be4331f1ddf69ea87e758420
* | Framework-side support for Dalvik "isSensitiveThread" hook.Brad Fitzpatrick2010-12-141-0/+10
| | | | | | | | | | | | | | Used in lock contention stats. Bug: 3226270 Change-Id: Ie6f58d130a29079a59bdefad40b80304d9bc3623
* | fix messages from sqlite layer in c++ code to be useful.Vasu Nori2010-11-291-2/+4
| | | | | | | | Change-Id: Ib13f86f3481aae391f5e887bb14877f12bf48034
* | convert one of the LOGE to LOG_WINDOW msg to reduce griefVasu Nori2010-10-261-1/+1
| | | | | | | | | | | | | | | | grief from people who think this message is bad news. but in reality, this message is really just an informational message to aid in debugging Change-Id: I1a2ab1666a27adb7d3fd210528b2c5218640d53d
* | turn off some useless messagesVasu Nori2010-10-051-2/+4
| | | | | | | | Change-Id: I5ed5696cd052b70e7cf7b872205470cd56fada90
* | am deaa8ff1: am a7ef18fc: Merge "Some debugging support." into gingerbreadDianne Hackborn2010-09-241-0/+14
|\ \ | |/ | | | | | | | | | | Merge commit 'deaa8ff1b10d38add4f7c276e7be2ffc19359a14' * commit 'deaa8ff1b10d38add4f7c276e7be2ffc19359a14': Some debugging support.
| * Some debugging support.Dianne Hackborn2010-09-241-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | - New feature to "am monitor" to have it automatically launch gdbserv for you when a crash/ANR happens, and tell you how to run the client. - Update dumpstate to match new location of binder debug logs - Various commented out logs that are being used to track down issues. Change-Id: Ia5dd0cd2df983a1fc6be697642a4590aa02a26a5
* | am ae087369: am 63070856: Merge "Don\'t propagate StrictMode over one-way ↵Brad Fitzpatrick2010-08-312-6/+27
|\ \ | |/ | | | | | | | | | | | | | | Binder calls." into gingerbread Merge commit 'ae087369c56a270c33c1c1af5be7d3c5d7f94e80' * commit 'ae087369c56a270c33c1c1af5be7d3c5d7f94e80': Don't propagate StrictMode over one-way Binder calls.
| * Don't propagate StrictMode over one-way Binder calls.Brad Fitzpatrick2010-08-312-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was causing stack stitching problems where a one-way call with violations followed by a two-way call without violations was getting the previous one-way call's violation stack stitched on to the second caller's stack. The solution is a little more indirect than I would've liked (preserving the binder's onTransact flags until enforceInterface) but was seemingly necessary to work without changing the AIDL compiler. It should also be sufficiently cheap, since no new calls to thread-local IPCThreadState lookups were required. The additional work is just same-thread getter/setters on the existing IPCThreadState. Change-Id: I4b6db1d445c56e868e6d0d7be3ba6849f4ef23ae
* | am 245cb784: am 84c924a6: Merge "Replace several IPCThreadState::get() ↵Brad Fitzpatrick2010-07-271-5/+5
|\ \ | |/ | | | | | | | | | | | | | | lookups with one." into gingerbread Merge commit '245cb7846c82f7c0840e13f0b994d356846b1678' * commit '245cb7846c82f7c0840e13f0b994d356846b1678': Replace several IPCThreadState::get() lookups with one.
| * Replace several IPCThreadState::get() lookups with one.Brad Fitzpatrick2010-07-271-5/+5
| | | | | | | | | | | | Also, make StrictMode's ThreadLocal final. Change-Id: I08d400ed254fa67bb7a3dae1227f205a54c00df0
* | am 3e5e21d4: am 1772c34e: Merge "StrictMode: gather and return violating ↵Brad Fitzpatrick2010-07-151-1/+12
|\ \ | |/ | | | | | | | | | | | | | | stacks in Binder replies" into gingerbread Merge commit '3e5e21d4dc74751e64d17379c5563ece39a7e35d' * commit '3e5e21d4dc74751e64d17379c5563ece39a7e35d': StrictMode: gather and return violating stacks in Binder replies
| * StrictMode: gather and return violating stacks in Binder repliesBrad Fitzpatrick2010-07-151-1/+12
| | | | | | | | | | | | | | | | | | | | | | Now, when Thread A has a strict mode policy in effect and does a Binder call to Thread B (most likely in another process), the strict mode policy is passed along, but with the GATHER penalty bit set which overrides other policies and instead gathers all offending stack traces to a threadlocal which are then written back in the Parcel's reply header. Change-Id: I7d4497032a0609b37b1a2a15855f5c929ba0584d
* | am cc52121c: am c4b204bd: Merge "More StrictMode work, keeping Binder & ↵Brad Fitzpatrick2010-07-152-4/+13
|\ \ | |/ | | | | | | | | | | | | | | BlockGuard\'s thread-locals in-sync." into gingerbread Merge commit 'cc52121c4f88e9feb8404937bcbfff6e73084666' * commit 'cc52121c4f88e9feb8404937bcbfff6e73084666': More StrictMode work, keeping Binder & BlockGuard's thread-locals in-sync.
| * More StrictMode work, keeping Binder & BlockGuard's thread-locals in-sync.Brad Fitzpatrick2010-07-152-4/+13
| | | | | | | | Change-Id: Ia67cabcc17a73a0f15907ffea683d06bc41b90e5
* | am 706623dd: am c0a7e690: Add Parcel::readExceptionCode() and ↵Brad Fitzpatrick2010-07-133-6/+15
|\ \ | |/ | | | | | | | | | | | | | | Parcel::writeNoException() Merge commit '706623ddb8314850c0551f0b66e24b5f0bd28620' * commit '706623ddb8314850c0551f0b66e24b5f0bd28620': Add Parcel::readExceptionCode() and Parcel::writeNoException()
| * Add Parcel::readExceptionCode() and Parcel::writeNoException()Brad Fitzpatrick2010-07-133-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add native Parcel methods analogous to the Java versions. Currently, these don't do much, but upcoming StrictMode work changes the RPC calling conventions in some cases, so it's important that everybody uses these consistently, rather than having a lot of code trying to parse RPC responses out of Parcels themselves. As a summary, the current convention that Java Binder services use is to prepend the reply Parcel with an int32 signaling the exception status: 0: no exception -1: Security exception -2: Bad Parcelable -3: ... -4: ... -5: ... ... followed by Parceled String if the exception code is non-zero. With an upcoming change, it'll be the case that a response Parcel can, non-exceptionally return rich data in the header, and also return data to the caller. The important thing to note in this new case is that the first int32 in the reply parcel *will not be zero*, so anybody manually checking for it with reply.readInt32() will get false negative failures. Short summary: If you're calling into a Java service and manually checking the exception status with reply.readInt32(), change it to reply.readExceptionCode(). Change-Id: I23f9a0e53a8cfbbd9759242cfde16723641afe04
* | am efcf68aa: am ef8f96a7: Merge "Start of work on passing around StrictMode ↵Brad Fitzpatrick2010-06-233-7/+21
|\ \ | |/ | | | | | | | | | | | | | | policy over Binder calls." into gingerbread Merge commit 'efcf68aa1fd7fcfd52cf3d2837ed8db8e797194b' * commit 'efcf68aa1fd7fcfd52cf3d2837ed8db8e797194b': Start of work on passing around StrictMode policy over Binder calls.
| * Start of work on passing around StrictMode policy over Binder calls.Brad Fitzpatrick2010-06-213-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | This is (intendend to be) a no-op change. At this stage, Binder RPCs just have an additional uint32 passed around in the header, right before the interface name. But nothing is actually done with them yet. That value should right now always be 0. This now boots and seems to work. Change-Id: I135b7c84f07575e6b9717fef2424d301a450df7b
* | Move CursorWindow class from core/jni to libbinderMike Lockwood2010-05-282-0/+409
|/ | | | | | | To allow use of the native CursorWindow class outside of the core framework jni Change-Id: I72e8dcb91a2c691130c33cdfd9a25d343da1c592 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Make static versions of libutils and libbinder.Dan Egnor2010-05-062-26/+28
| | | | | | | | | | Fix some small static-initialization-order issues (and a static- initializers-missing issue) that result from doing so. The static libraries don't actually get used for anything real at the moment -- they're used for perf tests of bug 2660235. Bug: 2660235 Change-Id: Iee2f38f79cc93b395e8d0a5a144ed92461f5ada0
* fix [2599939] "cannot play video" after open/close a video player a dozen of ↵Mathias Agopian2010-04-191-23/+0
| | | | | | | | | | | | | times get rid off the MAP_ONCE flag is MemoryHeapBase (as well as it's functionality), this feature should not be used anymore. the software renderer was incorrectly using the default ctor which set MAP_ONCE, causing the leak. the software renderer itself is incorrectly used while coming back from sleep. Change-Id: I123621f8d140550b864f352bbcd8a5729db12b57
* Ensure that binder incalls to the system process keep the fg cgroupChristopher Tate2010-03-181-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On binder incalls, the handler thread is given the caller's priority by the driver, but not the caller's cgroup. We have explicit code that sets the handler's cgroup to match the caller's, *except* that the system process explicitly disables this behavior. This led to a siuation in which we were running binder incalls to the system process at nice=10 but cgroup=fg. That's fine as far as it goes, except that if a GC happened in the handler thread, it would be promoted to foreground priority and cgroup both, to avoid having the GC take forever. Then, when GC finished, the original priority is reset, and the cgroup set *based on that priority*. This would push the handler thread into nice=10 cgroup=bg_non_interactive -- which matches the caller, but is supposed to be impossible in the system process. The end result of this was that we could be running "lengthy" operations in the system process in the background. Unfortunately, some of the operations that wound up like this would hold important global system locks for up to twenty seconds as a result, making the entire device unresponsive to input for that period. This CL fixes the binder incall setup to ensure that within the system process, a binder incall is always begun from the normal foreground priority as well as cgroup. In practice now the device still becomes laggy/sluggish when the offending lock-holding time-consuming incall occurs, but since it still runs as a foreground task it is able to proceed to completion within a short time rather than taking 20 seconds. Fixes bug #2403717 Change-Id: Id046aeabd0e80c48eef94accc37842835eab308d
* remove a dependency of GraphicBuffer (libui) on Parcel (libbinder).Mathias Agopian2010-02-211-1/+69
| | | | | | | | | Add a Flattenable interface to libutils which can be used to flatten an object into bytestream + filedescriptor stream. Parcel is modified to handle Flattenable. And GraphicBuffer implements Flattenable. Except for the overlay classes libui is now independent of libbinder.
* Simplify the MemoryDealer implementationMathias Agopian2010-01-292-137/+180
| | | | | | | | | | | | | | At some point the implementation became complicated because of SurfaceFlinger's special needs, since we are now relying on gralloc we can go back to much simpler MemoryDealer. Removed HeapInterface and AllocatorInterface, since those don't need to be paramterized anymore. Merged SimpleMemory and Allocation. Made SimplisticAllocator non virtual. Removed MemoryDealer flags (READ_ONLY, PAGE_ALIGNED) Removed a lot of unneeded code.
* Propagate background scheduling class across processes.Dianne Hackborn2009-12-071-15/+38
| | | | | | | | | | | This is a very simply implementation: upon receiving an IPC, if the handling thread is at a background priority (the driver will have taken care of propagating this from the calling thread), then stick it in to the background scheduling group. Plus an API to turn this off for the process, which is used by the system process. This also pulls some of the code for managing scheduling classes out of the Process JNI wrappers and in to some convenience methods in thread.h.
* Modify the binder to request 1M - 2 pages instead of 1M. The backing storeRebecca Schultz Zavin2009-11-121-1/+1
| | | | | | | | in the kernel requires a guard page, so 1M allocations fragment memory very badly. Subtracting a couple of pages so that they fit in a power of two allows the kernel to make more efficient use of its virtual address space. Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
* Reset binder service threads' cgroup/priority after command completionChristopher Tate2009-11-081-0/+15
| | | | | | | | | To prevent buggy command implementations from poisoning binder threads' scheduling class & priority for future command execution, we now reset the cgroup and thread priority to foreground/normal when a binder service thread finishes executing the designated command. Change-Id: Ibc0ab2485751453f6dc96fdb4eb877fd02796e3f
* Revert jparks code from IPCThreadState.Evan Millar2009-11-061-5/+0
|
* When a thread is about to be put back onto the thread pool ensure that it is ↵Jason Parks2009-11-041-22/+4
| | | | in the foreground cgroup.
* Add a warning when we leave threads in the binder thread pool in the ↵Jason Parks2009-11-031-0/+28
| | | | background scheduling group.
* libbinder: MemoryHeapPmem: honor the NO_CACHING flag when creating a client heapDima Zavin2009-11-021-1/+1
| | | | | Change-Id: Ia7beb800f5a24beaa4b7f3032b486d4ed1991b23 Signed-off-by: Dima Zavin <dima@android.com>
* libbinder: add a NO_CACHING flag to MemoryHeapBaseIliyan Malchev2009-10-301-1/+5
| | | | | | The NO_CACHING flag translates to opening a memory region with O_SYNC. Signed-off-by: Iliyan Malchev <malchev@google.com>
* Add offset handling in MemoryHeapBase classBenny Wong2009-08-201-4/+4
|
* Support for marshalling pointers / intptr_t in Parcel.Andreas Huber2009-08-171-95/+63
| | | | Some refactoring to eliminate code duplication in Parcel implementation.
* don't crash in Parcel when given a null (and therfore invalid) native_handle_tMathias Agopian2009-07-311-1/+1
|
* Instead of using -1 for pid and uid in the simulator, and then havingMarco Nelissen2009-07-171-7/+2
| | | | | to special-case the simulator case all over the framework, just use getuid and getpid, and intercept those in the simulator wrapper.
* new Permission class used to improve permission checks speed (by caching ↵Mathias Agopian2009-06-153-5/+99
| | | | results)
* some work to try to reduce the code size of some native librariesMathias Agopian2009-05-269-34/+82
| | | | | | | | | | | | | | | | | - make sure that all binder Bn classes define a ctor and dtor in their respective library. This avoids duplication of the ctor/dtor in libraries where these objects are instantiated. This is also cleaner, should we want these ctor/dtor to do something one day. - same change as above for some Bp classes and various other non-binder classes - moved the definition of CHECK_INTERFACE() in IInterface.h instead of having it everywhere. - improved the CHECK_INTERFACE() macro so it calls a single method in Parcel, instead of inlining its code everywhere - IBinder::getInterfaceDescriptor() now returns a "const String16&" instead of String16, which saves calls to String16 and ~String16 - implemented a cache for BpBinder::getInterfaceDescriptor(), since this does an IPC. HOWEVER, this method never seems to be called. The cache makes BpBinder bigger, so we need to figure out if we need this method at all.
* am d50a458b: Merge change 2351 into donutAndroid (Google) Code Review2009-05-221-2/+6
| | | | | | | Merge commit 'd50a458bb291801ab9fdc119301bc7b84b42a6e3' * commit 'd50a458bb291801ab9fdc119301bc7b84b42a6e3': Fix a major bug in Bundle when unparcelling from AIDL.