mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-30 02:44:56 +01:00
only acquire a wake lock if a lock is not already held
This commit is contained in:
parent
4949a06343
commit
8b96d8cd8d
@ -93,7 +93,9 @@ class CallProximityManager @Inject constructor(
|
|||||||
if (wakeLock == null) {
|
if (wakeLock == null) {
|
||||||
wakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, generateWakeLockTag())
|
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() {
|
private fun onProximityFar() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user