summaryrefslogtreecommitdiff
path: root/libs/binder/Status.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libbinder: Status - fix read at end of ParcelSteven Moreland2022-06-071-2/+8
| | | | | | | | | | | Due to OBO (actually off by 4), a Status at the end of the Parcel with exception information would be reduced to EX_TRANSACTION_FAILED in native code. Bug: 235006086 Bug: 132650049 Test: connectivity_native_test, binder_parcel_fuzzer (for a few minutes), aidl_integration_test Change-Id: I5660958006d7670ad6fc3aabde725cd1d8fe188a
* libbinder: Status writeOverParcelSteven Moreland2022-02-031-0/+6
| | | | | | | | For errors written to the parcel late. Bug: 211823183 Test: aidl_integration_test Change-Id: I036a016e143408bf1c3cb4f67f622c7e0dac91bf
* libbinder: Status - allow null errorsSteven Moreland2021-07-131-2/+2
| | | | | | | | | | | | | | Java Throwable getMessage can (and will!) return null, and when this happens, we don't get any error information in the native world. So, for instance, Java ServiceException won't be reported to native code. This is technically a backwards incompatible change, and we'll have to watch for breakages, but losing service specific exceptions in such a clearly egregious way is not acceptable. :) Fixes: 178861468 Test: boot & aidl_integration_test Change-Id: If70d8fb445078c2989c4288c01055bb7191a012f
* libbinder: Status s/stringstream/ostream/Steven Moreland2020-11-131-5/+0
| | | | | | | | | | | | stringstream extends ostream, so this is just generally more useful. I'm tired of having to lookup that I need to use 'Status::toString8' in order to print it out. Test: m camera_client_test (uses API, motived last change here) Test: grep most internal prebuilts for _ZN7android6binderlsERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_6StatusE Change-Id: I7ed88a3ecf8b560302697e4c5c2357acc05c20fa
* Status: don't ignore status in writeToParcelSteven Moreland2020-04-101-1/+3
| | | | | | | | While it may be safe in practice, we should not rely on it. Bug: n/A Test: n/A Change-Id: Id33d577f64449b966bdf6327c9a37886b435ed7c
* Status: toString8, include stringified status_tSteven Moreland2019-11-151-2/+3
| | | | | | | | "-2147483640" is not a clear error message. "UNEXPECTED_NULL" is. Bug: 144534032 Test: TH Change-Id: I235bb1abb88481ffba4c140c27223077880e4dd0
* DO NOT MERGE - Merge pie-platform-release (PPRL.190801.002) into masterXin Li2019-08-131-2/+29
|\ | | | | | | | | Bug: 139369544 Change-Id: I24c88d4bc056d8440d6de94488fb3d7fd6ad5200
| * libbinder: Status: check dataPosition sets.Steven Moreland2019-06-121-2/+29
| | | | | | | | | | | | | | | | Bug: 132650049 Test: fuzzer Change-Id: Id230eae4316a444bc82b416b2049d5a5f589f89a Merged-In: Id230eae4316a444bc82b416b2049d5a5f589f89a (cherry picked from commit 509e0e02730a609c91282625c50a21f731d0f23d)
* | Add exceptionToString method into binder::StatusJeongik Cha2019-03-191-1/+21
| | | | | | | | | | | | | | | | | | | | String exceptionToString(int32_t exceptionCode) Add this method for logging purpose Test: m -j Bug: 127187108 Change-Id: I911c3a667ddbe39245e5c3bbbd09154b2902aad8
* | libbinder: no 'okay' EX_TRANSACTION_FAILEDSteven Moreland2018-10-081-2/+8
| | | | | | | | | | | | | | | | When EX_TRANSACTION_FAILED is set, mError will never be okay. Bug: 116618418 Test: atest android.binder.cts Change-Id: If44ba1fa82cce836f4ee4faad117a1e6b24bf8de
* | libbinder: Status writeToParcel no OK on ERRSteven Moreland2018-09-251-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, it's possible to have Status such that: - mException = EX_TRANSACTION_FAILED - mErrorCode = OK When this happens, writeToParcel will return OK and also not write anything to the parcel. From the comment here: // Something really bad has happened, and we're not going to even // try returning rich error data. The intention here is to use the status_t return from transact for error messages and also not have clients read the parcel. For instance, here is the AIDL generated code (primary user of this API): ::android::status_t _aidl_ret_status = ::android::OK; switch (_aidl_code) { case ...: { ... ::android::binder::Status _aidl_status(TestVoidReturn()); _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply); if (((_aidl_ret_status) != (::android::OK))) { break; } if (!_aidl_status.isOk()) { break; } } ... } return _aidl_ret_status; As you can see, if writeToParcel returns OK for a non-okay transaction, the transaction will be considered okay. In general, this doesn't cause a problem since readToParcel will fail, but the error would be confusing (out of space). Bug: 111445392 Test: libbinder NDK's runtests.sh Test: AIDL's runtests.sh Change-Id: I4699999cb2482b357ae0eab278d8e4aaa66b83aa
* Provide remote stack trace informationFyodor Kupolov2017-11-131-0/+10
| | | | | | | | | | | | | | | | The stack is truncated up to 5 lines at parcel time. When unparceling, a separate RemoteException will be created and set as a cause of the exception being thrown. Performance results(in nanoseconds): timeWriteExceptionWithStackTraceParceling 82175 timeWriteException 6616 timeReadException 22529 timeReadExceptionWithStackTraceParceling 34151 Test: manual + ParcelPerfTest Bug: 36561158 Change-Id: I9c0a54a86cd82cff92d8e1a15ec19dfed58ef856
* Add Binder support for Parcelable exceptions.Jeff Sharkey2017-01-171-4/+15
| | | | | | | | | Follow the new framework changes that support sending EX_PARCELABLE exception types. Test: builds, boots Bug: 33749182 Change-Id: I7a856fa89f23aab4f782c4e5ae2beb8166fa8da4
* libbinder: Use char* message with binder::StatusChristopher Wiley2016-05-061-0/+10
| | | | | Bug: None Change-Id: Idcb8345cda2bf18960c1c437b7a6de4ec17b59fe
* libbinder: Remove templated binder::Status stream operator.Ralph Nathan2016-04-131-0/+5
| | | | | | | | | | | The templated binder::Status stream operator doesn't work with gmock because of ambiguous operator overloading. Limiting the stream operator to just std::stringstream allows it to be used with gmock. BUG=28171901 TEST=Compiles with gmock and CameraBinderTests Change-Id: Ia674b68cbff4911b3f5cc3d8ee57d04a1d6cf6bf
* libbinder: Enable service specific error codesChristopher Wiley2015-12-091-11/+43
| | | | | | | | | | Add another factory method that takes a message and service specific error code. Bug: 25800533 Test: system/tools/aidl integration tests pass Change-Id: I592cb7def0538576965d14c200ab58548b3bef32
* libbinder: Handle transaction failures correctlyChristopher Wiley2015-12-031-37/+34
| | | | | | | | | | | | | | | | | | | Java code expects status_t != OK to be caught at the JNI level in android_util_Binder.cpp (see signalExceptionForError). We were incorrectly mapping this kind of failure to a special exception type and writing that exception type to parcels. Instead, refuse to write EX_TRANSACTION_FAILED to a parcel and return the status value instead. While here, remove non-trivial constructors to push authors toward the more explicit factory methods. Remove getException() and push authors toward using the simpler getter methods. Fix minor camelCase issues. Bug: 25615695 Test: system/tools/aidl integration tests still pass Change-Id: I7cad3ac8ae8300b5ac0b466606f4934d01e503c5
* libbinder: Add binder::Status typeChristopher Wiley2015-11-171-0/+133
This object implements equivalent functionality to the Java logic which serializes and re-throws exceptions from services. Bug: 25615695 Test: Integration test for generated AIDL code reveals this to work correctly. Change-Id: Ic80c9def0dd232582ea9c49717ec50894af6bfc2