Do not show pointer for disabled device
We currently display the pointer for all devices that support displaying
it, but there are actually some devices that are disabled and shouldn't
actually have it displayed for them, here's an implementation for that.
This is done by adding an enabled state to the InputDeviceInfo to
determine its disabled status.
Bug: 335795596
Test: atest inputflinger_tests
Signed-off-by: Linnan Li <lilinnan@xiaomi.corp-partner.google.com>
(cherry picked from https://partner-android-review.googlesource.com/q/commit:d7c5c6d376f5eae7cbb7cce5ea12f2ba420d87ab)
Merged-In: Ibdad9f8424a29d83412866eace0ef96026fb270a
Change-Id: Ibdad9f8424a29d83412866eace0ef96026fb270a
diff --git a/services/inputflinger/PointerChoreographer.cpp b/services/inputflinger/PointerChoreographer.cpp
index 10efea5..4dc2737 100644
--- a/services/inputflinger/PointerChoreographer.cpp
+++ b/services/inputflinger/PointerChoreographer.cpp
@@ -434,6 +434,11 @@
// Mark the displayIds or deviceIds of PointerControllers currently needed, and create
// new PointerControllers if necessary.
for (const auto& info : mInputDeviceInfos) {
+ if (!info.isEnabled()) {
+ // If device is disabled, we should not keep it, and should not show pointer for
+ // disabled mouse device.
+ continue;
+ }
const uint32_t sources = info.getSources();
const bool isKnownMouse = mMouseDevices.count(info.getId()) != 0;