diff options
| author | 2018-09-25 09:15:21 -0700 | |
|---|---|---|
| committer | 2018-09-25 11:29:42 -0700 | |
| commit | 4ca4621f7a75844d85ff4b8c6b2a63d5aa993fa4 (patch) | |
| tree | 683ee3bf59b1fad87b96289f826db45b27676628 /libs/binderthreadstate/IPCThreadStateBase.cpp | |
| parent | 85eaa63b1d122790d364ae02cdc8a8c2f1e73cf3 (diff) | |
libbinder: Status writeToParcel no OK on ERR
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
Diffstat (limited to 'libs/binderthreadstate/IPCThreadStateBase.cpp')
0 files changed, 0 insertions, 0 deletions