diff options
author | Mike Lockwood <lockwood@google.com> | 2015-02-12 10:58:52 -0800 |
---|---|---|
committer | Mike Lockwood <lockwood@google.com> | 2015-02-12 10:58:52 -0800 |
commit | 90b9a6a4ab30fc162aee71b4dc484b3839534369 (patch) | |
tree | e9ea8877cfc14b13e1a4cd97818380c6582293f7 /core | |
parent | ea54c0f97ca73a2bbe05cc3e49099a04236eeac6 (diff) | |
download | frameworks_base-90b9a6a4ab30fc162aee71b4dc484b3839534369.zip frameworks_base-90b9a6a4ab30fc162aee71b4dc484b3839534369.tar.gz frameworks_base-90b9a6a4ab30fc162aee71b4dc484b3839534369.tar.bz2 |
MidiManager API tweaks:
Rename MidiReceiver.onPost() to post()
Change MidiManager.DeviceCallback from an interface to a class
Change-Id: I939ba7a7d82e721b90a3d80252a88e7a650c9396
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/midi/MidiDeviceServer.java | 4 | ||||
-rw-r--r-- | core/java/android/midi/MidiInputPort.java | 2 | ||||
-rw-r--r-- | core/java/android/midi/MidiManager.java | 10 | ||||
-rw-r--r-- | core/java/android/midi/MidiOutputPort.java | 2 | ||||
-rw-r--r-- | core/java/android/midi/MidiReceiver.java | 4 |
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; } |