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

Commit 99313195 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Simon Wilson
Browse files

Prevent Java call for acquiring already held wakelock

Change-Id: Icf455b6aa7c0c1bf7abf7ea9700cfde17f6c7c2b
parent 4feaba99
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -211,6 +211,8 @@ void alarm_service_reschedule()
    if (ticks_in_millis <= TIMER_INTERVAL_FOR_WAKELOCK_IN_MS)
    {
        // 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)
            {
@@ -218,6 +220,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))
@@ -234,10 +237,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);
        }
    }
}


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