Audio: fix AudioVolumeGroup JNI
Fix volume group conversion from native to java
to make sure the audio source is properly initialized
to the default java value in a playback only context.
Bug: 249966139
Test: atest com.android.audiopolicytest
Test: atet com.google.android.gts.audioservice.AudioServiceHostTest#testAudioVolumeGroups
Merged-In: If6e0b5ba576f3fdf89480205639b1c2a4b722456
Change-Id: If6e0b5ba576f3fdf89480205639b1c2a4b722456
(cherry picked from commit 2c5d09c410)
This commit is contained in:
committed by
Mikhail Naganov
parent
d52e734a2e
commit
c02ca8d68d
@@ -94,6 +94,11 @@ static jint convertAudioVolumeGroupsFromNative(
|
||||
for (size_t j = 0; j < static_cast<size_t>(numAttributes); j++) {
|
||||
auto attributes = group.getAudioAttributes()[j];
|
||||
|
||||
// Native & Java audio attributes default initializers are not aligned for the source.
|
||||
// Given the volume group class concerns only playback, this field must be equal to the
|
||||
// default java initializer.
|
||||
attributes.source = AUDIO_SOURCE_INVALID;
|
||||
|
||||
jStatus = JNIAudioAttributeHelper::nativeToJava(env, &jAudioAttribute, attributes);
|
||||
if (jStatus != AUDIO_JAVA_SUCCESS) {
|
||||
goto exit;
|
||||
|
||||
Reference in New Issue
Block a user