Stub sound trigger hal fix for lock release.
Bug: 27279191
Change-Id: If339732cac782d85dc74dba9f1fb92c5a8d0c40d
diff --git a/modules/soundtrigger/sound_trigger_hw.c b/modules/soundtrigger/sound_trigger_hw.c
index a9dcf44..cfb275a 100644
--- a/modules/soundtrigger/sound_trigger_hw.c
+++ b/modules/soundtrigger/sound_trigger_hw.c
@@ -488,6 +488,9 @@
char buffer[PARSE_BUF_LEN];
FILE* input_fp = fdopen(conn_socket, "r");
bool continue_listening = true;
+
+ // Note: Since we acquire a lock inside this loop, do not use break or other
+ // exit methods without releasing this lock.
while(!input_done) {
if (fgets(buffer, PARSE_BUF_LEN, input_fp) != NULL) {
pthread_mutex_lock(&stdev->lock);
@@ -503,12 +506,12 @@
} else if (strncmp(command, COMMAND_CLOSE, 5) == 0) {
ALOGI("Closing this connection.");
write_string(conn_socket, "Closing this connection.");
- break;
+ input_done = true;
} else if (strncmp(command, COMMAND_END, 3) == 0) {
ALOGI("End command received.");
write_string(conn_socket, "End command received. Stopping connection.");
continue_listening = false;
- break;
+ input_done = true;
} else {
write_vastr(conn_socket, "Bad command %s.\n", command);
}