summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
author Vaibhav Devmurari <vdevmurari@google.com> 2025-03-24 11:53:40 -0700
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-03-24 11:53:40 -0700
commitad3fe419d6b3743c3ad92937da13ad1b05874d03 (patch)
tree78416a1445ecf1b2fc661c9e537897a7873d92ee /services
parent42a0e321e226fe0f678ff15d9293b03bcd606b96 (diff)
parentc2282c011f3ddb478f8cdb04186b094043b0eb67 (diff)
Merge "Fix NPE in TouchpadDebugViewController" into main
Diffstat (limited to 'services')
-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