audio policy: Fix handling of external device connection failure

The cleanup code in 'APM::setDeviceConnectionStateInt' was detaching
the external device prior to sending an update to HALs. As a result,
HALs were receiving an empty device address.

Bug: 333196025
Test: atest audiopolicy_tests
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f88c2f334abc5a40352c4141347e7a8eb62794d7)
Merged-In: I76e8303f81d1d27484a62c073128600fb7718bab
Change-Id: I76e8303f81d1d27484a62c073128600fb7718bab
4 files changed