From 018faea11a94d96ebc9e7294fc68f7df165c4875 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Wed, 8 May 2024 21:52:54 +0000 Subject: InputReader: Add API to get the last used input device This will be used by the InputMethodManagerService to notify the IME of the last input device type that was used to interact with Android when the IME is shown. This API eliminates the need for IMMS to add another global spy window to solve this problem. Bug: 336615195 Test: atest inputflinger_tests Change-Id: If594bd07bfd0a3cb542fc300854f1dd5717aeab2 --- services/inputflinger/include/InputReaderBase.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'services/inputflinger/include') diff --git a/services/inputflinger/include/InputReaderBase.h b/services/inputflinger/include/InputReaderBase.h index e5c3aa08d1..62149c5a70 100644 --- a/services/inputflinger/include/InputReaderBase.h +++ b/services/inputflinger/include/InputReaderBase.h @@ -394,6 +394,12 @@ public: /* Sysfs node change reported. Recreate device if required to incorporate the new sysfs nodes */ virtual void sysfsNodeChanged(const std::string& sysfsNodePath) = 0; + + /* Get the ID of the InputDevice that was used most recently. + * + * Returns ReservedInputDeviceId::INVALID_INPUT_DEVICE_ID if no device has been used since boot. + */ + virtual DeviceId getLastUsedInputDeviceId() = 0; }; // --- TouchAffineTransformation --- -- cgit v1.2.3-59-g8ed1b