power: Simplify display_hint_sent

Check for whether the display hint has been sent at the start
of the set_interactive() function in the common powerHAL.

This gets rid of the need to replicate the same variable in
every target-specific powerHAL that implements the
set_interactive_override() function.

Change-Id: If7dd11fcb578211f4f83847f9257232c4138ce53
This commit is contained in:
Zhao Wei Liew
2016-06-26 21:29:34 +08:00
committed by Michael Bestas
parent f87f9daa0c
commit ba1c2a36fc
4 changed files with 15 additions and 20 deletions

View File

@@ -128,6 +128,8 @@ extern void power_set_interactive_ext(int on);
#endif
void set_interactive(int on) {
static int display_hint_sent;
if (!on) {
/* Send Display OFF hint to perf HAL */
perf_hint_enable(VENDOR_HINT_DISPLAY_OFF, 0);
@@ -136,6 +138,14 @@ void set_interactive(int on) {
perf_hint_enable(VENDOR_HINT_DISPLAY_ON, 0);
}
/**
* Ignore consecutive display-off hints
* Consecutive display-on hints are already handled
*/
if (display_hint_sent && !on) return;
display_hint_sent = !on;
#ifdef SET_INTERACTIVE_EXT
power_set_interactive_ext(on);
#endif