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

Commit f340f3a0 authored by Eric Laurent's avatar Eric Laurent Committed by Gerrit Code Review
Browse files

Merge changes I3aab572e,Iff9abda2

* changes:
  [AudioServer][Strategies] Fix Min/Max index overwritting
  AudioSystem: add annotation on API used by CTS media
parents 99f24661 2645982d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1200,6 +1200,13 @@ package android.media {
    ctor public AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String);
  }

  public class AudioSystem {
    method public static float getMasterBalance();
    method public static final int getNumStreamTypes();
    method public static int setMasterBalance(float);
    field public static final int STREAM_DEFAULT = -1; // 0xffffffff
  }

  public static final class AudioTrack.MetricsConstants {
    field public static final String ATTRIBUTES = "android.media.audiotrack.attributes";
    field public static final String CHANNEL_MASK = "android.media.audiotrack.channelMask";
+17 −4
Original line number Diff line number Diff line
@@ -85,10 +85,23 @@ static jint convertAudioProductStrategiesFromNative(
    jStrategyId = static_cast<jint>(strategy.getId());

    // Audio Attributes Group array
    std::map<int, std::vector<AudioAttributes> > groups;
    int attrGroupIndex = 0;
    std::map<int /**attributesGroupIndex*/, std::vector<AudioAttributes> > groups;
    for (const auto &attr : strategy.getAudioAttributes()) {
        int attrGroupId = attr.getGroupId();
        groups[attrGroupId].push_back(attr);
        int groupId = attr.getGroupId();
        int streamType = attr.getStreamType();
        const auto &iter = std::find_if(begin(groups), end(groups),
                                        [groupId, streamType](const auto &iter) {
            const auto &frontAttr = iter.second.front();
            return frontAttr.getGroupId() == groupId && frontAttr.getStreamType() == streamType;
        });
        // Same Volume Group Id and same stream type
        if (iter != end(groups)) {
             groups[iter->first].push_back(attr);
        } else {
            // Add a new Group of AudioAttributes for this product strategy
            groups[attrGroupIndex++].push_back(attr);
        }
    }
    numAttributesGroups = groups.size();

@@ -97,7 +110,7 @@ static jint convertAudioProductStrategiesFromNative(
    for (const auto &iter : groups) {
        std::vector<AudioAttributes> audioAttributesGroups = iter.second;
        jint numAttributes = audioAttributesGroups.size();
        jint jGroupId = iter.first;
        jint jGroupId = audioAttributesGroups.front().getGroupId();
        jint jLegacyStreamType = audioAttributesGroups.front().getStreamType();

        jStatus = JNIAudioAttributeHelper::getJavaArray(env, &jAudioAttributes, numAttributes);
+320 −137

File changed.

Preview size limit exceeded, changes collapsed.