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

Commit fdd15ef6 authored by Francois Gaffie's avatar Francois Gaffie
Browse files

[BUG] AudioService: fix stategy/groups attributes introspection



Strategies/volume groups are based on attributes to be identified.
Some strategies/groups rely only on AudioAttributes flags to be
identified (e.g. BLUETOOTH SCO).
AudioAttributes#Builder#setFlags has been enforced to prevent
from public API setting non public flags.
However, from JNI introspection API, it is required to be able to
set all flags.

This CL fixes this by using replaceFlags API in AudioAttributes.

Signed-off-by: default avatarFrancois Gaffie <francois.gaffie@renault.com>
Change-Id: I8492e8ddcb8eb0d03bbb2a539a631694b3f64196
parent a1afeb69
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ static struct {
    jmethodID setSystemUsage;
    jmethodID setInternalCapturePreset;
    jmethodID setContentType;
    jmethodID setFlags;
    jmethodID replaceFlags;
    jmethodID addTag;
} gAudioAttributesBuilderMethods;

@@ -130,7 +130,7 @@ static jint nativeAudioAttributesToJavaAudioAttributes(
                          gAudioAttributesBuilderMethods.setContentType,
                          attributes.content_type);
    env->CallObjectMethod(jAttributeBuilder.get(),
                          gAudioAttributesBuilderMethods.setFlags,
                          gAudioAttributesBuilderMethods.replaceFlags,
                          attributes.flags);
    env->CallObjectMethod(jAttributeBuilder.get(),
                          gAudioAttributesBuilderMethods.addTag,
@@ -205,8 +205,8 @@ int register_android_media_AudioAttributes(JNIEnv *env)
    gAudioAttributesBuilderMethods.setContentType = GetMethodIDOrDie(
                env, audioAttributesBuilderClass, "setContentType",
                "(I)Landroid/media/AudioAttributes$Builder;");
    gAudioAttributesBuilderMethods.setFlags = GetMethodIDOrDie(
                env, audioAttributesBuilderClass, "setFlags",
    gAudioAttributesBuilderMethods.replaceFlags = GetMethodIDOrDie(
                env, audioAttributesBuilderClass, "replaceFlags",
                "(I)Landroid/media/AudioAttributes$Builder;");
    gAudioAttributesBuilderMethods.addTag = GetMethodIDOrDie(
                env, audioAttributesBuilderClass, "addTag",