power: Add support for tap-to-wake feature control
Co-authored-by: Arian <arian.kulmer@web.de> Co-authored-by: LuK1337 <priv.luk@gmail.com> Change-Id: I545902b29f4828c127bc32def6e30b67ce4a3aa7
This commit is contained in:
committed by
Michael Bestas
parent
9df9caa266
commit
6b46a293df
11
Power.cpp
11
Power.cpp
@@ -36,6 +36,7 @@
|
||||
#include "Power.h"
|
||||
#include "PowerHintSession.h"
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <aidl/android/hardware/power/BnPower.h>
|
||||
@@ -65,7 +66,13 @@ void setInteractive(bool interactive) {
|
||||
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||
LOG(INFO) << "Power setMode: " << static_cast<int32_t>(type) << " to: " << enabled;
|
||||
switch(type){
|
||||
#ifdef TAP_TO_WAKE_NODE
|
||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||
::android::base::WriteStringToFile(enabled ? "1" : "0", TAP_TO_WAKE_NODE, true);
|
||||
break;
|
||||
#else
|
||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||
#endif
|
||||
case Mode::LOW_POWER:
|
||||
case Mode::LAUNCH:
|
||||
case Mode::DEVICE_IDLE:
|
||||
@@ -98,7 +105,6 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||
|
||||
ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) {
|
||||
LOG(INFO) << "Power isModeSupported: " << static_cast<int32_t>(type);
|
||||
|
||||
switch(type){
|
||||
case Mode::EXPENSIVE_RENDERING:
|
||||
if (is_expensive_rendering_supported()) {
|
||||
@@ -107,6 +113,9 @@ ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) {
|
||||
*_aidl_return = false;
|
||||
}
|
||||
break;
|
||||
#ifdef TAP_TO_WAKE_NODE
|
||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||
#endif
|
||||
case Mode::INTERACTIVE:
|
||||
case Mode::SUSTAINED_PERFORMANCE:
|
||||
case Mode::FIXED_PERFORMANCE:
|
||||
|
||||
Reference in New Issue
Block a user