diff options
author | Mike Lockwood <lockwood@google.com> | 2015-03-06 08:17:33 -0800 |
---|---|---|
committer | Mike Lockwood <lockwood@google.com> | 2015-03-06 08:17:33 -0800 |
commit | eebc98ff18c1ee92dff3fcd505158ea161d552be (patch) | |
tree | 5fe2e3ba900e17c49c4dbb3529839adfc4564d88 /media | |
parent | 35110d1ed72ee7fe687125831b4dd91b87b515ee (diff) | |
download | frameworks_base-eebc98ff18c1ee92dff3fcd505158ea161d552be.zip frameworks_base-eebc98ff18c1ee92dff3fcd505158ea161d552be.tar.gz frameworks_base-eebc98ff18c1ee92dff3fcd505158ea161d552be.tar.bz2 |
MidiDeviceService: Add getDeviceInfo() accessor method
so service implementations can access their own device info object.
Change-Id: I93e0c449e72d76568d7b4c9f7f7db00a846b5a33
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/midi/MidiDeviceService.java | 14 | ||||
-rw-r--r-- | media/java/android/media/midi/MidiPortImpl.java | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/media/java/android/media/midi/MidiDeviceService.java b/media/java/android/media/midi/MidiDeviceService.java index 1d91be2..64f69cd 100644 --- a/media/java/android/media/midi/MidiDeviceService.java +++ b/media/java/android/media/midi/MidiDeviceService.java @@ -55,6 +55,7 @@ abstract public class MidiDeviceService extends Service { private IMidiManager mMidiManager; private MidiDeviceServer mServer; + private MidiDeviceInfo mDeviceInfo; @Override public void onCreate() { @@ -64,6 +65,11 @@ abstract public class MidiDeviceService extends Service { try { MidiDeviceInfo deviceInfo = mMidiManager.getServiceDeviceInfo(getPackageName(), this.getClass().getName()); + if (deviceInfo == null) { + Log.e(TAG, "Could not find MidiDeviceInfo for MidiDeviceService " + this); + return; + } + mDeviceInfo = deviceInfo; MidiReceiver[] inputPortReceivers = getInputPortReceivers(); if (inputPortReceivers == null) { inputPortReceivers = new MidiReceiver[0]; @@ -100,6 +106,14 @@ abstract public class MidiDeviceService extends Service { } } + /** + * returns the {@link MidiDeviceInfo} instance for this service + * @return our MidiDeviceInfo + */ + public MidiDeviceInfo getDeviceInfo() { + return mDeviceInfo; + } + @Override public IBinder onBind(Intent intent) { if (SERVICE_INTERFACE.equals(intent.getAction()) && mServer != null) { diff --git a/media/java/android/media/midi/MidiPortImpl.java b/media/java/android/media/midi/MidiPortImpl.java index fcb23c1..5795045 100644 --- a/media/java/android/media/midi/MidiPortImpl.java +++ b/media/java/android/media/midi/MidiPortImpl.java @@ -16,8 +16,6 @@ package android.media.midi; -import java.io.Closeable; - /** * This class contains utilities for socket communication between a * MidiInputPort and MidiOutputPort |