Android Security 10.0.0 Release 54 (7250004)
aaudio: fix race when disconnecting

When disconnecting more than one stream,
and the apps reopen the streams,
there was a race condition that resulted
in the first app getting a Legacy stream instead of an
MMAP stream. That is because it was disconnected before the
other streams had stopped.

Now we run the stop loop before the disconnect loop
to prevent the race.

Bug: 153358911
Bug: 158316262
Test: test_steal_exclusive -r0 -d0 -s
Change-Id: Ib8efde9c2f94f6ab1ba3475d88b45d373cc8d3bb
Merged-In: Ib8efde9c2f94f6ab1ba3475d88b45d373cc8d3bb
(cherry picked from commit 8e2255ad97be8c5665b6bc8973d37c241fb5814b)
(cherry picked from commit 50fd22f3d7eaf0b8dba49e88e1feb6aa99005cff)
1 file changed