apkfuckery/com.discord/smali/androidx/legacy/content/WakefulBroadcastReceiver.smali

217 lines
5.5 KiB
Smali
Raw Normal View History

2019-02-04 20:08:30 +00:00
.class public abstract Landroidx/legacy/content/WakefulBroadcastReceiver;
.super Landroid/content/BroadcastReceiver;
2019-02-04 20:29:01 +00:00
.source "WakefulBroadcastReceiver.java"
2019-02-04 20:08:30 +00:00
# annotations
.annotation runtime Ljava/lang/Deprecated;
.end annotation
# static fields
.field private static final EXTRA_WAKE_LOCK_ID:Ljava/lang/String; = "androidx.contentpager.content.wakelockid"
.field private static mNextId:I
.field private static final sActiveWakeLocks:Landroid/util/SparseArray;
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroid/util/SparseArray<",
"Landroid/os/PowerManager$WakeLock;",
">;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 1
new-instance v0, Landroid/util/SparseArray;
invoke-direct {v0}, Landroid/util/SparseArray;-><init>()V
sput-object v0, Landroidx/legacy/content/WakefulBroadcastReceiver;->sActiveWakeLocks:Landroid/util/SparseArray;
const/4 v0, 0x1
sput v0, Landroidx/legacy/content/WakefulBroadcastReceiver;->mNextId:I
return-void
.end method
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V
return-void
.end method
.method public static completeWakefulIntent(Landroid/content/Intent;)Z
.locals 4
const-string v0, "androidx.contentpager.content.wakelockid"
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I
move-result p0
if-nez p0, :cond_0
return v1
:cond_0
sget-object v0, Landroidx/legacy/content/WakefulBroadcastReceiver;->sActiveWakeLocks:Landroid/util/SparseArray;
monitor-enter v0
:try_start_0
sget-object v1, Landroidx/legacy/content/WakefulBroadcastReceiver;->sActiveWakeLocks:Landroid/util/SparseArray;
invoke-virtual {v1, p0}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;
move-result-object v1
check-cast v1, Landroid/os/PowerManager$WakeLock;
const/4 v2, 0x1
if-eqz v1, :cond_1
invoke-virtual {v1}, Landroid/os/PowerManager$WakeLock;->release()V
sget-object v1, Landroidx/legacy/content/WakefulBroadcastReceiver;->sActiveWakeLocks:Landroid/util/SparseArray;
invoke-virtual {v1, p0}, Landroid/util/SparseArray;->remove(I)V
monitor-exit v0
return v2
:cond_1
const-string v1, "WakefulBroadcastReceiv."
const-string v3, "No active wake lock id #"
invoke-static {p0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object p0
invoke-virtual {v3, p0}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
invoke-static {v1, p0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
monitor-exit v0
return v2
:catchall_0
move-exception p0
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p0
.end method
.method public static startWakefulService(Landroid/content/Context;Landroid/content/Intent;)Landroid/content/ComponentName;
.locals 5
sget-object v0, Landroidx/legacy/content/WakefulBroadcastReceiver;->sActiveWakeLocks:Landroid/util/SparseArray;
monitor-enter v0
:try_start_0
sget v1, Landroidx/legacy/content/WakefulBroadcastReceiver;->mNextId:I
sget v2, Landroidx/legacy/content/WakefulBroadcastReceiver;->mNextId:I
const/4 v3, 0x1
add-int/2addr v2, v3
sput v2, Landroidx/legacy/content/WakefulBroadcastReceiver;->mNextId:I
if-gtz v2, :cond_0
sput v3, Landroidx/legacy/content/WakefulBroadcastReceiver;->mNextId:I
:cond_0
const-string v2, "androidx.contentpager.content.wakelockid"
invoke-virtual {p1, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
invoke-virtual {p0, p1}, Landroid/content/Context;->startService(Landroid/content/Intent;)Landroid/content/ComponentName;
move-result-object p1
if-nez p1, :cond_1
const/4 p0, 0x0
monitor-exit v0
return-object p0
:cond_1
const-string v2, "power"
invoke-virtual {p0, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Landroid/os/PowerManager;
new-instance v2, Ljava/lang/StringBuilder;
const-string v4, "androidx.core:wake:"
invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Landroid/content/ComponentName;->flattenToShortString()Ljava/lang/String;
move-result-object v4
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-virtual {p0, v3, v2}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;
move-result-object p0
const/4 v2, 0x0
invoke-virtual {p0, v2}, Landroid/os/PowerManager$WakeLock;->setReferenceCounted(Z)V
const-wide/32 v2, 0xea60
invoke-virtual {p0, v2, v3}, Landroid/os/PowerManager$WakeLock;->acquire(J)V
sget-object v2, Landroidx/legacy/content/WakefulBroadcastReceiver;->sActiveWakeLocks:Landroid/util/SparseArray;
invoke-virtual {v2, v1, p0}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
monitor-exit v0
return-object p1
:catchall_0
move-exception p0
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw p0
.end method