208 lines
5.1 KiB
Smali
208 lines
5.1 KiB
Smali
.class public Landroidx/work/impl/utils/WakeLocks;
|
|
.super Ljava/lang/Object;
|
|
.source "WakeLocks.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Landroidx/annotation/RestrictTo;
|
|
value = {
|
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final TAG:Ljava/lang/String;
|
|
|
|
.field public static final sWakeLocks:Ljava/util/WeakHashMap;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/WeakHashMap<",
|
|
"Landroid/os/PowerManager$WakeLock;",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-string v0, "WakeLocks"
|
|
|
|
invoke-static {v0}, Landroidx/work/Logger;->tagWithPrefix(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Landroidx/work/impl/utils/WakeLocks;->TAG:Ljava/lang/String;
|
|
|
|
new-instance v0, Ljava/util/WeakHashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/WeakHashMap;-><init>()V
|
|
|
|
sput-object v0, Landroidx/work/impl/utils/WakeLocks;->sWakeLocks:Ljava/util/WeakHashMap;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static checkWakeLocks()V
|
|
.locals 6
|
|
|
|
new-instance v0, Ljava/util/HashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
|
|
|
|
sget-object v1, Landroidx/work/impl/utils/WakeLocks;->sWakeLocks:Ljava/util/WeakHashMap;
|
|
|
|
monitor-enter v1
|
|
|
|
:try_start_0
|
|
sget-object v2, Landroidx/work/impl/utils/WakeLocks;->sWakeLocks:Ljava/util/WeakHashMap;
|
|
|
|
invoke-virtual {v0, v2}, Ljava/util/HashMap;->putAll(Ljava/util/Map;)V
|
|
|
|
monitor-exit v1
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-virtual {v0}, Ljava/util/HashMap;->keySet()Ljava/util/Set;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v1
|
|
|
|
:cond_0
|
|
:goto_0
|
|
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Landroid/os/PowerManager$WakeLock;
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
invoke-virtual {v2}, Landroid/os/PowerManager$WakeLock;->isHeld()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
const-string v3, "WakeLock held for %s"
|
|
|
|
const/4 v4, 0x1
|
|
|
|
new-array v4, v4, [Ljava/lang/Object;
|
|
|
|
invoke-virtual {v0, v2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
const/4 v5, 0x0
|
|
|
|
aput-object v2, v4, v5
|
|
|
|
invoke-static {v3, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {}, Landroidx/work/Logger;->get()Landroidx/work/Logger;
|
|
|
|
move-result-object v3
|
|
|
|
sget-object v4, Landroidx/work/impl/utils/WakeLocks;->TAG:Ljava/lang/String;
|
|
|
|
new-array v5, v5, [Ljava/lang/Throwable;
|
|
|
|
invoke-virtual {v3, v4, v2, v5}, Landroidx/work/Logger;->warning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
:try_start_1
|
|
monitor-exit v1
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static newWakeLock(Landroid/content/Context;Ljava/lang/String;)Landroid/os/PowerManager$WakeLock;
|
|
.locals 2
|
|
.param p0 # Landroid/content/Context;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Ljava/lang/String;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object p0
|
|
|
|
const-string v0, "power"
|
|
|
|
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Landroid/os/PowerManager;
|
|
|
|
const-string v0, "WorkManager: "
|
|
|
|
invoke-static {v0, p1}, Lf/e/b/a/a;->q(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const/4 v0, 0x1
|
|
|
|
invoke-virtual {p0, v0, p1}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;
|
|
|
|
move-result-object p0
|
|
|
|
sget-object v0, Landroidx/work/impl/utils/WakeLocks;->sWakeLocks:Ljava/util/WeakHashMap;
|
|
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
sget-object v1, Landroidx/work/impl/utils/WakeLocks;->sWakeLocks:Ljava/util/WeakHashMap;
|
|
|
|
invoke-virtual {v1, p0, p1}, Ljava/util/WeakHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
monitor-exit v0
|
|
|
|
return-object p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw p0
|
|
.end method
|