summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vaibhav Devmurari <vdevmurari@google.com> 2025-03-24 08:26:04 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-24 08:26:04 -0700
commit897c4c51e467a142e844768ecff83c69927d10f1 (patch)
tree3e27fd4951c6f00da0f42e884dc8c8dfd5201b6e
parentef03d144d911809568c867af3e75c1e779248c4e (diff)
parent3556310b7917f0ed940cdc0643b38d893d5060b0 (diff)
Merge "Fix NPE in TouchpadDebugViewController" into main
-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 2c1d68e3dbda..8d664e848ef5 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