summaryrefslogtreecommitdiffstats
path: root/libs/binder
Commit message (Collapse)AuthorAgeFilesLines
* fix mem leak on error handlingHyejin Kim2013-05-311-1/+3
| | | | Change-Id: I40d8e371c46184aa701fa676246201a9d8f6e27d
* binder: Add MemoryHeapBaseIoncodeworkx2012-12-113-2/+136
| | | | | | | Source: http://git.insignal.co.kr/samsung/exynos/android/platform/frameworks/native/commit/?h=exynos-jb&id=dc4cd25cc41e4358debd0c7d1a2706d208a58df6 Change-Id: Ib06cc37a2a25c78a061ee2bad48eec2d01b07833
* Revert "get rid of MemoryHeapPmem"Ricardo Cerqueira2012-11-212-0/+253
| | | | | | | This reverts commit 7a7524810a0950c1c2b18014a8f1c637275165c4 and makes MemoryHeapPmem conditioned to BOARD_NEEDS_MEMORYHEAPPMEM Change-Id: I2f38340984ba87d6970d17ec944e3faded4132c8
* Revert "ugly, temporary, workaroung for a problem where a binder thread ↵Dave Burke2012-10-061-12/+0
| | | | | | | | spins forever" This reverts commit 0845d0245e09548110cacb0f20e9934753388aab Change-Id: I395037cb9427cd11f7de6bb78fbdfa917fc6263a
* ugly, temporary, workaroung for a problem where a binder thread spins foreverMathias Agopian2012-10-051-0/+12
| | | | | Bug: 7289992 Change-Id: I0c3d482a1af57e5f444be2ba7f2751ac3e954af2
* No longer need "original calling uid".Dianne Hackborn2012-08-311-8/+0
| | | | Change-Id: Ifc4a89dd088609a5a8553f6ac6553174e09e8222
* Fix shutdown sequence to avoid SIGSEGV when running am commandJohannes Carlsson2012-06-251-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the app_process is shutting down the main thread will close the binder fd while pool threads are executing an ioctl (in IPCThreadState::stopProcess called by AppRuntime::onStarted in app_main.c). The binder driver will then return all pending calls in ioctl without any error and with a command. One of the threads gets a BR_SPAWN_LOOPER which will create a new thread (the other thread gets a BR_NOOP). This new thread then calls vm->AttachCurrentThread. Usually this results in a log entry with "AndroidRuntime: NOTE: attach of thread 'Binder Thread #3' failed", but sometimes it also causes a SIGSEGV. This depends on the timing between the new thread an the main thread that calls DestroyJavaVM (in AndroidRuntime::start). If IPCThreadState.cpp is compiled with "#define LOG_NDEBUG 0" the pool thread will loop and hit the ALOG_ASSERT(mProcess->mDriverFD >= 0) in IPCThreadState::talkWithDriver. Crashes like this has been seen when running the am command and other commands that use the app_process. This fix makes sure that any command that is received when the driver fd is closed are ignored and IPCThreadState::talkWithDriver instead returns an error which will cause the pool thread to exit and detach itself from the vm. A check to avoid calling ioctl to a fd with -1 was also added in IPCThreadState::threadDestructor. Another solution might be to change the binder driver so that it returns an error when the fd is closed (or atleast not a BR_SPAWN_LOOPER command). It might also be possible to call exit(0) which is done when System.exit(0) is called from java. Change-Id: I3d1f0ff64896c44be2a5994b3a90f7a06d27f429
* Aligning native Parcel implementation to Java.Magnus Strandberg2012-06-081-1/+2
| | | | | | | | | | | The Java implementation of writing the RPC response header calculates the length of the header including the 4 bytes specifying the header length but the native implementation excludes the 4 bytes specifying the length from the header length. The native implementation has been aligned to the Java impl. Change-Id: I325bf272a63152d8fded4cf4e51a906b5a9bfe19
* Add callback hack to find out when to reload system properties.Dianne Hackborn2012-05-091-0/+7
| | | | | | | | | | | | Every IBinder object can accept a new transaction to tell it that it might want to reload system properties, and in the process anyone can register a callback to be executed when this happens. Use this to reload the trace property. This is very much ONLY for debugging. Change-Id: I55c67c46f8f3fa9073bef0dfaab4577ed1d47eb4
* Scheduling group cleanupGlenn Kasten2012-04-191-6/+6
| | | | | | | | | | | | | Remove C++ APIs androidSetThreadSchedulingGroup and androidGetThreadSchedulingGroup, and the ANDROID_TGROUP_* constants. Former callers of these should now use the C APIs set_sched_policy and get_sched_policy, and the SP_* constants. Note: debug.sys.noschedgroups is not supported by the C APIs, this needs to be discussed. Change-Id: I32bbfc539ef4090faf9ef0320380e8cca9eae07c
* add set thread countMathias Agopian2012-04-181-0/+9
| | | | Change-Id: I70f02908d8362a465eb8a2a24356f6989847f7ba
* double checked locking pattern is not safe on SMPMathias Agopian2012-04-161-4/+5
| | | | Change-Id: Ie6dd564bdcd45647cb4d62ab259462e3db112576
* Remove obsolete references to sched_policy.hGlenn Kasten2012-03-051-1/+0
| | | | | | | As part of scheduling policy cleanup, remove or isolate all references to the scheduling policy APIs. Change-Id: Ia1ea2fe711a399039f25217309e061267744b856
* Merge "Shorten thread names"Glenn Kasten2012-02-291-2/+2
|\
| * Shorten thread namesGlenn Kasten2012-02-281-2/+2
| | | | | | | | | | | | | | | | prctl(PR_SET_NAME) limits to 15 characters. Before we had names like "Binder Thread #" and the counter was cut off :-( Also remove redundant "thread" at end of name; it's always a thread. Change-Id: I1f99c2730ba0787ed9b59c15914356cddf698e2f
* | get rid of MemoryHeapPmemMathias Agopian2012-02-272-249/+0
|/ | | | | | | | | | | MemoryHeapPmem is not used any longer. PMEM is not a supported type of memory by the system anymore. a particular device might use PMEM and need something like MemoryHeapPmem, in this case this should be implemented in device specific code (HAL). This will most likely break older no longer supported targets. Change-Id: I434e4291219950018de8b793b0403bb2d92dd5cc
* move CursorWindow from libbinder to libandroidfwMathias Agopian2012-02-272-352/+0
| | | | Change-Id: I3b304e4f74e0d0ec8b20c57296c62449c9a0f792
* Some hardening of isolated processes by restricting access to services.Dianne Hackborn2012-02-091-1/+3
| | | | | | | | | | | | | | | Services now must explicitly opt in to being accessed by isolated processes. Currently only the activity manager and surface flinger allow this. Activity manager is needed so that we can actually bring up the process; SurfaceFlinger is needed to be able to get the display information for creating the Configuration. The SurfaceFlinger should be safe because the app doesn't have access to the window manager so can't actually get a surface to do anything with. The activity manager now protects most of its entry points against isolated processes. Change-Id: I0dad8cb2c873575c4c7659c3c2a7eda8e98f46b0
* Multi-user - 1st major checkinAmith Yamasani2012-02-031-0/+8
| | | | | | | | | | | | | | | Switching activity stacks Cache ContentProvider per user Long-press power to switch users (on phone) Added ServiceMap for separating services by user Launch PendingIntents on the correct user's uid Fix task switching from Recents list AppWidgetService is mostly working. Commands added to pm and am to allow creating and switching profiles. Change-Id: I15810e8cfbe50a04bd3323a7ef5a8ff4230870ed
* Rename LOG_ASSERT to ALOG_ASSERT DO NOT MERGESteve Block2012-01-091-9/+9
| | | | | | | See https://android-git.corp.google.com/g/157519 Bug: 5449033 Change-Id: I8ceb2dba1b031a0fd68d15d146960d9ced62bbf3
* Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-01-088-30/+30
| | | | | | | See https://android-git.corp.google.com/g/#/c/157220 Bug: 5449033 Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
* Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGESteve Block2012-01-066-7/+7
| | | | | | | See https://android-git.corp.google.com/g/157065 Bug: 5449033 Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
* Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGESteve Block2012-01-043-17/+17
| | | | | | | See https://android-git.corp.google.com/g/156801 Bug: 5449033 Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-035-12/+12
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* Fix invalid madvise() during concurrent alloc/dealloc of MemoryDealerJi-Hwan Lee2011-12-151-1/+5
| | | | | | | | | | Currently, madvise(MADV_REMOVE) is called after deallocation. Another thread might allocate (and even write) the same region between deallocation and madvise(), in which case the new thread will fail to read what it have written. So, call deallocate() after madvise(MADV_REMOVE). Bug: 5654596 Change-Id: I26f36cd6013de499090768a0ddc68206a4a68219
* am f1a4c48b: am e21dabf6: Merge "Initialize bwr.read_buffer in ↵Ben Cheng2011-12-011-0/+1
|\ | | | | | | | | | | | | IPCThreadState::talkWithDriver." into ics-mr1 * commit 'f1a4c48b886d53e2afceb0620215e3792af79fd5': Initialize bwr.read_buffer in IPCThreadState::talkWithDriver.
| * Initialize bwr.read_buffer in IPCThreadState::talkWithDriver.Ben Cheng2011-12-011-0/+1
| | | | | | | | | | | | | | | | | | I/valgrind( 1309): ==1310== Syscall param ioctl(BINDER_WRITE_READ).read_buffer points to uninitialised byte(s) I/valgrind( 1309): ==1310== at 0x480E670: __ioctl (__ioctl.S:10) I/valgrind( 1309): ==1310== Address 0xbda651b4 is on thread 1's stack Change-Id: I02893df7b5786b6b2dbd9659f5706d7171295ab2
* | Fix possible leak in Parcel::writeDupFileDescriptor.Jeff Brown2011-11-071-1/+9
| | | | | | | | | | | | | | Also, check the result of dup() just in case we got EMFILE or something. Change-Id: I18e627bd84f4c7941813fe1c2bad2cdd9e5afa83
* | am 88061d6b: am 5462bc63: Fix a leak in Parcel::writeBlob.Jeff Brown2011-11-071-9/+4
|\ \ | |/ | | | | | | * commit '88061d6b38cfb4bf374039846b753a3b21ac61e1': Fix a leak in Parcel::writeBlob.
| * am 5462bc63: Fix a leak in Parcel::writeBlob.Jeff Brown2011-11-051-9/+4
| |\ | | | | | | | | | | | | * commit '5462bc6318b4b70e7a58c66994e2bd79f59d9739': Fix a leak in Parcel::writeBlob.
| | * Fix a leak in Parcel::writeBlob.Jeff Brown2011-11-041-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Was mistakenly assuming that Parcel::writeFileDescriptor took ownership of the fd that was passed in. It does not! Added some comments and a default parameter to allow the caller to specify whether it wishes the Parcel to take ownership. Bug: 5563374 Change-Id: I5a12f51d582bf246ce90133cce7690bb9bca93f6
| * | resolved conflicts for merge of 2d280f75 to ics-mr1Jeff Brown2011-10-301-1/+1
| |\ \ | | |/ | | | | | | Change-Id: I459e1cb0b60fb94dfb12862fedb9f8d949c226a7
| | * Improve the slow query instrumentation.Jeff Brown2011-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On user-debug and eng builds, you can set the "db.log.slow_query_threshold" system property to queries that take longer than the specified number of milliseconds. Set it to 0 to log all queries. This property has been around for a while but it was implemented poorly. In particular, it *changed* the behavior of the query by calling getCount() while holding the Db connection. In normal operation, the query will not actually run until later. By putting the timing logic into fillWindow() instead, we ensure that we only measure queries that actually ran. We also capture cases where the cursor window gets filled multiple times. Bug: 5520301 Change-Id: I174f5e1ea15831a1d22a36e9a804d7755f230b38
* | | Optimize fillWindow to improve reverse-seek performance.Jeff Brown2011-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 5520301 When an application requests a row from a SQLiteCursor that is not in the window, instead of filling from the requested row position onwards, fill from a little bit ahead of the requested row position. This fixes a problem with applications that seek backwards in large cursor windows. Previously the application could end up refilling the window every time it moved back one position. We try to fill about 1/3 before the requested position and 2/3 after which substantially improves scrolling responsiveness when the list is bound to a data set that does not fit entirely within one cursor window. Change-Id: I168ff1d3aed1a41ac96267be34a026c108590e52
* | | Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGESteve Block2011-10-263-43/+43
| | | | | | | | | | | | | | | | | | | | | See https://android-git.corp.google.com/g/#/c/143865 Bug: 5449033 Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
* | | Rename (IF_)LOG() to (IF_)ALOG() DO NOT MERGESteve Block2011-10-252-7/+7
|/ / | | | | | | | | | | | | See https://android-git.corp.google.com/g/#/c/141576 Bug: 5449033 Change-Id: I42575e7c29cf1c0f465c357a5c97ab118df6f473
* | Deprecate local-only CursorWindows.Jeff Brown2011-10-121-3/+1
|/ | | | | | | | | | | | | | | | There is no difference and has never really been a difference between local-only and remotable CursorWindows. By removing the distinction officially in the API, we will make it easier to implement CrossProcessCursor correctly. CrossProcessCursor is problematic currently because it's not clear whether a call to getWindow() will return a local-only window or a remotable window. As a result, the bulk cursor adaptor has special case handling for AbstractWindowedCursors vs. ordinary CrossProcessCursors so that it can set a remotable window before the cursor fills it. All these problems go away if we just forget about local-only windows being special in any way. Change-Id: Ie59f517968e33d0ecb239c3c4f60206495e8f376
* Use ashmem for CursorWindows.Jeff Brown2011-10-112-263/+239
| | | | | | | | | | | | | | | | | | | | | Bug: 5332296 The memory dealer introduces additional delays for reclaiming the memory owned by CursorWindows because the Binder object must be finalized. Using ashmem instead gives CursorWindow more direct control over the lifetime of the shared memory region. The provider now allocates the CursorWindows and returns them to clients with a read-only protection bit set on the ashmem region. Improved the encapsulation of CursorWindow. Callers shouldn't need to care about details like how string fields are allocated. Removed the compile-time configuration of string and numeric storage modes to remove some dead weight. Change-Id: I07c2bc2a9c573d7e435dcaecd269d25ea9807acd
* Clean up CursorWindow code.Jeff Brown2011-10-061-38/+3
| | | | | | | | | Bug: 5332296 The code is functionally equivalent, but a little more efficient and much easier to maintain. Change-Id: I90670a13799df05831843a5137ab234929281b7c
* Fix handling of "allow fds" state.Dianne Hackborn2011-10-031-2/+9
| | | | | | Didn't take into account nesting of bundles. Boo. Change-Id: Ic8cf21ad8d6f4938a3e105128624c9d162310d01
* Transfer large bitmaps using ashmem.Jeff Brown2011-10-031-0/+108
| | | | | | Bug: 5224703 Change-Id: If385a66adf4c6179a0bb49c0e6d09a9567e23808
* Add mechanism for Parcel to not allow FDs to be written to it.Dianne Hackborn2011-10-031-1/+18
| | | | | | This is to help implement issue #5224703. Change-Id: I026a5890495537d15b57fe61227a640aac806d46
* Revert "Transfer large bitmaps using ashmem. Bug: 5224703"Bart Sears2011-09-251-97/+0
| | | | | This reverts commit 56c58f66b97d22fe7e7de1f7d9548bcbe1973029 This CL was causing the browser to crash when adding bookmarks, visiting the bookmarks page, and sharing pages (see bug http://b/issue?id=5369231
* Transfer large bitmaps using ashmem.Jeff Brown2011-09-231-0/+97
| | | | | | Bug: 5224703 Change-Id: Ic7481dd9f173986f085a8bbdcc59bbe9830d7a44
* Resurrect verbose binder loggingAndy McFadden2011-09-071-36/+38
| | | | | | | | | | | | | | | | | Updated the command name lists, and masked off the additional bits in the command word when doing the name lookup. Made descriptor values easier to grep for and consistent with kernel output (i.e. decimal rather than hex). Attempt to show transaction descriptors as such (they're in a union with a pointer). Also, the writeLines() function in Static was using a no-op logging call to write an iovec. It looks like all callers are using N=1, so I just added a log for the first string. Bug 5155269 Change-Id: I417b8d77da3eb6ee1d2069ba94047210f75738bc
* 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