History log of /frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
80299748cc7ed5f59cb65122459b036b74150d4a 05-Apr-2016 Phil Burk <philburk@google.com> MidiDevice: fix connectPorts for same Process

If connectPorts() was called for a device in the same process then
the connection would die when the ParcelFileDescriptor was closed.

Bug: 26406775
Change-Id: Id0538452593b4761ac2a93d366ade76d2e35ce73
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
2aef7e3559e9e2c78287a00b3f693b6dc19e56f0 18-Jun-2015 Mike Lockwood <lockwood@google.com> Fix MidiDevice.MidiConnection lifecycle

Update device server's MidiDeviceStatus when a connection is made to one of its output ports.

After connecting an input port to an output port using MidiDevice.connectPorts(),
do not call IMidiDeviceServer.closePort() until MidiDevice.MidiConnection.close() is called.

While I was in there, added missing CloseGuard support to the MidiDevice.MidiConnection class.

This fixes a problem resulting in UsbMidiDevice closing the device's ALSA driver too soon.

Bug: 21850709

Change-Id: I0c120f76b42eec8a143161e46dba73fbec5e4f31
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
acd4321872387212bbd956e134faf22eee4bbadc 11-Jun-2015 Mike Lockwood <lockwood@google.com> MidiDeviceServer: Fix race condition in setting device server's mDeviceInfo

This made it unsafe to open ports on a device from the MidiManager onDeviceOpened callback

Bug: 21760692
Change-Id: I536acdf574a3ccecdb66a8fde87089538e8bb1ef
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
e0a6ca64fac5bd4f10139321604031816e90adb4 04-Jun-2015 Mike Lockwood <lockwood@google.com> MidiManager: proxy all requests to open devices through MidiService

Previously when a MidiManager client opened a virtual or Bluetooth device,
the client bound directly to the virtual device's MidiDeviceService
or BluetoothMidiDevice's IMidiDeviceServer for the given BluetoothDevice.
Only USB devices were opened in MidiService.

Now opening any type of MIDI device is done via IMidiManager.openDevice() or
IMidiManager.openBluetoothDevice(). MidiService tracks all connnections between
clients and devices.

Services that implement virtual devices must now require android.permission.BIND_MIDI_DEVICE_SERVICE
so only MidiService can bind to these services.

Bug: 21044677

Change-Id: I7172f7b1e0cbfe4a2a87dff376c32dc9b41aa563
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
f0a41d1c591193fbe02c9ddbaf24c79af4da9972 24-Mar-2015 Mike Lockwood <lockwood@google.com> Add support for Bluetooth MIDI devices

The Bluetooth MIDI devices are handled in the BluetoothMidiService APK.
Apps wishing to connect to Bluetooth MIDI devices call MidiManager.openBluetoothDevice()
which binds to BluetoothMidiService in a similar way as virtual devices are implemented.

Change-Id: Ie3fbca757928fd7873a009f9bf9e0ce0be487da6
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
d1b16fe2fb7527eee214898263ec4d6dabbfb0b4 30-Mar-2015 Mike Lockwood <lockwood@google.com> Move MIDI utilities for internal use to com.android.internal.midi package

Change-Id: I7393ae1d4bca61667fb6ee809a7aa22c5c48de56
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
81b9f7d325a552c54e793b51f571ae3d65b26e94 11-Mar-2015 Mike Lockwood <lockwood@google.com> Add MidiManager to public API

Also made some small API changes based on feedback from the lint tool.

Change-Id: Ibcf1e9107d86d3a364f811ce47a13aa0da653366
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
5ff9e2a1719f78cddc7a23d6572ab15ab595dafd 09-Mar-2015 Mike Lockwood <lockwood@google.com> MidiManager: Add MIDI device status notifications

MidiManager clients can be notified of device status changes via a new MidiDeviceStatus object.
MidiDeviceStatus contains the busy status of the device's input ports and number of
connections to the output ports.
MidiDeviceService now has an optional callback for receiving notifications when its ports change as well.

Change-Id: I1600df4464d82724bc026c27b9633ae9c412d3f0
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
46326e59a0a19367d4158c027d56d4b8440e8d3d 06-Mar-2015 Mike Lockwood <lockwood@google.com> MidiDevice: Add support for making direct connections between ports

The output port of one device can be connected to the input port of another
device using the new MidiDevice.connectPorts() method.
This allows an application to direct the output of one device directly
to the input port of another without having to copy data from one to another.

Change-Id: I4d361c4e0950b9b9516b0c2f0c158677b1aca208
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
be215dd57282888b05b234c39bba44cc0a864b8a 07-Mar-2015 Mike Lockwood <lockwood@google.com> MIDI Manager changes:

Add CloseGuard support to MidiDevice and MidiDeviceServer
Make MidiDevice.close() thread safe
Make non-subclassable API classes final
Other misc cleanup

Change-Id: I7a5d31b06b8c2403cfbc5597c5c1395f0ac90194
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
4a3d7ed45d98ad2fe900221755845b87f26b554a 06-Mar-2015 Mike Lockwood <lockwood@google.com> MIDI Manager: Add explicit close mechanism for input and output ports

Relying on errors from closing the file descriptor is not reliable
and was resulting in file descriptor leaks in device servers.

Change-Id: Ib5cc22dba493eae6608a12cc6d4178d8390da77b
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
3b7664589be22ddad34b72e11ced937d48660ebb 04-Mar-2015 Mike Lockwood <lockwood@google.com> Make MidiSender and MidiReceiver abstract classes, rename MidiReceiver.post() to receive()

Change-Id: I1cef3bd48ca0acf2968c9de223f78445f3434404
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
11fd96d6ff25bc1d710448eab545fe09da55a5f5 02-Mar-2015 Mike Lockwood <lockwood@google.com> MidiManager: Virtual MIDI devices are now implemented as Services

To implement a virtual MIDI device, include a subclass of MidiDeviceService in
your application. This service is identified by an intent filter and meta-data
in the application's manifest to allow the MIDI manager to register the virtual device
without actually running the application. Instead, the application's MidiDeviceService
subclass is started on demand when MIDI manager clients want to open the device.

Here is an example of how the MidiDeviceService might be described in the application manifest:

<service android:name="VirtualDeviceService">
<intent-filter>
<action android:name="android.media.midi.MidiDeviceService" />
</intent-filter>
<meta-data android:name="android.media.midi.MidiDeviceService"
android:resource="@xml/device_info" />
</service>

and the device_info.xml meta-data:

<devices>
<device manufacturer="Sample Manufacturer" model="Sample Model" private="false">
<input-port name="my input port" />
<output-port name="my output port" />
</device>
</devices>

(note that the <input-port> and <output-port> names are not currently used, but support for these
will be added in a subsequent change)

Client's of the virtual device will bind directly to the hosting application's MidiDeviceService subclass.
To support this, MidiManager.openDevice() now returns the MidiDevice asynchronously via a callback.

This change also adds a utility class called MidiDispatcher, which is a MidiReceiver
that dispatches all data it receives to a list of other MidiReceivers.
We now use this internally in MidiInputPort and MidiDeviceServer, but developers
may use it for other purposes as well.

Change-Id: Ic3009f06d56f3d5edbd87de3f0c330b51a1c217d
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java
b673770f7172d4fca9bc05de1f36bc53e93eb247 20-Feb-2015 Mike Lockwood <lockwood@google.com> Add MIDI Manager API tweaks:

- Change the package name from android.midi to android.media.midi

- Add option for specifying a Handler for DeviceCallback notifications

Change-Id: Ia9e9817a651c06299f4e02ee1da3c9666ff64cb9
/frameworks/base/media/java/android/media/midi/MidiDeviceServer.java