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

Commit 9189f5f0 authored by Mike Lockwood's avatar Mike Lockwood
Browse files

Add MidiDeviceInfo.getPortList()

This replaces MidiDeviceInfo.getInputPortInfo() and getOutputPortInfo()

Change-Id: I0a9bc7c34a172a072e86718d465967c6c618fb3b
parent d954fbb9
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -16762,9 +16762,8 @@ package android.media.midi {
    method public int describeContents();
    method public int getId();
    method public int getInputPortCount();
    method public android.media.midi.MidiDeviceInfo.PortInfo getInputPortInfo(int);
    method public int getOutputPortCount();
    method public android.media.midi.MidiDeviceInfo.PortInfo getOutputPortInfo(int);
    method public android.media.midi.MidiDeviceInfo.PortInfo[] getPortList();
    method public android.os.Bundle getProperties();
    method public int getType();
    method public boolean isPrivate();
+1 −2
Original line number Diff line number Diff line
@@ -18038,9 +18038,8 @@ package android.media.midi {
    method public int describeContents();
    method public int getId();
    method public int getInputPortCount();
    method public android.media.midi.MidiDeviceInfo.PortInfo getInputPortInfo(int);
    method public int getOutputPortCount();
    method public android.media.midi.MidiDeviceInfo.PortInfo getOutputPortInfo(int);
    method public android.media.midi.MidiDeviceInfo.PortInfo[] getPortList();
    method public android.os.Bundle getProperties();
    method public int getType();
    method public boolean isPrivate();
+13 −19
Original line number Diff line number Diff line
@@ -237,29 +237,23 @@ public final class MidiDeviceInfo implements Parcelable {
    }

    /**
     * Returns information about an input port.
     * Returns information about the device's ports.
     * The ports are in unspecified order.
     *
     * @param portNumber the number of the input port
     * @return the input port's information object
     * @return array of {@link PortInfo}
     */
    public PortInfo getInputPortInfo(int portNumber) {
        if (portNumber < 0 || portNumber >= mInputPortCount) {
            throw new IllegalArgumentException("portNumber out of range");
    public PortInfo[] getPortList() {
        PortInfo[] portInfoList = new PortInfo[mInputPortCount + mOutputPortCount];

        int index = 0;
        for (int i = 0; i < mInputPortCount; i++) {
            portInfoList[index++] = new PortInfo(PortInfo.TYPE_INPUT, i, mInputPortNames[i]);
        }
        return new PortInfo(PortInfo.TYPE_INPUT, portNumber, mInputPortNames[portNumber]);
        for (int i = 0; i < mOutputPortCount; i++) {
            portInfoList[index++] = new PortInfo(PortInfo.TYPE_OUTPUT, i, mOutputPortNames[i]);
        }

    /**
     * Returns information about an output port.
     *
     * @param portNumber the number of the output port
     * @return the output port's information object
     */
    public PortInfo getOutputPortInfo(int portNumber) {
        if (portNumber < 0 || portNumber >= mOutputPortCount) {
            throw new IllegalArgumentException("portNumber out of range");
        }
        return new PortInfo(PortInfo.TYPE_OUTPUT, portNumber, mOutputPortNames[portNumber]);
        return portInfoList;
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ abstract public class MidiDeviceService extends Service {
    /**
     * Returns an array of {@link MidiReceiver} for the device's input ports.
     * Subclasses must override this to provide the receivers which will receive
     * data sent to the device's input ports. An empty array or null should be returned if
     * data sent to the device's input ports. An empty array should be returned if
     * the device has no input ports.
     * @return array of MidiReceivers
     */