From 0cf191ebb9e71025771d4f9c102a20d05d55f2a0 Mon Sep 17 00:00:00 2001 From: Quallenauge Date: Mon, 18 Jan 2021 22:01:57 +0100 Subject: [PATCH] power: Handle Boost:INTERACTION. The interactive mode means the device state, e.g. display on or off. The Boost:INTERACTION is used to react on user input e.g. via touch screen. This was formerly handled on the interaction power hint, which isn't applicable here. So move this to the boost section and declare it as supported. Change-Id: I723618ed9be653d0add8549f810705ee4915c999 --- Power.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Power.cpp b/Power.cpp index 119865e..f5d35ce 100644 --- a/Power.cpp +++ b/Power.cpp @@ -95,7 +95,6 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { break; case Mode::INTERACTIVE: setInteractive(enabled); - power_hint(POWER_HINT_INTERACTION, NULL); break; case Mode::SUSTAINED_PERFORMANCE: case Mode::FIXED_PERFORMANCE: @@ -136,12 +135,27 @@ ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) { ndk::ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) { LOG(INFO) << "Power setBoost: " << static_cast(type) << ", duration: " << durationMs; + switch (type) { + case Boost::INTERACTION: + power_hint(POWER_HINT_INTERACTION, &durationMs); + break; + default: + LOG(INFO) << "Boost " << static_cast(type) << "Not Supported"; + break; + } return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Power::isBoostSupported(Boost type, bool* _aidl_return) { LOG(INFO) << "Power isBoostSupported: " << static_cast(type); - *_aidl_return = false; + switch (type) { + case Boost::INTERACTION: + *_aidl_return = true; + break; + default: + *_aidl_return = false; + break; + } return ndk::ScopedAStatus::ok(); }