summaryrefslogtreecommitdiffstats
path: root/core/jni/android_util_Binder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* binder: adjust GC interval for binder opsWei Wang2015-10-311-1/+1
| | | | | | | The current value is too conservative, and causes janks in certain use cases due to frequent explict GC. Change-Id: Iba8eecd4e8ed7dce879c144fdc4407c12f76a749
* Throw DeadObjectException on failed transaction, not RuntimeExceptionChristopher Tate2015-06-291-2/+4
| | | | | | | | | | | In practice we only see failed transactions with small payloads when the remote dies while the binder operation is in flight. Throw the applicable exception type rather than the generic "oops binder went haywire" one. Bug 22104446 Change-Id: I785c15617db7a1f4d505aa11f16e61551c8357ba
* Don't throw TransactionTooLargeException for small payloadsChristopher Tate2015-06-251-5/+15
| | | | | | | | | | | | | | | | | | In practice, if we ever see an apparent transaction-too-large result with a modest-sized payload, it means that the remote process died at just the right time (with the binder transaction already in flight so it wasn't detected as a DEAD_OBJECT up front). Don't throw TransactionTooLargeException in this case, because we really do need to distinguish that from dead-remote more accurately. In particular, certain common execution patterns on existing hardware trigger this circumstance, and they wind up crashing the system. This is bad, so now we avoid it unless we're pretty sure that is really what happened. Bug 21801759 Change-Id: Id05f1eecc0d23dc8d0505c402e2cb68396782135
* Improve reporting to apps of transaction too large failures.Dianne Hackborn2015-05-211-6/+9
| | | | | | | | | | | | | | | | | | | If the app tried to do various things with too much data -- starting an activity, starting a service, sending a broadcast -- this would fairly silently fail with little indication of what was going on. Fix this in two ways: - Now when the native code generates a TransactionTooLargeException, it may include an additional message in it telling you how much data was in the parcel being sent, to help you understand why this happening. - In all the framework code paths where we call to the system and may fail, convert these failures into a a runtime exception and rethrow them back to the app so that it will clearly get the above message. Change-Id: I745159b97d3edb6fca86aa09cbc40c1f15a7d128
* Close race condition in binderDied()Christopher Tate2015-05-191-5/+18
| | | | | | | | | | | | It was possible for a binderDied() call to occur while the death recipient list containing the object was being iterated, in which case we could invalidate an object reference out from under the iteration, causing a VM abort. We now interlock the binderDied() deref operation with the list's locking semantics to prevent this. Bug 15831054 Change-Id: If0027d3ac4da1153284a425dd9b2819a203481ab
* Properly describe exceptionMathieu Chartier2015-04-281-3/+1
| | | | | | | | | | | Previously we used DetachCurrentThread which raised a SIGABRT from within ART. The new approach is to use ExceptionDescribe and exit. Bug: 20640601 (cherry picked from commit d12065f581defd9e8199593e85aa2036a0713684) Change-Id: I00126b678ff296e0076247554af8328fe2767038
* Added watchdog monitor for Binder threads availability.Wale Ogunwale2015-04-141-1/+7
| | | | | | | | | The watchdog will trigger if all binder threads in the system_server are stuck for a long time (1min) preventing the process from handling additional IPC requests. Bug: 19297165 Change-Id: I5909a9c230bf23917feaed53f2b54bd50425bf3c
* Frameworks/base: Consistency in core/jniAndreas Gampe2014-11-211-5/+3
| | | | | | | | Make consistent use of core_jni_helpers for registration. Translate some #ifdefs into const bools. Change-Id: I37639aa053dd50f003a552cbd8550dddecc811c5
* Merge "Fix clang warnings in core/jni."Dan Albert2014-11-201-1/+0
|\
| * Fix clang warnings in core/jni.Dan Albert2014-11-201-1/+0
| | | | | | | | | | | | | | There are a few bugs in here too (mostly people expecting + to concatenate C strings) :( Change-Id: I0a243c05c4ea8b56e84896f37814d0fbea4c39d5
* | Add appropriate casts for char16_t.Dan Albert2014-11-201-1/+2
|/ | | | | | | | C++11 defines a real char16_t, which is not implicitly convertible to uint16_t (and by extension jchar). Add casts as needed. Bug: 18300613 Change-Id: I00752002ef2e938bdb57f70947e8fd53ec103293
* Frameworks/base: Replace LOG_FATAL_IF in core/jniAndreas Gampe2014-11-191-73/+39
| | | | | | | | | | Do not use LOG_FATAL_IF in JNI setup. This is one-time on startup and important enough to always check. Add a header with common helper definitions. Move to inlined functions instead of macros to clean up the code. Change-Id: Ib12d0eed61b110c45d748e80ec36c563e9dec7e5
* Frameworks/base: Wall Werror in core/jniAndreas Gampe2014-11-131-21/+18
| | | | | | | | | | | Turn on -Wall -Werror in core/jni. Fix warnings. Clang TODO: For GCC we need to turn off Wunused-but-set-variable in the GL bindings. However, Clang doesn't have that warning and thus complains about an unknown pragma. It is necessary to make the pragma #ifdef-ed on the compiler being GCC. Change-Id: I14cab48d45c2771eef0432082356c47ed44a3d7f
* am 9cf01b63: Merge "More work on issue #17656716: Unhandled exception in ↵Dianne Hackborn2014-09-301-11/+6
|\ | | | | | | | | | | | | Window Manager" into lmp-dev * commit '9cf01b63cb0023aec0e05b1ce050ff572532b876': More work on issue #17656716: Unhandled exception in Window Manager
| * More work on issue #17656716: Unhandled exception in Window ManagerDianne Hackborn2014-09-301-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | Drop down the limit on when we log, since under normal operation we will never get more than a few K of data due to strict mode. Try to clean up the code paths coming in and out of binder IPCs to plug any places where we could disrupt the gather flag of a thread, causing it to keep gathering stack crawls (which is the thing that is causing our strict mode data to become so large). Change-Id: I9a46512283d33e863c429840b465855d1fabb74e
* | am 0b1eb9d4: Merge "Work on issue #17656716: Unhandled exception in Window ↵Dianne Hackborn2014-09-261-1/+1
|\ \ | |/ | | | | | | | | | | Manager" into lmp-dev * commit '0b1eb9d4ae339629fbbf226160896a917cad4d0d': Work on issue #17656716: Unhandled exception in Window Manager
| * Work on issue #17656716: Unhandled exception in Window ManagerDianne Hackborn2014-09-251-1/+1
| | | | | | | | | | | | | | Create descriptive errors when sending unreasonably large parcels through IPC. Change-Id: Ie93b5372a8ed87541db282876c4eeeae69a1e8bd
| * Fix JNI error in exception reporting.Mathieu Chartier2014-08-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a JNI error where when you got an OOM and called report_exception, it would call two NewStringUTF in a row without checking the return values. This could mean that the first one threw a new OOME and the second one would cause a JNI error when it also attempted to throw an OOME with a pending OOME. Bug: 16843627 (cherry picked from commit cf6775eece8628ac069a6d4803e7f20a017e7e62) Change-Id: Ibdc7d0e55a48b2a61a1db0868a5d77c2ae53f6f3
* | am be39e991: am 977c4a5b: Merge "Clean up ExceptionOccurred."Mathieu Chartier2014-08-211-8/+8
|\ \ | | | | | | | | | | | | * commit 'be39e99187eec88222722e9ec4c91f1744731cf4': Clean up ExceptionOccurred.
| * | Clean up ExceptionOccurred.Mathieu Chartier2014-08-201-8/+8
| | | | | | | | | | | | | | | | | | | | | Use ExceptionCheck before ExceptionOccurred since ExceptionCheck doesn't acquire any locks and is faster. Change-Id: Ibd87fd1e33b339bd2a6effa1d20d3253c8a61bdc
* | | am 72d3cef8: am 708da446: Merge "Use gettid directly in frameworks JNI."Elliott Hughes2014-08-181-9/+2
|\ \ \ | |/ / | | | | | | | | | * commit '72d3cef8675b4a8eced300adeb148a835b7fdd57': Use gettid directly in frameworks JNI.
| * | Use gettid directly in frameworks JNI.Elliott Hughes2014-08-181-9/+2
| | | | | | | | | | | | | | | Bug: 17048545 Change-Id: I1cd45d85368c799b75f76e778722979cbbb68ed2
* | | am 021cf13e: am 7782c6b3: Merge "Fix JNI error in exception reporting."Mathieu Chartier2014-08-061-1/+4
|\ \ \ | |/ / | | / | |/ |/| * commit '021cf13e7abfb2fcf1bddf957d23ef1eda2ca191': Fix JNI error in exception reporting.
| * Fix JNI error in exception reporting.Mathieu Chartier2014-08-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | There was a JNI error where when you got an OOM and called report_exception, it would call two NewStringUTF in a row without checking the return values. This could mean that the first one threw a new OOME and the second one would cause a JNI error when it also attempted to throw an OOME with a pending OOME. Bug: 16843627 Change-Id: Ie4f9f9a5f8b7993cd3655d42a6718c0a5e1199f8
* | Battery stats more wake history, power save mode.Dianne Hackborn2014-05-151-0/+32
|/ | | | | | | | | | | | | Add new option for battery stats to record the full wake lock history, and recording the current power save mode. Also add in some additional error constants when generating Binder error exceptions. And fix issue #14974572: Avoid repeating wakeup_reason at the beginning of history Change-Id: I7c1a2ab9569de216634f63d8ad69f1294ef1d235
* jni: binder ptrdiff_t compile issuesMark Salyzyn2014-04-171-2/+2
| | | | Change-Id: Ibdd82479d3f9fb53cf1d6793c4f7353e8f1c3646
* jni: binder 64-bit compile issuesMark Salyzyn2014-04-171-9/+10
| | | | Change-Id: I8a3083e7e9389bbb84c2dd061fef059e0595800d
* AArch64: Make Binder and Parcel 64-bit compatibleAshok Bhat2014-01-231-24/+24
| | | | | | | | | | | | | | | | Changes include [x] Long is used to store native pointers [x] Added new method obtain(long obj) to Parcel. Binder uses this method instead of obtain(int obj). [x] obtain(int) has been changed to throw unsupported operation exception. Change-Id: I408e0f2a24deb28c9277d86670653a51eb314266 Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
* Merge "fix possible buffer overrun and memory leak"Elliott Hughes2013-12-111-4/+11
|\
| * fix possible buffer overrun and memory leakSungmin Choi2013-05-291-4/+11
| | | | | | | | | | | | Use snprintf instead of sprintf and fclose() before return. Change-Id: I3ed193464cc0dc90e9935ae19162667ad367628b
* | replace cutils/logger.h with log/logger.hColin Cross2013-07-241-1/+1
| | | | | | | | | | | | and remove it from files that don't use it. Change-Id: Ieb44a3f1f75c2d2b277f0d01ca926a92211e3fe6
* | Disable various sampling event logs.Jeff Sharkey2013-04-261-0/+5
| | | | | | | | | | | | They're unused at the moment. Change-Id: Ib629b405e7b6666d38fcd0ebaa16490bfb0e95f0
* | Fix reference cycle in InputEventReceiver and Sender.Jeff Brown2013-04-021-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | If the receiver or sender was not properly disposed, then the underlying input channel might be leaked because the native peer was holding a strong reference to the object. Switched to using a weak reference. Also updated Binder to use a new helper created for this purpose. Change-Id: I19680bf96d0548777bff02aa1d91874d1e8e41da
* | fix JNI use of incStrong/decStrongMathias Agopian2013-03-061-2/+2
|/ | | | Change-Id: Ia11b404dea483dc19bbc30f4d7bcff516655e180
* Remove Binder.getOrigCallingUid().Dianne Hackborn2012-08-311-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced all remaining places that used it with explicit user specification. While doing this, I ran into stuff that was creating PendingIntent objects (that now need to specify the explicit user they are for), which are also posting notifications... but have no way to specify the user for the notification. So the notification manager in the system process now also gets a formal concept of a user associated with the notification, which is passed in to all the necessary aidl calls. I also removed the old deprecated aidl interface for posting/cancelling notifications, since we now always need a user supplied. There is more work that needs to be done here, though. For example I think we need to be able to specify USER_ALL for a notification that should be shown to all users (such as low storage or low battery). Along with that, the PendingIntent creation needs to be tweaked to be able to handle USER_CURRENT by evaluating the user at the point the pending intent is sent. That's for another change, however. Change-Id: I468e14dce8def0e13e0870571e7c31ed32b6310c
* Add callback hack to find out when to load system properties.Dianne Hackborn2012-05-091-0/+6
| | | | | | | | Use this to reload the trace and layout bounds properties. This is ONLY for debugging. Change-Id: I1c4bdb52c823520c352c5bac45fa9ee31160793c
* Split Parcel JNI details away from Binder.Jeff Sharkey2012-03-081-656/+20
| | | | | | | This is purely a refactoring, with no change to the underlying functionality. Change-Id: I41b59f14e57d1cc144274a01f77658d99a1bfe02
* Multi-user - 1st major checkinAmith Yamasani2012-02-031-0/+6
| | | | | | | | | | | | | | | 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 (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-01-081-5/+5
| | | | | | | 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-061-8/+8
| | | | | | | 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-041-8/+8
| | | | | | | 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-031-1/+1
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* am 698d3de6: am e7de36e6: Merge "Throw TransactionTooLargeException when ↵Jeff Brown2011-11-101-8/+26
|\ | | | | | | | | | | | | Binder transaction fails. Bug: 5578022" into ics-mr1 * commit '698d3de681bf85047675baa61f9b28961f3d6862': Throw TransactionTooLargeException when Binder transaction fails. Bug: 5578022
| * Throw TransactionTooLargeException when Binder transaction fails.Jeff Brown2011-11-081-8/+26
| | | | | | | | | | | | | | | | | | | | | | Bug: 5578022 Previously, Binder transactions failed silently, which caused problems because apps would carry on assuming that the operation had succeeded. Often, the apps would crash soon due to a violated invariant, but sometimes they managed to do some damage first... Change-Id: Ia9cc98b3b761a8160e7c4e87507860b5912c0451
* | Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGESteve Block2011-10-261-14/+14
|/ | | | | | | See https://android-git.corp.google.com/g/#/c/143865 Bug: 5449033 Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
* Fix handling of "allow fds" state.Dianne Hackborn2011-10-031-3/+12
| | | | | | Didn't take into account nesting of bundles. Boo. Change-Id: Ic8cf21ad8d6f4938a3e105128624c9d162310d01
* Add mechanism for Parcel to not allow FDs to be written to it.Dianne Hackborn2011-10-031-12/+31
| | | | | | This is to help implement issue #5224703. Change-Id: I026a5890495537d15b57fe61227a640aac806d46
* Fix JNI for warning about failure to unlink DeathRecipientsChristopher Tate2011-08-301-16/+22
| | | | | | | | | We now (a) use the right Class getName() method, and (b) look it up once at setup time rather than doing that lookup every time we want to emit the warning. Verified to work properly and no longer crash or throw or otherwise complain. Change-Id: If0767f8845588ba7f34bac21474f4e2ad5c111d6
* Warn if we're tearing down "live" DeathRecipient content [take 2]Christopher Tate2011-08-261-1/+31
| | | | | | | | | | | | | | | | | | If the native-side bookkeeping still has strong references to VM-side DeathRecipient objects at the time when it's being torn down, that suggests that the app is doing unwholesome. Log a warning to that effect, with the class name of the objects to try to help the developer figure out what they're mishandling. Fixes bug 5202777 -- in particular, it no longer logs in the working-as-intended case following delivery of the death notices, when we've got the existing list shell but the weak refs have properly cleared. Also step down from "error" to "warning" logging as befits the nature of the actual situation now being described. This new patch fixes the JNI bug present in the earlier version. Change-Id: I095862777a8d0e3905cb7f416af658878280041d
* Revert "Warn only if we're tearing down "live" DeathRecipient content"Guang Zhu2011-08-241-25/+1
| | | This reverts commit 2611f89ab4f1119b96123edb2cd6d8d8139c03c4