Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eebc98ff authored by Mike Lockwood's avatar Mike Lockwood
Browse files

MidiDeviceService: Add getDeviceInfo() accessor method

so service implementations can access their own device info object.

Change-Id: I93e0c449e72d76568d7b4c9f7f7db00a846b5a33
parent 35110d1e
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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) {
+0 −2
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.media.midi;

import java.io.Closeable;

/**
 * This class contains utilities for socket communication between a
 * MidiInputPort and MidiOutputPort