[AudioServer] Fix CTS for volume groups based on non public streams

This CL fixes VolumeGroup CTS by preventing to set the volume per
stream for group associated to a non public stream type.

Test: run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioProductStrategyTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioVolumeGroupTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioVolumeGroupChangeHandlerTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testPermissionsForVolumePerAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testGetAndValidateProductStrategies
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testGetAndValidateVolumeGroups
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testSetGetVolumePerAttributesWithInvalidAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testSetGetVolumePerAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testVolumeGroupCallback

Change-Id: I53d9d2d4d7591300bf364d591412b548356cd118
Merged-In: I53d9d2d4d7591300bf364d591412b548356cd118
This commit is contained in:
François Gaffie
2019-10-03 14:48:11 +02:00
committed by Francois Gaffie
parent e99aa91e87
commit e0487fa88d

View File

@@ -2135,6 +2135,13 @@ public class AudioService extends IAudioService.Stub
// For legacy reason, propagate to all streams associated to this volume group
for (final int groupedStream : vgs.getLegacyStreamTypes()) {
try {
ensureValidStreamType(groupedStream);
} catch (IllegalArgumentException e) {
Log.d(TAG, "volume group " + volumeGroup + " has internal streams (" + groupedStream
+ "), do not change associated stream volume");
continue;
}
setStreamVolume(groupedStream, index, flags, callingPackage, callingPackage,
Binder.getCallingUid());
}