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

Commit 8da21391 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioManager: fix AudioPort gain query" into lmp-preview-dev

parents 4021b3ba b4e0909f
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -3184,15 +3184,11 @@ public class AudioManager {
                do {
                    newPorts.clear();
                    status = AudioSystem.listAudioPorts(newPorts, portGeneration);
                    Log.i(TAG, "updateAudioPortCache AudioSystem.listAudioPorts() status: "+
                                    status+" num ports: "+ newPorts.size() +" portGeneration: "+portGeneration[0]);
                    if (status != SUCCESS) {
                        return status;
                    }
                    newPatches.clear();
                    status = AudioSystem.listAudioPatches(newPatches, patchGeneration);
                    Log.i(TAG, "updateAudioPortCache AudioSystem.listAudioPatches() status: "+
                            status+" num patches: "+ newPatches.size() +" patchGeneration: "+patchGeneration[0]);
                    if (status != SUCCESS) {
                        return status;
                    }
@@ -3200,14 +3196,16 @@ public class AudioManager {

                for (int i = 0; i < newPatches.size(); i++) {
                    for (int j = 0; j < newPatches.get(i).sources().length; j++) {
                        AudioPortConfig portCfg = updatePortConfig(newPatches.get(i).sources()[j], newPorts);
                        AudioPortConfig portCfg = updatePortConfig(newPatches.get(i).sources()[j],
                                                                   newPorts);
                        if (portCfg == null) {
                            return ERROR;
                        }
                        newPatches.get(i).sources()[j] = portCfg;
                    }
                    for (int j = 0; j < newPatches.get(i).sinks().length; j++) {
                        AudioPortConfig portCfg = updatePortConfig(newPatches.get(i).sinks()[j], newPorts);
                        AudioPortConfig portCfg = updatePortConfig(newPatches.get(i).sinks()[j],
                                                                   newPorts);
                        if (portCfg == null) {
                            return ERROR;
                        }
@@ -3238,8 +3236,6 @@ public class AudioManager {
            // compare handles because the port returned by JNI is not of the correct
            // subclass
            if (ports.get(k).handle().equals(port.handle())) {
                Log.i(TAG, "updatePortConfig match found for port handle: "+
                            port.handle().id()+" port: "+ k);
                port = ports.get(k);
                break;
            }
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ public class AudioPort {
     * Get the gain descriptor at a given index
     */
    AudioGain gain(int index) {
        if (index < mGains.length) {
        if (index < 0 || index >= mGains.length) {
            return null;
        }
        return mGains[index];