I've created a test app
https://github.com/audetto/MIDIDeviceTest
Where there is just a fragment with 2 port selectors.
And there is a dummy MIDI service.
I've made 2 small changes to the MidiTools files
- Pass a View to MidiPortSelector rather than Activity
- call myOutputPort.close() in MidiOutputPortSelector.onClose() (but it makes no difference)
Run the app, select 2 ports from the same device and start changing screen orientation.
The ports & the selector are closed in the onDestroy() method, called after a screen turn.
Errors will be logged as
01-23 21:43:57.380 4866-4879/inc.andsoft.asisynth E/MidiTools: could not open MidiDeviceInfo[mType=2,mInputPortCount=1,mOutputPortCount=1,mProperties=Bundle[{manufacturer=AndSoft Inc., product=ASIMidiSynth, service_info=ServiceInfo{c56d327 inc.andsoft.asisynth.service.SynthMIDIServer}}],mIsPrivate=false
01-23 21:43:57.426 4866-4889/inc.andsoft.asisynth E/MidiTools: could not open MidiDeviceInfo[mType=2,mInputPortCount=1,mOutputPortCount=1,mProperties=Bundle[{manufacturer=AndSoft Inc., product=ASIMidiSynth, service_info=ServiceInfo{c56d327 inc.andsoft.asisynth.service.SynthMIDIServer}}],mIsPrivate=false
What is strange is that if I select ports from a Service from a different app, the error is less likely to happen.
I've created a test app
https://github.com/audetto/MIDIDeviceTest
Where there is just a fragment with 2 port selectors.
And there is a dummy MIDI service.
I've made 2 small changes to the MidiTools files
Run the app, select 2 ports from the same device and start changing screen orientation.
The ports & the selector are closed in the onDestroy() method, called after a screen turn.
Errors will be logged as
01-23 21:43:57.380 4866-4879/inc.andsoft.asisynth E/MidiTools: could not open MidiDeviceInfo[mType=2,mInputPortCount=1,mOutputPortCount=1,mProperties=Bundle[{manufacturer=AndSoft Inc., product=ASIMidiSynth, service_info=ServiceInfo{c56d327 inc.andsoft.asisynth.service.SynthMIDIServer}}],mIsPrivate=false
01-23 21:43:57.426 4866-4889/inc.andsoft.asisynth E/MidiTools: could not open MidiDeviceInfo[mType=2,mInputPortCount=1,mOutputPortCount=1,mProperties=Bundle[{manufacturer=AndSoft Inc., product=ASIMidiSynth, service_info=ServiceInfo{c56d327 inc.andsoft.asisynth.service.SynthMIDIServer}}],mIsPrivate=false
What is strange is that if I select ports from a Service from a different app, the error is less likely to happen.