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

Commit ed4939f1 authored by Robert Wu's avatar Robert Wu
Browse files

MIDI: Fix UserManager.getMainUser() crash

There is no need to call getMainUser() when we can simply get the user
id from the app uid.

Bug: 293928587
Test: Connect Jamstick to MIDI+BTLE app
Test: Verify MidiScope sees the device and receives data
Change-Id: If2adb5118132dc445652c902ace29f0b1fccb057
(cherry picked from commit b6898d1c)
parent 5723d596
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -418,14 +418,11 @@ public class MidiService extends IMidiManager.Stub {
            setDeviceServer(server);
        }

        @RequiresPermission(anyOf = {Manifest.permission.QUERY_USERS,
                Manifest.permission.CREATE_USERS,
                Manifest.permission.MANAGE_USERS})
        public Device(BluetoothDevice bluetoothDevice) {
            mBluetoothDevice = bluetoothDevice;
            mServiceInfo = null;
            mUid = mBluetoothServiceUid;
            mUserId = mUserManager.getMainUser().getIdentifier();
            mUserId = UserHandle.getUserId(mUid);
        }

        private void setDeviceServer(IMidiDeviceServer server) {