Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dd9a4e7 authored by Yanye Li's avatar Yanye Li
Browse files

Input: Gate setKernelWakeEnabled with a flag

This flag was previously added but not used.

Bug: 372812925
Change-Id: If6ebb8b73b3dbe802d7fd3dac0ac689000102014
Test: Plug in USB mouse and power/wakeup is not changed without
      explicitly setting this flag "enabled".
Flag: com.android.input.flags.set_input_device_kernel_wake
parent 3f8b9574
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "InputReader.h"

#include <android-base/stringprintf.h>
#include <com_android_input_flags.h>
#include <errno.h>
#include <input/Keyboard.h>
#include <input/VirtualKeyMap.h>
@@ -903,7 +904,9 @@ void InputReader::notifyMouseCursorFadedOnTyping() {

bool InputReader::setKernelWakeEnabled(int32_t deviceId, bool enabled) {
    std::scoped_lock _l(mLock);

    if (!com::android::input::flags::set_input_device_kernel_wake()){
        return false;
    }
    InputDevice* device = findInputDeviceLocked(deviceId);
    if (device) {
        return device->setKernelWakeEnabled(enabled);