Fix logic error releasing wakelock.
This commit is contained in:
parent
9dacf8b68e
commit
8b396f3bba
1 changed files with 7 additions and 4 deletions
|
@ -219,15 +219,18 @@ class TrackerService: Service()
|
||||||
location_interval = Keys.LOCATION_INTERVAL_DEAD
|
location_interval = Keys.LOCATION_INTERVAL_DEAD
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
val should_wakelock = (
|
||||||
(gpsLocationListenerRegistered || networkLocationListenerRegistered) &&
|
(gpsLocationListenerRegistered || networkLocationListenerRegistered) &&
|
||||||
trackingState == Keys.STATE_TRACKING_ACTIVE &&
|
trackingState == Keys.STATE_TRACKING_ACTIVE &&
|
||||||
interval == Keys.LOCATION_INTERVAL_FULL_POWER &&
|
interval == Keys.LOCATION_INTERVAL_FULL_POWER
|
||||||
!wakelock.isHeld
|
|
||||||
)
|
)
|
||||||
|
if (should_wakelock)
|
||||||
|
{
|
||||||
|
if (! wakelock.isHeld)
|
||||||
{
|
{
|
||||||
wakelock.acquire()
|
wakelock.acquire()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (wakelock.isHeld)
|
else if (wakelock.isHeld)
|
||||||
{
|
{
|
||||||
wakelock.release()
|
wakelock.release()
|
||||||
|
|
Loading…
Reference in a new issue