audio: Fix connection between alsa_device_profile and _proxy
alsa_device_proxy keeps a pointer to alsa_device_proxy,
but does not own it. Thus, the lifetime of the proxy must
be no less than of the proxy. In the legacy USB HAL impl
they were stored together (struct alsa_device_info).
Implement an equivalent class (DeviceProxy) in ALSA utils.
Bug: 264712385
Bug: 298712227
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I4e36701752afb3f35664b6f2ad1acda5719be1ea
diff --git a/audio/aidl/default/alsa/StreamAlsa.cpp b/audio/aidl/default/alsa/StreamAlsa.cpp
index 0605d6f..403b94b 100644
--- a/audio/aidl/default/alsa/StreamAlsa.cpp
+++ b/audio/aidl/default/alsa/StreamAlsa.cpp
@@ -83,7 +83,7 @@
proxy = alsa::openProxyForAttachedDevice(
device, const_cast<struct pcm_config*>(&mConfig.value()), mBufferSizeFrames);
}
- if (!proxy) {
+ if (proxy.get() == nullptr) {
return ::android::NO_INIT;
}
alsaDeviceProxies.push_back(std::move(proxy));