Loading libs/input/input_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -214,3 +214,10 @@ flag { description: "Enable telemetry for rotary input" bug: "370353565" } flag { name: "set_input_device_kernel_wake" namespace: "input" description: "Set input device's power/wakeup sysfs node" bug: "372812925" } services/inputflinger/include/InputReaderBase.h +10 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,16 @@ public: /* Notifies that mouse cursor faded due to typing. */ virtual void notifyMouseCursorFadedOnTyping() = 0; /* Set whether the given input device can wake up the kernel from sleep * when it generates input events. By default, usually only internal (built-in) * input devices can wake the kernel from sleep. For an external input device * that supports remote wakeup to be able to wake the kernel, this must be called * after each time the device is connected/added. * * Returns true if setting power wakeup was successful. */ virtual bool setKernelWakeEnabled(int32_t deviceId, bool enabled) = 0; }; // --- TouchAffineTransformation --- Loading services/inputflinger/reader/EventHub.cpp +29 −0 Original line number Diff line number Diff line Loading @@ -2848,6 +2848,35 @@ void EventHub::requestReopenDevices() { mNeedToReopenDevices = true; } bool EventHub::setKernelWakeEnabled(int32_t deviceId, bool enabled) { std::scoped_lock _l(mLock); std::string enabledStr = enabled ? "enabled" : "disabled"; Device* device = getDeviceLocked(deviceId); if (device == nullptr) { ALOGE("Device Id %d does not exist for setting power wakeup", deviceId); return false; } if (device->associatedDevice == nullptr) { return false; } std::filesystem::path currentPath = device->associatedDevice->sysfsRootPath; while (!currentPath.empty() && currentPath != "/") { std::string nodePath = currentPath / "power/wakeup"; if (std::filesystem::exists(nodePath)) { if (base::WriteStringToFile(enabledStr, nodePath)) { return true; } // No need to continue searching in parent directories as power/wakeup nodes // higher up may control other subdevices. ALOGW("Failed to set power/wakeup node at %s", nodePath.c_str()); return false; } currentPath = currentPath.parent_path(); } return false; } void EventHub::dump(std::string& dump) const { dump += "Event Hub State:\n"; Loading services/inputflinger/reader/InputDevice.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -745,6 +745,14 @@ void InputDevice::setKeyboardType(KeyboardType keyboardType) { } } bool InputDevice::setKernelWakeEnabled(bool enabled) { bool success = false; for_each_subdevice([&enabled, &success](InputDeviceContext& context) { success |= context.setKernelWakeEnabled(enabled); }); return success; } InputDeviceContext::InputDeviceContext(InputDevice& device, int32_t eventHubId) : mDevice(device), mContext(device.getContext()), Loading services/inputflinger/reader/InputReader.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -901,6 +901,16 @@ void InputReader::notifyMouseCursorFadedOnTyping() { mPreventingTouchpadTaps = true; } bool InputReader::setKernelWakeEnabled(int32_t deviceId, bool enabled) { std::scoped_lock _l(mLock); InputDevice* device = findInputDeviceLocked(deviceId); if (device) { return device->setKernelWakeEnabled(enabled); } return false; } void InputReader::dump(std::string& dump) { std::scoped_lock _l(mLock); Loading Loading
libs/input/input_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -214,3 +214,10 @@ flag { description: "Enable telemetry for rotary input" bug: "370353565" } flag { name: "set_input_device_kernel_wake" namespace: "input" description: "Set input device's power/wakeup sysfs node" bug: "372812925" }
services/inputflinger/include/InputReaderBase.h +10 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,16 @@ public: /* Notifies that mouse cursor faded due to typing. */ virtual void notifyMouseCursorFadedOnTyping() = 0; /* Set whether the given input device can wake up the kernel from sleep * when it generates input events. By default, usually only internal (built-in) * input devices can wake the kernel from sleep. For an external input device * that supports remote wakeup to be able to wake the kernel, this must be called * after each time the device is connected/added. * * Returns true if setting power wakeup was successful. */ virtual bool setKernelWakeEnabled(int32_t deviceId, bool enabled) = 0; }; // --- TouchAffineTransformation --- Loading
services/inputflinger/reader/EventHub.cpp +29 −0 Original line number Diff line number Diff line Loading @@ -2848,6 +2848,35 @@ void EventHub::requestReopenDevices() { mNeedToReopenDevices = true; } bool EventHub::setKernelWakeEnabled(int32_t deviceId, bool enabled) { std::scoped_lock _l(mLock); std::string enabledStr = enabled ? "enabled" : "disabled"; Device* device = getDeviceLocked(deviceId); if (device == nullptr) { ALOGE("Device Id %d does not exist for setting power wakeup", deviceId); return false; } if (device->associatedDevice == nullptr) { return false; } std::filesystem::path currentPath = device->associatedDevice->sysfsRootPath; while (!currentPath.empty() && currentPath != "/") { std::string nodePath = currentPath / "power/wakeup"; if (std::filesystem::exists(nodePath)) { if (base::WriteStringToFile(enabledStr, nodePath)) { return true; } // No need to continue searching in parent directories as power/wakeup nodes // higher up may control other subdevices. ALOGW("Failed to set power/wakeup node at %s", nodePath.c_str()); return false; } currentPath = currentPath.parent_path(); } return false; } void EventHub::dump(std::string& dump) const { dump += "Event Hub State:\n"; Loading
services/inputflinger/reader/InputDevice.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -745,6 +745,14 @@ void InputDevice::setKeyboardType(KeyboardType keyboardType) { } } bool InputDevice::setKernelWakeEnabled(bool enabled) { bool success = false; for_each_subdevice([&enabled, &success](InputDeviceContext& context) { success |= context.setKernelWakeEnabled(enabled); }); return success; } InputDeviceContext::InputDeviceContext(InputDevice& device, int32_t eventHubId) : mDevice(device), mContext(device.getContext()), Loading
services/inputflinger/reader/InputReader.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -901,6 +901,16 @@ void InputReader::notifyMouseCursorFadedOnTyping() { mPreventingTouchpadTaps = true; } bool InputReader::setKernelWakeEnabled(int32_t deviceId, bool enabled) { std::scoped_lock _l(mLock); InputDevice* device = findInputDeviceLocked(deviceId); if (device) { return device->setKernelWakeEnabled(enabled); } return false; } void InputReader::dump(std::string& dump) { std::scoped_lock _l(mLock); Loading