audioflinger: unsynchronized stop and destroy handling for record track. A12 migration

Summary: AudioRecord destroy is expected to be called
either after stop is handled or without stop.
When an unsynchronized destroy is handled prior
to stop, track is terminated from tracks list
with an expectation that RecordThread loop
removes the track from active tracks list.
With stop handled post destroy, this command
handler waits on mStartStopCondition. Meanwhile,
RecordThread loop looks for terminated tracks
and removes track from active tracks list and
sleeps without signalling the condition to unblock. As
record thread lock is acquired in stop and waiting on a
condition, subsequent command handler needing the
thread lock waits and times out.
Log the unsynchronized stop handling and exit
without waiting on mStartStopCondition as the track
is destroyed and removed from active
tracks list in record threadloop.

Flag: EXEMPT bugfix
Test: atest AudioRecordTest
Bug: 418777352
Change-Id: I3bff992bc96d769c7f06272b630eaecea538908c
Signed-off-by: Abdelrahman Daim <adaim@meta.com>
1 file changed