Fix crash from isTrackpadDevice

Apparently InputManager.getInputDevice can return null when a device is added

Fixes: 344902395
Test: N/A
Change-Id: I79c3dd3431b1d4b079b8a6863688a13ea2741602
This commit is contained in:
Tracy Zhou committed 2024-06-11 10:40:17 -07:00
1 parent 38b9e1438e
commit 1deac6777b
1 file changed
+3
@@ -512,6 +512,9 @@ public class TouchInteractionService extends Service {
private boolean isTrackpadDevice(int deviceId) {
InputDevice inputDevice = mInputManager.getInputDevice(deviceId);
if (inputDevice == null) {
return false;
}
return inputDevice.getSources() == (InputDevice.SOURCE_MOUSE
| InputDevice.SOURCE_TOUCHPAD);
}