Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c5d09c4 authored by Eric Laurent's avatar Eric Laurent
Browse files

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

Change-Id: If6e0b5ba576f3fdf89480205639b1c2a4b722456
parent 12421fe9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;