2024-08-14 06:10:56 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 The LineageOS Project
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <aidl/android/hardware/power/BnPower.h>
|
|
|
|
#include <android-base/file.h>
|
|
|
|
#include <android-base/logging.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
|
|
|
namespace aidl {
|
2024-08-14 06:14:33 -07:00
|
|
|
namespace google {
|
2024-08-14 06:10:56 -07:00
|
|
|
namespace hardware {
|
|
|
|
namespace power {
|
|
|
|
namespace impl {
|
2024-08-14 06:14:33 -07:00
|
|
|
namespace pixel {
|
2024-08-14 06:10:56 -07:00
|
|
|
|
|
|
|
using ::aidl::android::hardware::power::Mode;
|
|
|
|
|
2024-08-14 08:56:16 -07:00
|
|
|
const std::string TAP_TO_WAKE_NODE = "/proc/gesture_function";
|
|
|
|
|
2024-08-14 06:10:56 -07:00
|
|
|
bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) {
|
|
|
|
switch (type) {
|
|
|
|
case Mode::DOUBLE_TAP_TO_WAKE:
|
|
|
|
*_aidl_return = true;
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool setDeviceSpecificMode(Mode type, bool enabled) {
|
|
|
|
switch (type) {
|
|
|
|
case Mode::DOUBLE_TAP_TO_WAKE: {
|
|
|
|
::android::base::WriteStringToFile(enabled ? "cc1" : "cc2", TAP_TO_WAKE_NODE, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-14 06:14:33 -07:00
|
|
|
} // namespace pixel
|
2024-08-14 06:10:56 -07:00
|
|
|
} // namespace impl
|
|
|
|
} // namespace power
|
|
|
|
} // namespace hardware
|
2024-08-14 06:14:33 -07:00
|
|
|
} // namespace google
|
2024-08-14 06:10:56 -07:00
|
|
|
} // namespace aidl
|