6 Commits

Author SHA1 Message Date
Mike Lockwood
acd4321872 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
2015-06-11 13:28:36 -07:00
Mike Lockwood
e0a6ca64fa 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
2015-06-04 19:16:23 -07:00
Mike Lockwood
7eb441cb4a MidiManager: Address API Council feedback:
Rename MidiDeviceInfo.getPortList() to getPorts()

Rename MidiManager.getDeviceList() to getDevices()

Rename MidiReceiver.onReceive() to onSend()

Replace MidiManager.DeviceOpenCallback and BluetoothOpenCallback
with new interface MidiManager.OnDeviceOpenedListener

Add MidiSender.onConnect() and onDisconnect()

Add MidiReceiver.onFlush()

Ensure that MidiReceiver max message size is immutable

Bug: 21044677
Change-Id: I7711734a45e831e9744849a6f569e906feff9f80
2015-05-12 13:39:56 -07:00
Mike Lockwood
fd5637fcce MidiManager: Improve output of "dumpsys midi"
- Include each device's port status from MidiDeviceStatus
- MidiDeviceInfo.toString() now outputs all the names and values in the properties Bundle

Change-Id: Ic9329153e4ae4d5619e274d27a420943473377e5
2015-05-07 13:02:01 -07:00
Mike Lockwood
f0a41d1c59 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
2015-04-09 11:49:51 -07:00
Mike Lockwood
5781cd5b21 Make the MIDI Manager optional, enabled by "android.software.midi" feature
Change-Id: I76d442ea28beea4b9e2876bfef501d8f61403702
2015-03-27 13:23:41 -07:00