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

Commit 66ef06aa authored by Eric Laurent's avatar Eric Laurent
Browse files

soundtrigger JNI: fix AudioFormat channel mask

Bug: 115507927
Test: OK google detection
Change-Id: Ic1dd6bd814a1f1efbbf7d476d8426e9aa65a7906
parent 2da69198
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -221,12 +221,23 @@ void JNISoundTriggerCallback::onRecognitionEvent(struct sound_trigger_recognitio

    jobject jAudioFormat = NULL;
    if (event->trigger_in_data || event->capture_available) {
        jint channelMask = (jint)audio_channel_mask_get_bits(event->audio_config.channel_mask);
        jint channelIndexMask = (jint)AUDIO_CHANNEL_NONE;

        switch (audio_channel_mask_get_representation(event->audio_config.channel_mask)) {
        case AUDIO_CHANNEL_REPRESENTATION_INDEX:
            channelIndexMask = channelMask;
            channelMask = (jint)AUDIO_CHANNEL_NONE;
            break;
        default:
            break;
        }
        jAudioFormat = env->NewObject(gAudioFormatClass,
                                    gAudioFormatCstor,
                                    audioFormatFromNative(event->audio_config.format),
                                    event->audio_config.sample_rate,
                                    inChannelMaskFromNative(event->audio_config.channel_mask),
                                    (jint)0 /* channelIndexMask */);
                                    channelMask,
                                    channelIndexMask);

    }
    if (event->type == SOUND_MODEL_TYPE_KEYPHRASE) {