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

Commit 8eb40b65 authored by ESWAR MAGATAPALLI (xWF)'s avatar ESWAR MAGATAPALLI (xWF) Committed by Android (Google) Code Review
Browse files

Merge changes from topic "revert-33102662-STEP3_VOL_GROUP_IMPR-VKKRTPJBGK" into main

* changes:
  Revert "AudioProductStrategy / AudioVolumeGroups: filters internals"
  Revert "AudioProductStrategy: add a matching score API"
  Revert "Audio: add dump in AudioVolumeGroup and Strategy"
parents 0d42216b 39d41c88
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ static struct {
    jfieldID    mVolumeGroupId;
    jfieldID    mLegacyStreamType;
    jfieldID    mAudioAttributes;
    jfieldID    mStrategyId;
} gAudioAttributesGroupsFields;

static jclass gArrayListClass;
@@ -131,7 +130,6 @@ static jint convertAudioProductStrategiesFromNative(
                                                       gAudioAttributesGroupCstor,
                                                       jGroupId,
                                                       jLegacyStreamType,
                                                       jStrategyId,
                                                       jAudioAttributes);
        env->SetObjectArrayElement(jAudioAttributesGroups, indexGroup++, jAudioAttributesGroup);

@@ -241,13 +239,11 @@ int register_android_media_AudioProductStrategies(JNIEnv *env)
    jclass audioAttributesGroupClass = FindClassOrDie(env, kAudioAttributesGroupsClassPathName);
    gAudioAttributesGroupClass = MakeGlobalRefOrDie(env, audioAttributesGroupClass);
    gAudioAttributesGroupCstor = GetMethodIDOrDie(env, audioAttributesGroupClass, "<init>",
                                                  "(III[Landroid/media/AudioAttributes;)V");
                                                  "(II[Landroid/media/AudioAttributes;)V");
    gAudioAttributesGroupsFields.mVolumeGroupId = GetFieldIDOrDie(
                env, audioAttributesGroupClass, "mVolumeGroupId", "I");
    gAudioAttributesGroupsFields.mLegacyStreamType = GetFieldIDOrDie(
                env, audioAttributesGroupClass, "mLegacyStreamType", "I");
    gAudioAttributesGroupsFields.mStrategyId = GetFieldIDOrDie(
                env, audioAttributesGroupClass, "mProductStrategyId", "I");
    gAudioAttributesGroupsFields.mAudioAttributes = GetFieldIDOrDie(
                env, audioAttributesGroupClass, "mAudioAttributes",
                "[Landroid/media/AudioAttributes;");
+123 −329

File changed.

Preview size limit exceeded, changes collapsed.

+9 −18
Original line number Diff line number Diff line
@@ -85,19 +85,12 @@ public final class AudioVolumeGroup implements Parcelable {
        if (status != AudioSystem.SUCCESS) {
            Log.w(TAG, ": listAudioVolumeGroups failed");
        }
        avgList.removeIf(avg -> avg.isInternalGroup());
        return avgList;
    }

    private static native int native_list_audio_volume_groups(
            ArrayList<AudioVolumeGroup> groups);

    private boolean isInternalGroup() {
        return Arrays.stream(mAudioAttributes)
                .filter(aa -> AudioProductStrategy.isInternalAttributesForStrategy(aa))
                .findFirst().isPresent();
    }

    /**
     * @param name of the volume group
     * @param id of the volume group
@@ -207,23 +200,21 @@ public final class AudioVolumeGroup implements Parcelable {

    @Override
    public @NonNull String toString() {
        return toString("");
    }

    String toString(String indent) {
        StringBuilder s = new StringBuilder();
        s.append("\n").append(indent).append("Name: ").append(mName);
        s.append(" Id: ").append(mId);
        s.append("\n Name: ");
        s.append(mName);
        s.append(" Id: ");
        s.append(Integer.toString(mId));

        s.append("\n").append(indent).append(indent).append("Supported Audio Attributes:");
        s.append("\n     Supported Audio Attributes:");
        for (AudioAttributes attribute : mAudioAttributes) {
            s.append("\n").append(indent).append(indent).append(indent).append("-");
            s.append("\n       -");
            s.append(attribute.toString());
        }

        s.append("\n").append(indent).append(indent).append("Supported Legacy Stream Types: { ");
        s.append("\n     Supported Legacy Stream Types: { ");
        for (int legacyStreamType : mLegacyStreamTypes) {
            s.append(legacyStreamType).append(" ");
            s.append(Integer.toString(legacyStreamType));
            s.append(" ");
        }
        s.append("}");
        return s.toString();
+0 −2
Original line number Diff line number Diff line
@@ -13144,8 +13144,6 @@ public class AudioService extends IAudioService.Stub
        pw.println("\n");
        dumpSupportedSystemUsage(pw);
        AudioProductStrategy.dump(pw);
        pw.println("\n");
        pw.println("\nSpatial audio:");
        pw.println("mHasSpatializerEffect:" + mHasSpatializerEffect + " (effect present)");