Clean WakeLockManager.updateWakeLock logic.

PiperOrigin-RevId: 284552723
This commit is contained in:
samrobinson 2019-12-09 15:55:05 +00:00 committed by Oliver Woodman
parent c90c10c981
commit 4b281cec3b

View file

@ -88,11 +88,9 @@ import com.google.android.exoplayer2.util.Log;
private void updateWakeLock() { private void updateWakeLock() {
// Needed for the library nullness check. If enabled is true, the wakelock will not be null. // Needed for the library nullness check. If enabled is true, the wakelock will not be null.
if (wakeLock != null) { if (wakeLock != null) {
if (enabled) { if (enabled && stayAwake) {
if (stayAwake && !wakeLock.isHeld()) { if (!wakeLock.isHeld()) {
wakeLock.acquire(); wakeLock.acquire();
} else if (!stayAwake && wakeLock.isHeld()) {
wakeLock.release();
} }
} else if (wakeLock.isHeld()) { } else if (wakeLock.isHeld()) {
wakeLock.release(); wakeLock.release();