Fix BINDER_LIB_TEST_NOP_CALL_BACK.
To write in the request Parcel instead of the reply Parcel.
Also fixed reading the callback return value to use
readInt32(&...), so we correctly set the status if
there was no data in the Parcel.
Test: binderLibTest passes
Change-Id: I1c5b075b6f1f6d19c40e7bf9589a94809ce414ff
diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp
index 218b37e..1425940 100644
--- a/libs/binder/tests/binderLibTest.cpp
+++ b/libs/binder/tests/binderLibTest.cpp
@@ -331,10 +331,14 @@
(void)reply;
(void)flags;
switch(code) {
- case BINDER_LIB_TEST_CALL_BACK:
- m_result = data.readInt32();
+ case BINDER_LIB_TEST_CALL_BACK: {
+ status_t status = data.readInt32(&m_result);
+ if (status != NO_ERROR) {
+ m_result = status;
+ }
triggerEvent();
return NO_ERROR;
+ }
case BINDER_LIB_TEST_CALL_BACK_VERIFY_BUF: {
sp<IBinder> server;
int ret;
@@ -1044,7 +1048,7 @@
if (binder == NULL) {
return BAD_VALUE;
}
- reply2.writeInt32(NO_ERROR);
+ data2.writeInt32(NO_ERROR);
binder->transact(BINDER_LIB_TEST_CALL_BACK, data2, &reply2);
return NO_ERROR;
}