Avoid risk of deadlock between APM and sound trigger

Sound trigger calls into audio policy manager (APM) for the sake of
allocating and releasing audio sessions.
APM calls into sound trigger for the sake of notifying it of
external capture session start/end.

Both calls are essentially synchronous, i.e. required for the
completion of the operations that trigger them.
Since both services use coarse locks to protect their state, if both
those calls happen concurrently, a deadlock would result.

The fix is to invoke
AudioPolicyManager::{acquire/release}SoundTriggerSession()
outside of the critical section of SoundTriggerModule.

Bug: 148691451
Change-Id: I157367b9e43963e37344958e1647e9f6c29d5e6e
1 file changed