only acquire a wake lock if a lock is not already held

This commit is contained in:
Adam Brown 2021-12-15 17:32:39 +00:00
parent 4949a06343
commit 8b96d8cd8d

View file

@ -93,7 +93,9 @@ class CallProximityManager @Inject constructor(
if (wakeLock == null) {
wakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, generateWakeLockTag())
}
wakeLock?.acquire(WAKE_LOCK_TIMEOUT_MILLIS)
wakeLock
?.takeIf { !it.isHeld }
?.acquire(WAKE_LOCK_TIMEOUT_MILLIS)
}
private fun onProximityFar() {