Add MidiManager and MidiDevice classes to public API.
Somehow we missed these two when we made the rest of the MIDI Manager public
Change-Id: I08e94762e155aa6a7f98bd05b363aee5e4744061
diff --git a/api/current.txt b/api/current.txt
index b3d5fd0..bc0c5d5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -16718,6 +16718,18 @@
package android.media.midi {
+ public final class MidiDevice implements java.io.Closeable {
+ method public void close() throws java.io.IOException;
+ method public android.media.midi.MidiDevice.MidiConnection connectPorts(android.media.midi.MidiInputPort, int);
+ method public android.media.midi.MidiDeviceInfo getInfo();
+ method public android.media.midi.MidiInputPort openInputPort(int);
+ method public android.media.midi.MidiOutputPort openOutputPort(int);
+ }
+
+ public class MidiDevice.MidiConnection implements java.io.Closeable {
+ method public void close() throws java.io.IOException;
+ }
+
public final class MidiDeviceInfo implements android.os.Parcelable {
method public int describeContents();
method public int getId();
@@ -16774,6 +16786,25 @@
method public void onReceive(byte[], int, int, long) throws java.io.IOException;
}
+ public final class MidiManager {
+ method public android.media.midi.MidiDeviceInfo[] getDeviceList();
+ method public void openDevice(android.media.midi.MidiDeviceInfo, android.media.midi.MidiManager.DeviceOpenCallback, android.os.Handler);
+ method public void registerDeviceCallback(android.media.midi.MidiManager.DeviceCallback, android.os.Handler);
+ method public void unregisterDeviceCallback(android.media.midi.MidiManager.DeviceCallback);
+ }
+
+ public static class MidiManager.DeviceCallback {
+ ctor public MidiManager.DeviceCallback();
+ method public void onDeviceAdded(android.media.midi.MidiDeviceInfo);
+ method public void onDeviceRemoved(android.media.midi.MidiDeviceInfo);
+ method public void onDeviceStatusChanged(android.media.midi.MidiDeviceStatus);
+ }
+
+ public static abstract class MidiManager.DeviceOpenCallback {
+ ctor public MidiManager.DeviceOpenCallback();
+ method public abstract void onDeviceOpened(android.media.midi.MidiDeviceInfo, android.media.midi.MidiDevice);
+ }
+
public final class MidiOutputPort extends android.media.midi.MidiSender implements java.io.Closeable {
method public void close() throws java.io.IOException;
method public void connect(android.media.midi.MidiReceiver);
diff --git a/api/system-current.txt b/api/system-current.txt
index 9462054..e18edae 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -17989,6 +17989,18 @@
package android.media.midi {
+ public final class MidiDevice implements java.io.Closeable {
+ method public void close() throws java.io.IOException;
+ method public android.media.midi.MidiDevice.MidiConnection connectPorts(android.media.midi.MidiInputPort, int);
+ method public android.media.midi.MidiDeviceInfo getInfo();
+ method public android.media.midi.MidiInputPort openInputPort(int);
+ method public android.media.midi.MidiOutputPort openOutputPort(int);
+ }
+
+ public class MidiDevice.MidiConnection implements java.io.Closeable {
+ method public void close() throws java.io.IOException;
+ }
+
public final class MidiDeviceInfo implements android.os.Parcelable {
method public int describeContents();
method public int getId();
@@ -18045,6 +18057,25 @@
method public void onReceive(byte[], int, int, long) throws java.io.IOException;
}
+ public final class MidiManager {
+ method public android.media.midi.MidiDeviceInfo[] getDeviceList();
+ method public void openDevice(android.media.midi.MidiDeviceInfo, android.media.midi.MidiManager.DeviceOpenCallback, android.os.Handler);
+ method public void registerDeviceCallback(android.media.midi.MidiManager.DeviceCallback, android.os.Handler);
+ method public void unregisterDeviceCallback(android.media.midi.MidiManager.DeviceCallback);
+ }
+
+ public static class MidiManager.DeviceCallback {
+ ctor public MidiManager.DeviceCallback();
+ method public void onDeviceAdded(android.media.midi.MidiDeviceInfo);
+ method public void onDeviceRemoved(android.media.midi.MidiDeviceInfo);
+ method public void onDeviceStatusChanged(android.media.midi.MidiDeviceStatus);
+ }
+
+ public static abstract class MidiManager.DeviceOpenCallback {
+ ctor public MidiManager.DeviceOpenCallback();
+ method public abstract void onDeviceOpened(android.media.midi.MidiDeviceInfo, android.media.midi.MidiDevice);
+ }
+
public final class MidiOutputPort extends android.media.midi.MidiSender implements java.io.Closeable {
method public void close() throws java.io.IOException;
method public void connect(android.media.midi.MidiReceiver);
diff --git a/media/java/android/media/midi/MidiDevice.java b/media/java/android/media/midi/MidiDevice.java
index 569f7c6..6b36554 100644
--- a/media/java/android/media/midi/MidiDevice.java
+++ b/media/java/android/media/midi/MidiDevice.java
@@ -34,9 +34,6 @@
/**
* This class is used for sending and receiving data to and from a MIDI device
* Instances of this class are created by {@link MidiManager#openDevice}.
- *
- * CANDIDATE FOR PUBLIC API
- * @hide
*/
public final class MidiDevice implements Closeable {
private static final String TAG = "MidiDevice";
@@ -49,6 +46,11 @@
private final CloseGuard mGuard = CloseGuard.get();
+ /**
+ * This class represents a connection between the output port of one device
+ * and the input port of another. Created by {@link #connectPorts}.
+ * Close this object to terminate the connection.
+ */
public class MidiConnection implements Closeable {
private final IBinder mToken;
private final MidiInputPort mInputPort;
@@ -134,11 +136,11 @@
/**
* Connects the supplied {@link MidiInputPort} to the output port of this device
* with the specified port number. Once the connection is made, the MidiInput port instance
- * can no longer receive data via its {@link MidiReciever.receive} method.
- * This method returns a {@link #MidiConnection} object, which can be used to close the connection
+ * can no longer receive data via its {@link MidiReceiver#onReceive} method.
+ * This method returns a {@link MidiDevice.MidiConnection} object, which can be used to close the connection
* @param inputPort the inputPort to connect
* @param outputPortNumber the port number of the output port to connect inputPort to.
- * @return {@link #MidiConnection} object if the connection is successful, or null in case of failure
+ * @return {@link MidiDevice.MidiConnection} object if the connection is successful, or null in case of failure
*/
public MidiConnection connectPorts(MidiInputPort inputPort, int outputPortNumber) {
if (outputPortNumber < 0 || outputPortNumber >= mDeviceInfo.getOutputPortCount()) {
diff --git a/media/java/android/media/midi/MidiManager.java b/media/java/android/media/midi/MidiManager.java
index 1b98ca5..d62b2dc 100644
--- a/media/java/android/media/midi/MidiManager.java
+++ b/media/java/android/media/midi/MidiManager.java
@@ -38,9 +38,6 @@
*
* {@samplecode
* MidiManager manager = (MidiManager) getSystemService(Context.MIDI_SERVICE);}
- *
- * CANDIDATE FOR PUBLIC API
- * @hide
*/
public final class MidiManager {
private static final String TAG = "MidiManager";
@@ -128,7 +125,7 @@
/**
* Called to notify when the status of a MIDI device has changed
*
- * @param device a {@link MidiDeviceStatus} for the changed device
+ * @param status a {@link MidiDeviceStatus} for the changed device
*/
public void onDeviceStatusChanged(MidiDeviceStatus status) {
}
@@ -221,7 +218,7 @@
* Opens a MIDI device for reading and writing.
*
* @param deviceInfo a {@link android.media.midi.MidiDeviceInfo} to open
- * @param callback a {@link #DeviceOpenCallback} to be called to receive the result
+ * @param callback a {@link MidiManager.DeviceOpenCallback} to be called to receive the result
* @param handler the {@link android.os.Handler Handler} that will be used for delivering
* the result. If handler is null, then the thread used for the
* callback is unspecified.