summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-10-05 17:21:00 -0700
committerEric Laurent <elaurent@google.com>2015-10-05 17:27:20 -0700
commit014620f143eda403795642dab116fb82bda54200 (patch)
tree6f1331f514774b4849471ebea4c5a9dfdb14f84c
parent4802c0c507681634aee38518581a080bfa443ae2 (diff)
downloadframeworks_av-014620f143eda403795642dab116fb82bda54200.zip
frameworks_av-014620f143eda403795642dab116fb82bda54200.tar.gz
frameworks_av-014620f143eda403795642dab116fb82bda54200.tar.bz2
SoundTrigger: fix binder call status reporting.
Bug: 24677430. Change-Id: Ife9b10e2d1acdb51099b21551e8c191fff7f75b4
-rw-r--r--soundtrigger/ISoundTrigger.cpp14
-rw-r--r--soundtrigger/ISoundTriggerHwService.cpp7
2 files changed, 13 insertions, 8 deletions
diff --git a/soundtrigger/ISoundTrigger.cpp b/soundtrigger/ISoundTrigger.cpp
index eecc1ea..4df2068 100644
--- a/soundtrigger/ISoundTrigger.cpp
+++ b/soundtrigger/ISoundTrigger.cpp
@@ -60,11 +60,13 @@ public:
data.writeInterfaceToken(ISoundTrigger::getInterfaceDescriptor());
data.writeStrongBinder(IInterface::asBinder(modelMemory));
status_t status = remote()->transact(LOAD_SOUND_MODEL, data, &reply);
- if (status != NO_ERROR ||
- (status = (status_t)reply.readInt32()) != NO_ERROR) {
+ if (status != NO_ERROR) {
return status;
}
- reply.read(handle, sizeof(sound_model_handle_t));
+ status = (status_t)reply.readInt32();
+ if (status == NO_ERROR) {
+ reply.read(handle, sizeof(sound_model_handle_t));
+ }
return status;
}
@@ -74,7 +76,7 @@ public:
data.writeInterfaceToken(ISoundTrigger::getInterfaceDescriptor());
data.write(&handle, sizeof(sound_model_handle_t));
status_t status = remote()->transact(UNLOAD_SOUND_MODEL, data, &reply);
- if (status != NO_ERROR) {
+ if (status == NO_ERROR) {
status = (status_t)reply.readInt32();
}
return status;
@@ -93,7 +95,7 @@ public:
}
data.writeStrongBinder(IInterface::asBinder(dataMemory));
status_t status = remote()->transact(START_RECOGNITION, data, &reply);
- if (status != NO_ERROR) {
+ if (status == NO_ERROR) {
status = (status_t)reply.readInt32();
}
return status;
@@ -105,7 +107,7 @@ public:
data.writeInterfaceToken(ISoundTrigger::getInterfaceDescriptor());
data.write(&handle, sizeof(sound_model_handle_t));
status_t status = remote()->transact(STOP_RECOGNITION, data, &reply);
- if (status != NO_ERROR) {
+ if (status == NO_ERROR) {
status = (status_t)reply.readInt32();
}
return status;
diff --git a/soundtrigger/ISoundTriggerHwService.cpp b/soundtrigger/ISoundTriggerHwService.cpp
index e14a771..e37bae3 100644
--- a/soundtrigger/ISoundTriggerHwService.cpp
+++ b/soundtrigger/ISoundTriggerHwService.cpp
@@ -85,8 +85,11 @@ public:
data.writeInterfaceToken(ISoundTriggerHwService::getInterfaceDescriptor());
data.write(&handle, sizeof(sound_trigger_module_handle_t));
data.writeStrongBinder(IInterface::asBinder(client));
- remote()->transact(ATTACH, data, &reply);
- status_t status = reply.readInt32();
+ status_t status = remote()->transact(ATTACH, data, &reply);
+ if (status != NO_ERROR) {
+ return status;
+ }
+ status = reply.readInt32();
if (reply.readInt32() != 0) {
module = interface_cast<ISoundTrigger>(reply.readStrongBinder());
}