power: Don't hint if previous duration covers current duration
Don't hint if previous duration covers current duration, since new short
boost may interrupt previous long boost
Partially revert commit I977e844935539a4598a749c77f4c0934ca93a2b7 (power: Ignore
interaction boost sequence in a short period)
Change-Id: Ia2c824683ab148b2bf4d2859cb58e5c2721abe8d
diff --git a/power-common.c b/power-common.c
index 604c551..533df83 100644
--- a/power-common.c
+++ b/power-common.c
@@ -66,6 +66,7 @@
void process_interaction_hint(void* data) {
static struct timespec s_previous_boost_timespec;
+ static int s_previous_duration = 0;
static int prev_interaction_handle = -1;
struct timespec cur_boost_timespec;
@@ -89,7 +90,12 @@
if (elapsed_time < 250000 && duration <= kMinInteractiveDuration) {
return;
}
+ // also don't hint if previous hint's duration covers this hint's duration
+ if ((s_previous_duration * 1000) > (elapsed_time + duration * 1000)) {
+ return;
+ }
s_previous_boost_timespec = cur_boost_timespec;
+ s_previous_duration = duration;
int interaction_handle =
perf_hint_enable_with_type(VENDOR_HINT_SCROLL_BOOST, duration, SCROLL_VERTICAL);