Add sound trigger control by audio policy
Audio policy:
- Added active capture indication to sound trigger service:
recognition stops if concurrent capture is not supported.
- Added generation of reserved I/O handle and session ID for
utterance capture.
Sound trigger service
- Added sound model update callback handling.
- Added service state callback
- Simplified callback shared memory allocation.
Bug: 12378680.
Change-Id: Ib0292c2733e6df90fdae480633dd9953d0016ef1
diff --git a/soundtrigger/ISoundTriggerHwService.cpp b/soundtrigger/ISoundTriggerHwService.cpp
index c9a0c24..05728e9 100644
--- a/soundtrigger/ISoundTriggerHwService.cpp
+++ b/soundtrigger/ISoundTriggerHwService.cpp
@@ -37,6 +37,7 @@
enum {
LIST_MODULES = IBinder::FIRST_CALL_TRANSACTION,
ATTACH,
+ SET_CAPTURE_STATE,
};
class BpSoundTriggerHwService: public BpInterface<ISoundTriggerHwService>
@@ -90,6 +91,18 @@
return status;
}
+ virtual status_t setCaptureState(bool active)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(ISoundTriggerHwService::getInterfaceDescriptor());
+ data.writeInt32(active);
+ status_t status = remote()->transact(SET_CAPTURE_STATE, data, &reply);
+ if (status == NO_ERROR) {
+ status = reply.readInt32();
+ }
+ return status;
+ }
+
};
IMPLEMENT_META_INTERFACE(SoundTriggerHwService, "android.hardware.ISoundTriggerHwService");
@@ -140,6 +153,13 @@
}
return NO_ERROR;
} break;
+
+ case SET_CAPTURE_STATE: {
+ CHECK_INTERFACE(ISoundTriggerHwService, data, reply);
+ reply->writeInt32(setCaptureState((bool)data.readInt32()));
+ return NO_ERROR;
+ } break;
+
default:
return BBinder::onTransact(code, data, reply, flags);
}