summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vaibhav Devmurari <vdevmurari@google.com> 2025-03-24 08:28:55 -0700
committer Android Build Cherrypicker Worker <android-build-cherrypicker-worker@google.com> 2025-03-24 08:28:55 -0700
commitc2282c011f3ddb478f8cdb04186b094043b0eb67 (patch)
tree3f5d26ce8111f63a4aadae90eedeb0c1826e45af
parent3f1c871a01772073c26942a4852ff7df6ebe766a (diff)
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
-rw-r--r--services/core/java/com/android/server/input/debug/TouchpadDebugViewController.java12
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