319 lines
9.6 KiB
Smali
319 lines
9.6 KiB
Smali
|
.class Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;
|
||
|
.super Ljava/lang/Object;
|
||
|
.source "VoiceEngineForegroundService.java"
|
||
|
|
||
|
|
||
|
# annotations
|
||
|
.annotation system Ldalvik/annotation/EnclosingClass;
|
||
|
value = Lcom/discord/utilities/voice/VoiceEngineForegroundService;
|
||
|
.end annotation
|
||
|
|
||
|
.annotation system Ldalvik/annotation/InnerClass;
|
||
|
accessFlags = 0xa
|
||
|
name = "WakeLock"
|
||
|
.end annotation
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field private static final TAG_POWER:Ljava/lang/String; = "TAG_POWER"
|
||
|
|
||
|
.field private static final TAG_WIFI:Ljava/lang/String; = "TAG_WIFI"
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field private final context:Landroid/content/Context;
|
||
|
|
||
|
.field private final wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/concurrent/atomic/AtomicReference",
|
||
|
"<",
|
||
|
"Ljava/lang/Object;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field private final wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/concurrent/atomic/AtomicReference",
|
||
|
"<",
|
||
|
"Ljava/lang/Object;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method private constructor <init>(Landroid/content/Context;)V
|
||
|
.locals 1
|
||
|
.param p1, "context" # Landroid/content/Context;
|
||
|
|
||
|
.prologue
|
||
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||
|
|
||
|
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
|
||
|
|
||
|
iput-object v0, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
|
||
|
|
||
|
iput-object v0, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
iput-object p1, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->context:Landroid/content/Context;
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public static create(Landroid/content/Context;)Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;
|
||
|
.locals 1
|
||
|
.param p0, "context" # Landroid/content/Context;
|
||
|
|
||
|
.prologue
|
||
|
new-instance v0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;
|
||
|
|
||
|
invoke-direct {v0, p0}, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;-><init>(Landroid/content/Context;)V
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public acquire()V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
invoke-virtual {p0}, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->getWakeLock()Landroid/os/PowerManager$WakeLock;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->acquire()V
|
||
|
|
||
|
invoke-virtual {p0}, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->getWakeLockWifi()Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/net/wifi/WifiManager$WifiLock;->acquire()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public getWakeLock()Landroid/os/PowerManager$WakeLock;
|
||
|
.locals 6
|
||
|
|
||
|
.prologue
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
.local v1, "value":Ljava/lang/Object;
|
||
|
if-nez v1, :cond_1
|
||
|
|
||
|
iget-object v3, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
monitor-enter v3
|
||
|
|
||
|
:try_start_0
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
if-nez v1, :cond_0
|
||
|
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->context:Landroid/content/Context;
|
||
|
|
||
|
const-string v4, "power"
|
||
|
|
||
|
invoke-virtual {v2, v4}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
check-cast v2, Landroid/os/PowerManager;
|
||
|
|
||
|
const/4 v4, 0x1
|
||
|
|
||
|
const-string v5, "TAG_WIFI"
|
||
|
|
||
|
invoke-virtual {v2, v4, v5}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.local v0, "actualValue":Landroid/os/PowerManager$WakeLock;
|
||
|
if-nez v0, :cond_2
|
||
|
|
||
|
iget-object v1, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
:goto_0
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-virtual {v2, v1}, Ljava/util/concurrent/atomic/AtomicReference;->set(Ljava/lang/Object;)V
|
||
|
|
||
|
.end local v0 # "actualValue":Landroid/os/PowerManager$WakeLock;
|
||
|
:cond_0
|
||
|
monitor-exit v3
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
:cond_1
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLock:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
if-ne v1, v2, :cond_3
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
:goto_1
|
||
|
check-cast v2, Landroid/os/PowerManager$WakeLock;
|
||
|
|
||
|
check-cast v2, Landroid/os/PowerManager$WakeLock;
|
||
|
|
||
|
return-object v2
|
||
|
|
||
|
.restart local v0 # "actualValue":Landroid/os/PowerManager$WakeLock;
|
||
|
:cond_2
|
||
|
move-object v1, v0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.end local v0 # "actualValue":Landroid/os/PowerManager$WakeLock;
|
||
|
:catchall_0
|
||
|
move-exception v2
|
||
|
|
||
|
:try_start_1
|
||
|
monitor-exit v3
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
throw v2
|
||
|
|
||
|
:cond_3
|
||
|
move-object v2, v1
|
||
|
|
||
|
goto :goto_1
|
||
|
.end method
|
||
|
|
||
|
.method public getWakeLockWifi()Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
.locals 6
|
||
|
|
||
|
.prologue
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
.local v1, "value":Ljava/lang/Object;
|
||
|
if-nez v1, :cond_1
|
||
|
|
||
|
iget-object v3, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
monitor-enter v3
|
||
|
|
||
|
:try_start_0
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
if-nez v1, :cond_0
|
||
|
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->context:Landroid/content/Context;
|
||
|
|
||
|
const-string v4, "wifi"
|
||
|
|
||
|
invoke-virtual {v2, v4}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
check-cast v2, Landroid/net/wifi/WifiManager;
|
||
|
|
||
|
const/4 v4, 0x1
|
||
|
|
||
|
const-string v5, "TAG_POWER"
|
||
|
|
||
|
invoke-virtual {v2, v4, v5}, Landroid/net/wifi/WifiManager;->createWifiLock(ILjava/lang/String;)Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.local v0, "actualValue":Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
if-nez v0, :cond_2
|
||
|
|
||
|
iget-object v1, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
:goto_0
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
invoke-virtual {v2, v1}, Ljava/util/concurrent/atomic/AtomicReference;->set(Ljava/lang/Object;)V
|
||
|
|
||
|
.end local v0 # "actualValue":Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
:cond_0
|
||
|
monitor-exit v3
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
:cond_1
|
||
|
iget-object v2, p0, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->wakeLockWifi:Ljava/util/concurrent/atomic/AtomicReference;
|
||
|
|
||
|
if-ne v1, v2, :cond_3
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
:goto_1
|
||
|
check-cast v2, Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
|
||
|
check-cast v2, Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
|
||
|
return-object v2
|
||
|
|
||
|
.restart local v0 # "actualValue":Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
:cond_2
|
||
|
move-object v1, v0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.end local v0 # "actualValue":Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
:catchall_0
|
||
|
move-exception v2
|
||
|
|
||
|
:try_start_1
|
||
|
monitor-exit v3
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
throw v2
|
||
|
|
||
|
:cond_3
|
||
|
move-object v2, v1
|
||
|
|
||
|
goto :goto_1
|
||
|
.end method
|
||
|
|
||
|
.method public release()V
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
invoke-virtual {p0}, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->getWakeLock()Landroid/os/PowerManager$WakeLock;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V
|
||
|
|
||
|
invoke-virtual {p0}, Lcom/discord/utilities/voice/VoiceEngineForegroundService$WakeLock;->getWakeLockWifi()Landroid/net/wifi/WifiManager$WifiLock;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/net/wifi/WifiManager$WifiLock;->release()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|