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
Backgroud: As noted in b/20823981, MediaSessionService calls some
audio service methods while holding a lock and the audio service
methods also talk to other system services. And, deadlock happens when
the other system service fires another request to MediaSessionService
while holding its lock.
Example1) --- resolved by the change in MediaSessionRecord.java
T1: MediaSessionService.dispatchAdjustVolumeLocked()
-> MediaSessionRecord.adjustVolume()
-> +++AudioServiceInternal.adjustSuggestedStreamVolumeForUid()+++
-> AudioService.adjustSuggestedStreamVolume()
-> telecom.TelecomManager.isInCall() --- blocked by lock in TelecomManager.
T2: telecom.ConnectionServiceWrapper.handleCreateConnectionComplete()
-> MediaSession.setActive()
-> MediaSessionRecord$SessionStub.setActive()
-> MediaSessionService.updateSession() --- blocked by lock in MediaSessionService.
Example2) --- resolved by the change in IAudioService.aidl
T1: MediaSessionService.dispatchAdjustVolumeLocked()
-> IAudioService.adjustSuggestedStreamVolume()
-> AudioService.adjustSuggestedStreamVolume()
-> telecom.TelecomManager.isInCall() --- blocked by lock in TelecomManager.
T2: telecom.ConnectionServiceWrapper.handleCreateConnectionComplete()
-> MediaSession.setActive()
-> MediaSessionRecord$SessionStub.setActive()
-> MediaSessionService.updateSession() --- blocked by lock in MediaSessionService.
Here, this change prevents the deadlock by making related audio IPC oneway
and calling the internal audio method without holding the lock.
Bug: 20823981
Change-Id: I4c4b2fc796f23d83be67f7edaacd7496c145d985
If DEAD_OBJECT is returned from binder calls due to
mediaserver crash, throw new MediaDrmResetException.
This allows the app to detect the condition and handle
it properly.
bug: 20614102
Change-Id: Id08b08fb612672fd94383f0470f5fa3f267b944f
Should throw UnsupportedOperationException instead of returning
an uninitialized track object.
Bug: 21890643
Change-Id: I34df73b316fcb490be05eb3beff06b795645fd4c
Should throw UnsupportedOperationException instead of returning
an uninitialized record object.
Bug: 21890643
Change-Id: I9c05a4cff9f5e1d5513c76acace09699a567008f
This made it unsafe to open ports on a device from the MidiManager onDeviceOpened callback
Bug: 21760692
Change-Id: I536acdf574a3ccecdb66a8fde87089538e8bb1ef
Fix performance regression in SoundPool by not checking SoundPool
can play audio everytime it's about to play.
Instead check for permission in constructor and register a listener
for changes on OP_PLAY_AUDIO.
Bug 20018833
Change-Id: I4e7a633d23b98653a149681d18a387cd560efe4d
For certain RtoL languages, digit used as a part of input id
(like HW0) is also localized, hence language change results in
the duplicated inputs for an identical hardware. This CL
changes the way the id is built to language-neutral fashion,
and keeps the digit used in the id in Arabic.
Bug: 21523750
Change-Id: I8f95e0209eeee16ceb543e574ef9ed572e4d031f
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
Keep a reference on active Ringtones to avoid garbage collection
before playback is complete.
Bug: 11366759.
Change-Id: Icb04da427c20e0b4657e9e8b13b3ecab98e5a333
Also use boolean to control synth start and stop.
Add mention of feature declaration in Manifest.
Add virtual MIDI devices to bullet list.
Change-Id: I7b36e3ce69caf9d1d15d23f1a0836d525022ef9e
Signed-off-by: Phil Burk <philburk@google.com>