using ::android::hardware::Void;
using ::android::hardware::power::V1_0::Feature;
using ::android::hardware::power::V1_0::Status;
+using namespace std::chrono_literals;
constexpr char kPowerHalStateProp[] = "vendor.powerhal.state";
constexpr char kPowerHalAudioProp[] = "vendor.powerhal.audio";
setProfile(PowerProfile::HIGH_PERFORMANCE);
mCurrentPerfProfile = PowerProfile::HIGH_PERFORMANCE;
}
+ mDoubleTapEnabled = false;
+
// Now start to take powerhint
mReady.store(true);
ALOGI("PowerHAL ready to process hints");
// Methods from ::android::hardware::power::V1_0::IPower follow.
Return<void> Power::setInteractive(bool interactive) {
- return updateHint("NOT_INTERACTIVE", !interactive);
+ // Enable dt2w before turning TSP off
+ if (mDoubleTapEnabled && !interactive) {
+ updateHint("DOUBLE_TAP_TO_WAKE", true);
+ // It takes some time till the cmd is executed in the Kernel, there
+ // is an interface to check that. To avoid that just wait for 25ms
+ // till we turn off the touchscreen and lcd.
+ std::this_thread::sleep_for(25ms);
+ }
+
+ updateHint("NOT_INTERACTIVE", !interactive);
+
+ // Disable dt2w after turning TSP back on
+ if (mDoubleTapEnabled && interactive) {
+ updateHint("DOUBLE_TAP_TO_WAKE", false);
+ }
+
+ return Void();
}
Return<void> Power::powerHint(PowerHint_1_0 hint, int32_t data) {
Return<void> Power::setFeature(Feature feature, bool activate) {
switch (feature) {
case Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE:
- updateHint("DOUBLE_TAP_TO_WAKE", activate);
+ mDoubleTapEnabled = activate;
break;
default:
break;
},
{
"Name": "DoubleTapToWakeEnable",
- "Path": "/sys/class/sec/tsp/dt2w_enable",
+ "Path": "/sys/class/sec/tsp/cmd",
"Values": [
- "0",
- "1"
+ "aot_enable,0",
+ "aot_enable,1"
],
"DefaultIndex": 0,
- "ResetOnInit": true
},
{
"Name": "PowerHALMainState",
"PowerHint": "DOUBLE_TAP_TO_WAKE",
"Node": "DoubleTapToWakeEnable",
"Duration": 0,
- "Value": "1"
+ "Value": "aot_enable,1"
},
{
"PowerHint": "PROFILE_POWER_SAVE",