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 a5420a0b65
commit e4e56fac09

View file

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