AudioFlinger: fix capture stop sequence

Make sure that the HAL input stream is actually in standby when audio policy
is notified by stopInput().
There was a race condition where it was possible for a new capture stream to be started
in the interval between stopInput() notification and input stream going into
standby because of the state update and sleep sequence in the record thread loop.

Also make sure we interrupt the sleep period if a command is pending.

Bug: 29865791
Change-Id: Ife720fbd2e5d0df8792669dc724b1fd70f63ab8a
1 file changed