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

Commit 3428514d authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Remove the input device record on virtual unplug

The input device map entry for the HID devices must be removed if the
bond is removed.

Test: mmm packages/modules/Bluetooth
Flag: com.android.bluetooth.flags.remove_input_device_on_vup
Bug: 347241319
Bug: 354758065
Change-Id: I9da102217cf44ac2ca32f88bfaab21d1efdd76bc
parent 60642504
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -519,10 +519,16 @@ public class HidHostService extends ProfileService {

    private void handleMessageOnVirtualUnplug(Message msg) {
        BluetoothDevice device = mAdapterService.getDeviceFromByte((byte[]) msg.obj);
        if (Flags.removeInputDeviceOnVup()) {
            updateConnectionState(
                    device, getTransport(device), BluetoothProfile.STATE_DISCONNECTED);
            mInputDevices.remove(device);
        } else {
            int transport = msg.arg1;
            if (!checkTransport(device, transport, msg.what)) {
                return;
            }
        }
        int status = msg.arg2;
        broadcastVirtualUnplugStatus(device, status);
    }