summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2015-02-13 00:01:43 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-02-13 00:01:48 +0000
commit5b14d9893aced2b3ba46f1d90a0752c1a9a43f2f (patch)
tree5b6d891878c9a762cf16899c1c618070efb289b7 /core
parentf4f9a3015e2bc0530a77977473c3c693f8563163 (diff)
parent90b9a6a4ab30fc162aee71b4dc484b3839534369 (diff)
downloadframeworks_base-5b14d9893aced2b3ba46f1d90a0752c1a9a43f2f.zip
frameworks_base-5b14d9893aced2b3ba46f1d90a0752c1a9a43f2f.tar.gz
frameworks_base-5b14d9893aced2b3ba46f1d90a0752c1a9a43f2f.tar.bz2
Merge "MidiManager API tweaks:"
Diffstat (limited to 'core')
-rw-r--r--core/java/android/midi/MidiDeviceServer.java4
-rw-r--r--core/java/android/midi/MidiInputPort.java2
-rw-r--r--core/java/android/midi/MidiManager.java10
-rw-r--r--core/java/android/midi/MidiOutputPort.java2
-rw-r--r--core/java/android/midi/MidiReceiver.java4
5 files changed, 12 insertions, 10 deletions
diff --git a/core/java/android/midi/MidiDeviceServer.java b/core/java/android/midi/MidiDeviceServer.java
index 7499934..4a1995f 100644
--- a/core/java/android/midi/MidiDeviceServer.java
+++ b/core/java/android/midi/MidiDeviceServer.java
@@ -254,12 +254,12 @@ public final class MidiDeviceServer implements Closeable {
return new MidiReceiver() {
@Override
- public void onPost(byte[] msg, int offset, int count, long timestamp) throws IOException {
+ public void post(byte[] msg, int offset, int count, long timestamp) throws IOException {
ArrayList<MidiInputPort> receivers = mOutputPortReceivers[portNumberF];
synchronized (receivers) {
for (int i = 0; i < receivers.size(); i++) {
// FIXME catch errors and remove dead ones
- receivers.get(i).onPost(msg, offset, count, timestamp);
+ receivers.get(i).post(msg, offset, count, timestamp);
}
}
}
diff --git a/core/java/android/midi/MidiInputPort.java b/core/java/android/midi/MidiInputPort.java
index 51c47dd..735c68a 100644
--- a/core/java/android/midi/MidiInputPort.java
+++ b/core/java/android/midi/MidiInputPort.java
@@ -50,7 +50,7 @@ public class MidiInputPort extends MidiPort implements MidiReceiver {
* @param timestamp future time to post the message (based on
* {@link java.lang.System#nanoTime}
*/
- public void onPost(byte[] msg, int offset, int count, long timestamp) throws IOException {
+ public void post(byte[] msg, int offset, int count, long timestamp) throws IOException {
assert(offset >= 0 && count >= 0 && offset + count <= msg.length);
synchronized (mBuffer) {
diff --git a/core/java/android/midi/MidiManager.java b/core/java/android/midi/MidiManager.java
index 8aa8395..3a0b064 100644
--- a/core/java/android/midi/MidiManager.java
+++ b/core/java/android/midi/MidiManager.java
@@ -66,22 +66,24 @@ public class MidiManager {
}
/**
- * Callback interface used for clients to receive MIDI device added and removed notifications
+ * Callback class used for clients to receive MIDI device added and removed notifications
*/
- public interface DeviceCallback {
+ public static class DeviceCallback {
/**
* Called to notify when a new MIDI device has been added
*
* @param device a {@link MidiDeviceInfo} for the newly added device
*/
- void onDeviceAdded(MidiDeviceInfo device);
+ void onDeviceAdded(MidiDeviceInfo device) {
+ }
/**
* Called to notify when a MIDI device has been removed
*
* @param device a {@link MidiDeviceInfo} for the removed device
*/
- void onDeviceRemoved(MidiDeviceInfo device);
+ void onDeviceRemoved(MidiDeviceInfo device) {
+ }
}
/**
diff --git a/core/java/android/midi/MidiOutputPort.java b/core/java/android/midi/MidiOutputPort.java
index 332b431..b9512fd 100644
--- a/core/java/android/midi/MidiOutputPort.java
+++ b/core/java/android/midi/MidiOutputPort.java
@@ -65,7 +65,7 @@ public class MidiOutputPort extends MidiPort implements MidiSender {
for (int i = 0; i < mReceivers.size(); i++) {
MidiReceiver receiver = mReceivers.get(i);
try {
- receiver.onPost(buffer, offset, size, timestamp);
+ receiver.post(buffer, offset, size, timestamp);
} catch (IOException e) {
Log.e(TAG, "post failed");
deadReceivers.add(receiver);
diff --git a/core/java/android/midi/MidiReceiver.java b/core/java/android/midi/MidiReceiver.java
index fdfe51a..16c9bbb 100644
--- a/core/java/android/midi/MidiReceiver.java
+++ b/core/java/android/midi/MidiReceiver.java
@@ -32,7 +32,7 @@ public interface MidiReceiver {
* The msg bytes should be copied by the receiver rather than retaining a reference
* to this parameter.
* Also, modifying the contents of the msg array parameter may result in other receivers
- * in the same application receiving incorrect values in their onPost() method.
+ * in the same application receiving incorrect values in their post() method.
*
* @param msg a byte array containing the MIDI data
* @param offset the offset of the first byte of the data in the byte array
@@ -40,5 +40,5 @@ public interface MidiReceiver {
* @param timestamp the timestamp of the message (based on {@link java.lang.System#nanoTime}
* @throws IOException
*/
- public void onPost(byte[] msg, int offset, int count, long timestamp) throws IOException;
+ public void post(byte[] msg, int offset, int count, long timestamp) throws IOException;
}