power: Allow device specific hooks for setMode, isModeSupported
* Some devices may want to implement custom hooks Change-Id: Icb2d66471ec649a69b1e69849fd86282775052cb
This commit is contained in:
@@ -83,6 +83,11 @@ endif
|
||||
|
||||
endif # End of board specific list
|
||||
|
||||
ifneq ($(TARGET_POWERHAL_MODE_EXT),)
|
||||
LOCAL_CFLAGS += -DMODE_EXT
|
||||
LOCAL_SRC_FILES += ../../../../$(TARGET_POWERHAL_MODE_EXT)
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_POWERHAL_SET_INTERACTIVE_EXT),)
|
||||
LOCAL_CFLAGS += -DSET_INTERACTIVE_EXT
|
||||
LOCAL_SRC_FILES += ../../../../$(TARGET_POWERHAL_SET_INTERACTIVE_EXT)
|
||||
|
||||
15
Power.cpp
15
Power.cpp
@@ -59,12 +59,22 @@ namespace hardware {
|
||||
namespace power {
|
||||
namespace impl {
|
||||
|
||||
#ifdef MODE_EXT
|
||||
extern bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return);
|
||||
extern bool setDeviceSpecificMode(Mode type, bool enabled);
|
||||
#endif
|
||||
|
||||
void setInteractive(bool interactive) {
|
||||
set_interactive(interactive ? 1:0);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||
LOG(INFO) << "Power setMode: " << static_cast<int32_t>(type) << " to: " << enabled;
|
||||
#ifdef MODE_EXT
|
||||
if (setDeviceSpecificMode(type, enabled)) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
#endif
|
||||
switch(type){
|
||||
#ifdef TAP_TO_WAKE_NODE
|
||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||
@@ -105,6 +115,11 @@ 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);
|
||||
#ifdef MODE_EXT
|
||||
if (isDeviceSpecificModeSupported(type, _aidl_return)) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
#endif
|
||||
switch(type){
|
||||
case Mode::EXPENSIVE_RENDERING:
|
||||
if (is_expensive_rendering_supported()) {
|
||||
|
||||
Reference in New Issue
Block a user