audio: Use auto-generated MicrophoneInfoFw class
Replace use of manually written MicrophoneInfo class
with MicrophoneInfoFw which is generated automatically
from the AIDL definition.
Rename MicrophoneInfoData AIDL to MicrophoneInfoFw for
consistency with other framework-side AIDL types.
MicrophoneInfoFw is defined using stable shared data
types.
Bug: 263964254
Test: atest audio_aidl_conversion_tests
Change-Id: I93e4fe08fc294350c9b06f2959f84b24f31f6881
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 7bb0fd3..3b73333 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2857,7 +2857,7 @@
return mAudioManager.load();
}
-status_t AudioFlinger::getMicrophones(std::vector<media::MicrophoneInfo> *microphones)
+status_t AudioFlinger::getMicrophones(std::vector<media::MicrophoneInfoFw> *microphones)
{
AutoMutex lock(mHardwareLock);
status_t status = INVALID_OPERATION;
@@ -2870,8 +2870,12 @@
mHardwareStatus = AUDIO_HW_IDLE;
if (devStatus == NO_ERROR) {
// report success if at least one HW module supports the function.
- std::transform(mics.begin(), mics.end(), std::back_inserter(*microphones),
- [](auto& mic) { return media::MicrophoneInfo(mic); });
+ std::transform(mics.begin(), mics.end(), std::back_inserter(*microphones), [](auto& mic)
+ {
+ auto microphone =
+ legacy2aidl_audio_microphone_characteristic_t_MicrophoneInfoFw(mic);
+ return microphone.ok() ? microphone.value() : media::MicrophoneInfoFw{};
+ });
status = NO_ERROR;
}
}