APM: remove unnecessary check
STREAM_DEFAULT is actually a negative value. When casting to uint it
will result in a very large number which will fail the test for having a
consistent stream value before sending to APM.
Remove this check since the conversion code before checks for stream
validity.
Flag: EXEMPT bugfix
Test: manual
Bug: 361461410
Bug: 361576207
Change-Id: Ib023bdbcba48311a906128bd7394106a01e47dee
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index a8aefb0..0442cae 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -1124,8 +1124,12 @@
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_stream_type_t streamToDriveAbs = AUDIO_STREAM_DEFAULT;
+ if (enabled) {
+ streamToDriveAbs = VALUE_OR_RETURN_BINDER_STATUS(
+ aidl2legacy_AudioStreamType_audio_stream_type_t(streamToDriveAbsAidl));
+ }
+
audio_devices_t deviceType;
std::string address;
RETURN_BINDER_STATUS_IF_ERROR(
@@ -1139,9 +1143,7 @@
: settingsAllowed())) {
return binderStatusFromStatusT(PERMISSION_DENIED);
}
- if (uint32_t(streamToDriveAbs) >= AUDIO_STREAM_PUBLIC_CNT) {
- return binderStatusFromStatusT(BAD_VALUE);
- }
+
audio_utils::lock_guard _l(mMutex);
AutoCallerClear acc;
return binderStatusFromStatusT(