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

Commit e329239a authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

InputController: Allow for null InputDevice object from getInputDevice

A null InputDevice object can be returned when there is a race condition
between the device added/changed signal and a removal. There may also be
rare cases where an InputDevice may be hot-plugged upon connection, when
there are race conditions in the kernel APIs.

Bug: 413012407
Flag: EXEMPT bug fix
Test: Presubmit
Change-Id: Ifc21abe6db5e9b712af2f972c759e09d32d80139
parent e129bd7d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -720,7 +720,9 @@ class InputController {
                private boolean isMatchingDevice(int deviceId) {
                    final InputDevice device = InputManagerGlobal.getInstance().getInputDevice(
                            deviceId);
                    Objects.requireNonNull(device, "Newly added input device was null.");
                    if (device == null) {
                        return false;
                    }
                    if (!device.getName().equals(deviceName)) {
                        return false;
                    }