alexandroid/decompiled/jadx/sources/com/google/android/exoplayer2/WifiLockManager.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

58 lines
1.8 KiB
Java

package com.google.android.exoplayer2;
import android.content.Context;
import android.net.wifi.WifiManager;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.util.Log;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes7.dex */
final class WifiLockManager {
private static final String TAG = "WifiLockManager";
private static final String WIFI_LOCK_TAG = "ExoPlayer:WifiLockManager";
private boolean enabled;
private boolean stayAwake;
@Nullable
private WifiManager.WifiLock wifiLock;
@Nullable
private final WifiManager wifiManager;
public WifiLockManager(Context context) {
this.wifiManager = (WifiManager) context.getApplicationContext().getSystemService("wifi");
}
private void updateWifiLock() {
WifiManager.WifiLock wifiLock = this.wifiLock;
if (wifiLock == null) {
return;
}
if (this.enabled && this.stayAwake) {
wifiLock.acquire();
} else {
wifiLock.release();
}
}
public void setEnabled(boolean z) {
if (z && this.wifiLock == null) {
WifiManager wifiManager = this.wifiManager;
if (wifiManager == null) {
Log.w(TAG, "WifiManager is null, therefore not creating the WifiLock.");
return;
} else {
WifiManager.WifiLock createWifiLock = wifiManager.createWifiLock(3, WIFI_LOCK_TAG);
this.wifiLock = createWifiLock;
createWifiLock.setReferenceCounted(false);
}
}
this.enabled = z;
updateWifiLock();
}
public void setStayAwake(boolean z) {
this.stayAwake = z;
updateWifiLock();
}
}