• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Revisionbc918ae656454413b277b4e3302feabbcfea93ee (tree)
Time2019-10-15 17:37:43
AuthorAlistair Strachan <astrachan@goog...>
CommiterChih-Wei Huang

Log Message

Fall back to CLOCK_BOOTTIME if CLOCK_BOOTTIME_ALARM fails

If the cuttlefish device does not have an rtc device (such as the crosvm
VMM) the bt osi layer can promote crashes due to it not being able to
create a CLOCK_BOOTTIME_ALARM timer. Bring back a fallback but enable it
at runtime instead of compile time.

Bug: 126955943
Test: run with cuttlefish
Change-Id: I3ab0282b3e8fde776aa7b37d5772c8f62cf957bf

Change Summary

Incremental Difference

--- a/osi/src/alarm.cc
+++ b/osi/src/alarm.cc
@@ -115,12 +115,6 @@ struct alarm_t {
115115 int64_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS = 3000;
116116 static const clockid_t CLOCK_ID = CLOCK_BOOTTIME;
117117
118-#if (KERNEL_MISSING_CLOCK_BOOTTIME_ALARM == TRUE)
119-static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME;
120-#else
121-static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME_ALARM;
122-#endif
123-
124118 // This mutex ensures that the |alarm_set|, |alarm_cancel|, and alarm callback
125119 // functions execute serially and not concurrently. As a result, this mutex
126120 // also protects the |alarms| list.
@@ -327,7 +321,11 @@ static bool lazy_initialize(void) {
327321 if (!timer_create_internal(CLOCK_ID, &timer)) goto error;
328322 timer_initialized = true;
329323
330- if (!timer_create_internal(CLOCK_ID_ALARM, &wakeup_timer)) goto error;
324+ if (!timer_create_internal(CLOCK_BOOTTIME_ALARM, &wakeup_timer)) {
325+ if (!timer_create_internal(CLOCK_BOOTTIME, &wakeup_timer)) {
326+ goto error;
327+ }
328+ }
331329 wakeup_timer_initialized = true;
332330
333331 alarm_expired = semaphore_new(0);