From 48f80daef8363a51d6b982ad16bda393e39fbb7e Mon Sep 17 00:00:00 2001 From: Linnan Li Date: Mon, 22 Apr 2024 18:38:16 +0000 Subject: 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 (cherry picked from https://partner-android-review.googlesource.com/q/commit:d7c5c6d376f5eae7cbb7cce5ea12f2ba420d87ab) Merged-In: Ibdad9f8424a29d83412866eace0ef96026fb270a Change-Id: Ibdad9f8424a29d83412866eace0ef96026fb270a --- include/input/InputDevice.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/input/InputDevice.h') diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h index 57b659d9ee..798f680ff2 100644 --- a/include/input/InputDevice.h +++ b/include/input/InputDevice.h @@ -278,7 +278,7 @@ public: void initialize(int32_t id, int32_t generation, int32_t controllerNumber, const InputDeviceIdentifier& identifier, const std::string& alias, bool isExternal, bool hasMic, int32_t associatedDisplayId, - InputDeviceViewBehavior viewBehavior = {{}}); + InputDeviceViewBehavior viewBehavior = {{}}, bool enabled = true); inline int32_t getId() const { return mId; } inline int32_t getControllerNumber() const { return mControllerNumber; } @@ -347,6 +347,9 @@ public: inline int32_t getAssociatedDisplayId() const { return mAssociatedDisplayId; } + inline void setEnabled(bool enabled) { mEnabled = enabled; } + inline bool isEnabled() const { return mEnabled; } + private: int32_t mId; int32_t mGeneration; @@ -361,6 +364,7 @@ private: std::shared_ptr mKeyCharacterMap; std::optional mUsiVersion; int32_t mAssociatedDisplayId; + bool mEnabled; bool mHasVibrator; bool mHasBattery; -- cgit v1.2.3-59-g8ed1b