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
3 files changed