- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
50 lines
1.3 KiB
Java
50 lines
1.3 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.content.Context;
|
|
import android.os.PowerManager;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class gr {
|
|
private final PowerManager a;
|
|
private PowerManager.WakeLock b;
|
|
private boolean c;
|
|
private boolean d;
|
|
|
|
public gr(Context context) {
|
|
this.a = (PowerManager) context.getApplicationContext().getSystemService("power");
|
|
}
|
|
|
|
public void a(boolean z) {
|
|
if (z && this.b == null) {
|
|
PowerManager powerManager = this.a;
|
|
if (powerManager == null) {
|
|
pc.d("WakeLockManager", "PowerManager is null, therefore not creating the WakeLock.");
|
|
return;
|
|
} else {
|
|
PowerManager.WakeLock newWakeLock = powerManager.newWakeLock(1, "ExoPlayer:WakeLockManager");
|
|
this.b = newWakeLock;
|
|
newWakeLock.setReferenceCounted(false);
|
|
}
|
|
}
|
|
this.c = z;
|
|
a();
|
|
}
|
|
|
|
public void b(boolean z) {
|
|
this.d = z;
|
|
a();
|
|
}
|
|
|
|
private void a() {
|
|
PowerManager.WakeLock wakeLock = this.b;
|
|
if (wakeLock == null) {
|
|
return;
|
|
}
|
|
if (this.c && this.d) {
|
|
wakeLock.acquire();
|
|
} else {
|
|
wakeLock.release();
|
|
}
|
|
}
|
|
}
|