[audiopolicy][managerdefault] Filter unknown stream for volume settings

Stream for which no attributes is associated (aka no strategy supports it)
will use default attributes hence it will change the default strategy
volume (aka Music).
It leads to eroneous volume changes.
This bug does not happen on phone / tablets targets as all streams are
linked to a strategy with specifc attributes.
In case of OEM configuration, some stream types may not be supported
and associated to any strategy.

Bug: 136121584
Test: dumpsys audio & dumpsus media.audio_policy.
    Ensure volumes of stream types and their aliases match.

Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
Change-Id: I5e12b2c7248074d10affb6c28d1866d4589cb9e8
Merged-In: I5e12b2c7248074d10affb6c28d1866d4589cb9e8
gugelfrei
Eric Laurent 4 years ago
parent fd5779fa71
commit 242a9f8db1

@ -2457,6 +2457,10 @@ status_t AudioPolicyManager::setStreamVolumeIndex(audio_stream_type_t stream,
audio_devices_t device)
{
auto attributes = mEngine->getAttributesForStreamType(stream);
if (attributes == AUDIO_ATTRIBUTES_INITIALIZER) {
ALOGW("%s: no group for stream %s, bailing out", __func__, toString(stream).c_str());
return NO_ERROR;
}
ALOGV("%s: stream %s attributes=%s", __func__,
toString(stream).c_str(), toString(attributes).c_str());
return setVolumeIndexForAttributes(attributes, index, device);

Loading…
Cancel
Save