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

Commit c2282c01 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Android Build Cherrypicker Worker
Browse files

Fix NPE in TouchpadDebugViewController

Test: manual
Bug: 405820713
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3556310b7917f0ed940cdc0643b38d893d5060b0)
Merged-In: I4dc7de5fcc05fe20cc17c1540bbef2b1d78c6465
Change-Id: I4dc7de5fcc05fe20cc17c1540bbef2b1d78c6465
parent 3f1c871a
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -55,15 +55,17 @@ public class TouchpadDebugViewController implements InputManager.InputDeviceList

    @Override
    public void onInputDeviceAdded(int deviceId) {
        if (!mTouchpadVisualizerEnabled) {
            return;
        }
        final InputManager inputManager = Objects.requireNonNull(
                mContext.getSystemService(InputManager.class));
        InputDevice inputDevice = inputManager.getInputDevice(deviceId);

        if (Objects.requireNonNull(inputDevice).supportsSource(
                InputDevice.SOURCE_TOUCHPAD | InputDevice.SOURCE_MOUSE)
                && mTouchpadVisualizerEnabled) {
            showDebugView(deviceId);
        if (inputDevice == null || !inputDevice.supportsSource(
                InputDevice.SOURCE_TOUCHPAD | InputDevice.SOURCE_MOUSE)) {
            return;
        }
        showDebugView(deviceId);
    }

    @Override