Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e918c92e authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Android Git Automerger
Browse files

am 99313195: Prevent Java call for acquiring already held wakelock

* commit '99313195':
  Prevent Java call for acquiring already held wakelock
parents 18d02a35 99313195
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -216,6 +216,8 @@ void alarm_service_reschedule()
    if (ticks_in_millis <= GKI_TIMER_INTERVAL_FOR_WAKELOCK)
    {
        // The next deadline is close, just take a wakelock and set a regular (non-wake) timer.
        if (!alarm_service.wakelock)
        {
            int rc = bt_os_callouts->acquire_wake_lock(WAKE_LOCK_ID);
            if (rc != BT_STATUS_SUCCESS)
            {
@@ -223,6 +225,7 @@ void alarm_service_reschedule()
                return;
            }
            alarm_service.wakelock = true;
        }
        ALOGV("%s acquired wake lock, setting short alarm (%lldms).", __func__, ticks_in_millis);

        if (!set_nonwake_alarm(ticks_in_millis))
@@ -239,10 +242,14 @@ void alarm_service_reschedule()
        } else {
            ALOGV("%s set long alarm (%lldms), releasing wake lock.", __func__, ticks_in_millis);
        }

        if (alarm_service.wakelock)
        {
            alarm_service.wakelock = false;
            bt_os_callouts->release_wake_lock(WAKE_LOCK_ID);
        }
    }
}


/*****************************************************************************