APM: add more logging when setting stream to drive abs vol
Also using iterator for getting the map value instead of direct access.
Flag: EXEMPT bugfix
Test: manual check of logs
Bug: 361461410
Change-Id: I16570cb31e74c98b9ae210571da90b2fe457a71e
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 13db5b3..62cb6c7 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3556,6 +3556,9 @@
bool enabled,
audio_stream_type_t streamToDriveAbs)
{
+ ALOGI("%s: deviceType 0x%X, enabled %d, streamToDriveAbs %d", __func__, deviceType, enabled,
+ streamToDriveAbs);
+
if (!enabled) {
mAbsoluteVolumeDrivingStreams.erase(deviceType);
return NO_ERROR;
@@ -8312,9 +8315,9 @@
float volumeDb = curves.volIndexToDb(deviceCategory, index);
if (com_android_media_audio_abs_volume_index_fix()) {
- if (mAbsoluteVolumeDrivingStreams.find(volumeDevice) !=
- mAbsoluteVolumeDrivingStreams.end()) {
- audio_attributes_t attributesToDriveAbs = mAbsoluteVolumeDrivingStreams[volumeDevice];
+ const auto it = mAbsoluteVolumeDrivingStreams.find(volumeDevice);
+ if (it != mAbsoluteVolumeDrivingStreams.end()) {
+ audio_attributes_t attributesToDriveAbs = it->second;
auto groupToDriveAbs = mEngine->getVolumeGroupForAttributes(attributesToDriveAbs);
if (groupToDriveAbs == VOLUME_GROUP_NONE) {
ALOGD("%s: no group matching with %s", __FUNCTION__,
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 8fbe1cc..a8aefb0 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -1121,6 +1121,9 @@
Status AudioPolicyService::setDeviceAbsoluteVolumeEnabled(const AudioDevice& deviceAidl,
bool enabled,
AudioStreamType streamToDriveAbsAidl) {
+ ALOGI("%s: deviceAidl %s, enabled %d, streamToDriveAbsAidl %d", __func__,
+ deviceAidl.toString().c_str(), enabled, streamToDriveAbsAidl);
+
audio_stream_type_t streamToDriveAbs = VALUE_OR_RETURN_BINDER_STATUS(
aidl2legacy_AudioStreamType_audio_stream_type_t(streamToDriveAbsAidl));
audio_devices_t deviceType;