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

Commit 54389559 authored by Phil Burk's avatar Phil Burk
Browse files

MidiService: check UID in getDeviceStatus()

If a MIDI device is marked private then make sure
the status can only be obtained by the owner.

Bug: 203549963
Test: see bug for repro steps
Test: atest CtsMidiTestCases
Test: https://source.android.com/devices/audio/midi_test.html
Change-Id: Ibe92f1ca58c7971855453f1794564e95bfb9380d
parent 9dff8fca
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -864,7 +864,15 @@ public class MidiService extends IMidiManager.Stub {
        if (device == null) {
        if (device == null) {
            throw new IllegalArgumentException("no such device for " + deviceInfo);
            throw new IllegalArgumentException("no such device for " + deviceInfo);
        }
        }
        int uid = Binder.getCallingUid();
        if (device.isUidAllowed(uid)) {
            return device.getDeviceStatus();
            return device.getDeviceStatus();
        } else {
            Log.e(TAG, "getDeviceStatus() invalid UID = " + uid);
            EventLog.writeEvent(0x534e4554, "203549963",
                    uid, "getDeviceStatus: invalid uid");
            return null;
        }
    }
    }


    @Override
    @Override