diff options
author | 2025-03-24 11:53:40 -0700 | |
---|---|---|
committer | 2025-03-24 11:53:40 -0700 | |
commit | ad3fe419d6b3743c3ad92937da13ad1b05874d03 (patch) | |
tree | 78416a1445ecf1b2fc661c9e537897a7873d92ee | |
parent | 42a0e321e226fe0f678ff15d9293b03bcd606b96 (diff) | |
parent | c2282c011f3ddb478f8cdb04186b094043b0eb67 (diff) |
Merge "Fix NPE in TouchpadDebugViewController" into main
-rw-r--r-- | services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java index 9cfbfa649e1c..e36bcd8858df 100644 --- a/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java +++ b/services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java @@ -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 |