Implement GKI timers based on wake alarms and wake locks.
Before this change, bluedroid was unable to acquire wake locks
because the Bluetooth process didn't have permissions to write to
/sys/power/wake_*. We are now making wake locks accessible to
bluedroid through a HAL callout back into Java code.
The previous design did not use wake alarms. Bluedroid would attempt
to hold a wake lock until all pending timers expired, which is awful
if a timer is scheduled seconds or minutes from now. There is a
15min timer in bluedroid now so holding a wake lock for the entire
duration of pending alarms is unacceptable (power cost). The new
implementation uses a hybrid approach: if the next deadline is < 3s
away, we take a wake lock. If it is further than 3s away, we set a
wake alarm and release the wake lock.
As a result of this change, we have also eliminated a thread whose
sole purpose was to wake up every 10ms and update timers.
Change-Id: I46cd4edfcad2f5dce23c4003a14a617e7bf00541
diff --git a/include/gki_target.h b/include/gki_target.h
index cdd7726..451b3aa 100644
--- a/include/gki_target.h
+++ b/include/gki_target.h
@@ -132,12 +132,12 @@
/* delay in ticks before stopping system tick. */
#ifndef GKI_DELAY_STOP_SYS_TICK
-#define GKI_DELAY_STOP_SYS_TICK 10
+#define GKI_DELAY_STOP_SYS_TICK 0
#endif
/* Option to guarantee no preemption during timer expiration (most system don't need this) */
#ifndef GKI_TIMER_LIST_NOPREEMPT
-#define GKI_TIMER_LIST_NOPREEMPT FALSE
+#define GKI_TIMER_LIST_NOPREEMPT TRUE
#endif
/******************************************************************************