power: Allow device specific hooks for setFeature

* Some devices may want to implement custom hooks
 * Inspired by 6ddb840367

Change-Id: Ie6fd4637d25b55f70c1c7c2cba5decc98c661b51
This commit is contained in:
Adithya R 2022-02-16 16:02:52 +05:30 committed by Adithya
parent 43c27d7bd4
commit 028eeae55a
3 changed files with 17 additions and 2 deletions

View File

@ -20,8 +20,9 @@ soong_config_module_type {
"target_two_finger_swipe_node",
"target_draw_s_node",
"target_single_tap_to_wake_node",
"target_power_feature_ext_lib",
],
properties: ["cppflags"],
properties: ["cppflags", "whole_static_libs"],
}
powerfeature_cc_defaults {
@ -78,6 +79,10 @@ powerfeature_cc_defaults {
target_single_tap_to_wake_node: {
cppflags: ["-DSINGLE_TAP_TO_WAKE_NODE=\"%s\""],
},
target_power_feature_ext_lib: {
cppflags: ["-DFEATURE_EXT"],
whole_static_libs: ["%s"],
},
},
}

View File

@ -31,7 +31,16 @@ namespace power {
static constexpr int kInputEventWakeupModeOff = 4;
static constexpr int kInputEventWakeupModeOn = 5;
#ifdef FEATURE_EXT
extern bool setDeviceSpecificFeature(Feature feature, bool enabled);
#endif
ndk::ScopedAStatus PowerFeature::setFeature(Feature feature, bool enabled) {
#ifdef FEATURE_EXT
if (setDeviceSpecificFeature(feature, enabled)) {
return ndk::ScopedAStatus::ok();
}
#endif
switch (feature) {
#ifdef GESTURES_NODE
case Feature::GESTURES:

View File

@ -60,7 +60,8 @@ GESTURE_SOONG_VARS := \
TARGET_ONE_FINGER_SWIPE_LEFT_NODE \
TARGET_TWO_FINGER_SWIPE_NODE \
TARGET_DRAW_S_NODE \
TARGET_SINGLE_TAP_TO_WAKE_NODE
TARGET_SINGLE_TAP_TO_WAKE_NODE \
TARGET_POWER_FEATURE_EXT_LIB
$(foreach v,$(GESTURE_SOONG_VARS),$(eval $(call add-gesturevar-if-exist,$(v))))