granularity level: instruction
.class public Lcom/google/android/gms/stats/WakeLock;
.super Ljava/lang/Object;
.source "com.google.android.gms:play-services-stats@@17.0.1"
.field private static final zzb:J
.field private static volatile zzc:Ljava/util/concurrent/ScheduledExecutorService;
.field private static final zzd:Ljava/lang/Object;
.field private static volatile zze:Lcom/google/android/gms/stats/zzd;
.field zza:Lcom/google/android/gms/internal/stats/zzb;
.field private final zzf:Ljava/lang/Object;
.field private final zzg:Landroid/os/PowerManager$WakeLock;
.field private zzh:I
.field private zzi:Ljava/util/concurrent/Future;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/Future<",
"*>;"
}
.end annotation
.end field
.field private zzj:J
.field private final zzk:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Lcom/google/android/gms/stats/zze;",
">;"
}
.end annotation
.end field
.field private zzl:Z
.field private zzm:I
.field private zzn:Lcom/google/android/gms/common/util/Clock;
.field private zzo:Landroid/os/WorkSource;
.field private final zzp:Ljava/lang/String;
.field private final zzq:Ljava/lang/String;
.field private final zzr:Landroid/content/Context;
.field private final zzs:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Lcom/google/android/gms/stats/zzc;",
">;"
}
.end annotation
.end field
.field private zzt:Ljava/util/concurrent/atomic/AtomicInteger;
.field private final zzu:Ljava/util/concurrent/ScheduledExecutorService;
.method static constructor <clinit>()V
.locals 3
sget-object v0, Ljava/util/concurrent/TimeUnit;->DAYS:Ljava/util/concurrent/TimeUnit;
const-wide/16 v1, 0x16e
invoke-virtual {v0, v1, v2}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
move-result-wide v0
sput-wide v0, Lcom/google/android/gms/stats/WakeLock;->zzb:J
const/4 v0, 0x0
sput-object v0, Lcom/google/android/gms/stats/WakeLock;->zzc:Ljava/util/concurrent/ScheduledExecutorService;
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
sput-object v0, Lcom/google/android/gms/stats/WakeLock;->zzd:Ljava/lang/Object;
new-instance v0, Lcom/google/android/gms/stats/zzb;
invoke-direct {v0}, Lcom/google/android/gms/stats/zzb;-><init>()V
sput-object v0, Lcom/google/android/gms/stats/WakeLock;->zze:Lcom/google/android/gms/stats/zzd;
return-void
.end method
.method public constructor <init>(Landroid/content/Context;ILjava/lang/String;)V
.locals 6
invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v1, Ljava/lang/Object;
invoke-direct {v1}, Ljava/lang/Object;-><init>()V
iput-object v1, p0, Lcom/google/android/gms/stats/WakeLock;->zzf:Ljava/lang/Object;
const/4 v1, 0x0
iput v1, p0, Lcom/google/android/gms/stats/WakeLock;->zzh:I
new-instance v2, Ljava/util/HashSet;
invoke-direct {v2}, Ljava/util/HashSet;-><init>()V
iput-object v2, p0, Lcom/google/android/gms/stats/WakeLock;->zzk:Ljava/util/Set;
const/4 v2, 0x1
iput-boolean v2, p0, Lcom/google/android/gms/stats/WakeLock;->zzl:Z
invoke-static {}, Lcom/google/android/gms/common/util/DefaultClock;->getInstance()Lcom/google/android/gms/common/util/Clock;
move-result-object v3
iput-object v3, p0, Lcom/google/android/gms/stats/WakeLock;->zzn:Lcom/google/android/gms/common/util/Clock;
new-instance v3, Ljava/util/HashMap;
invoke-direct {v3}, Ljava/util/HashMap;-><init>()V
iput-object v3, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
new-instance v3, Ljava/util/concurrent/atomic/AtomicInteger;
invoke-direct {v3, v1}, Ljava/util/concurrent/atomic/AtomicInteger;-><init>(I)V
iput-object v3, p0, Lcom/google/android/gms/stats/WakeLock;->zzt:Ljava/util/concurrent/atomic/AtomicInteger;
const-string v3, "WakeLock: context must not be null"
invoke-static {p1, v3}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const-string v3, "WakeLock: wakeLockName must not be empty"
invoke-static {p3, v3}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotEmpty(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v3
iput-object v3, p0, Lcom/google/android/gms/stats/WakeLock;->zzr:Landroid/content/Context;
iput-object p3, p0, Lcom/google/android/gms/stats/WakeLock;->zzq:Ljava/lang/String;
const/4 v3, 0x0
iput-object v3, p0, Lcom/google/android/gms/stats/WakeLock;->zza:Lcom/google/android/gms/internal/stats/zzb;
const-string v3, "com.google.android.gms"
invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
invoke-static {p3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v3
const-string v4, "*gcore*:"
invoke-virtual {v3}, Ljava/lang/String;->length()I
move-result v5
invoke-virtual {v4, v3}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object v3
iput-object v3, p0, Lcom/google/android/gms/stats/WakeLock;->zzp:Ljava/lang/String;
const-string v3, "power"
invoke-virtual {p1, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v3
check-cast v3, Landroid/os/PowerManager;
invoke-virtual {v3, p2, p3}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;
move-result-object p2
iput-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzg:Landroid/os/PowerManager$WakeLock;
invoke-static {p1}, Lcom/google/android/gms/common/util/WorkSourceUtil;->hasWorkSourcePermission(Landroid/content/Context;)Z
move-result p3
sget-object p1, Lcom/google/android/gms/stats/WakeLock;->zzc:Ljava/util/concurrent/ScheduledExecutorService;
if-nez p1, :cond_5
sget-object p2, Lcom/google/android/gms/stats/WakeLock;->zzd:Ljava/lang/Object;
monitor-enter p2
sget-object p1, Lcom/google/android/gms/stats/WakeLock;->zzc:Ljava/util/concurrent/ScheduledExecutorService;
if-nez p1, :cond_4
invoke-static {}, Lcom/google/android/gms/internal/stats/zzh;->zza()Lcom/google/android/gms/internal/stats/zze;
invoke-static {v2}, Ljava/util/concurrent/Executors;->newScheduledThreadPool(I)Ljava/util/concurrent/ScheduledExecutorService;
move-result-object p1
invoke-static {p1}, Ljava/util/concurrent/Executors;->unconfigurableScheduledExecutorService(Ljava/util/concurrent/ScheduledExecutorService;)Ljava/util/concurrent/ScheduledExecutorService;
move-result-object p1
sput-object p1, Lcom/google/android/gms/stats/WakeLock;->zzc:Ljava/util/concurrent/ScheduledExecutorService;
:cond_4
monitor-exit p2
goto :goto_2
:catchall_0
move-exception p1
monitor-exit p2
:throw0
throw p1
:goto_2
:cond_5
iput-object p1, p0, Lcom/google/android/gms/stats/WakeLock;->zzu:Ljava/util/concurrent/ScheduledExecutorService;
return-void
.end method
.method public static synthetic zza(Lcom/google/android/gms/stats/WakeLock;)V
.locals 4
return-void
.end method
.method private final zzb(Ljava/lang/String;)Ljava/lang/String;
.locals 1
iget-boolean p1, p0, Lcom/google/android/gms/stats/WakeLock;->zzl:Z
const/4 v0, 0x0
if-eqz p1, :cond_0
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
:cond_0
return-object v0
.end method
.method private final zzc()V
.locals 2
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzk:Ljava/util/Set;
invoke-interface {v0}, Ljava/util/Set;->isEmpty()Z
move-result v0
return-void
.end method
.method private final zzd(I)V
.locals 5
iget-object p1, p0, Lcom/google/android/gms/stats/WakeLock;->zzf:Ljava/lang/Object;
monitor-enter p1
:try_start_0
invoke-virtual {p0}, Lcom/google/android/gms/stats/WakeLock;->isHeld()Z
move-result v0
iget-boolean v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzl:Z
const/4 v1, 0x0
iget v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzh:I
add-int/lit8 v0, v0, -0x1
iput v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzh:I
invoke-direct {p0}, Lcom/google/android/gms/stats/WakeLock;->zzc()V
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;
move-result-object v0
invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
move-result-object v0
:goto_1
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v2
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
invoke-interface {v0}, Ljava/util/Map;->clear()V
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzi:Ljava/util/concurrent/Future;
const/4 v2, 0x0
if-eqz v0, :cond_4
invoke-interface {v0, v1}, Ljava/util/concurrent/Future;->cancel(Z)Z
iput-object v2, p0, Lcom/google/android/gms/stats/WakeLock;->zzi:Ljava/util/concurrent/Future;
const-wide/16 v3, 0x0
iput-wide v3, p0, Lcom/google/android/gms/stats/WakeLock;->zzj:J
:cond_4
iput v1, p0, Lcom/google/android/gms/stats/WakeLock;->zzm:I
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzg:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->isHeld()Z
move-result v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_1
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzg:Landroid/os/PowerManager$WakeLock;
invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V
:try_start_2
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zza:Lcom/google/android/gms/internal/stats/zzb;
if-eqz v0, :cond_8
iput-object v2, p0, Lcom/google/android/gms/stats/WakeLock;->zza:Lcom/google/android/gms/internal/stats/zzb;
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
:cond_8
monitor-exit p1
return-void
:catchall_1
move-exception v0
monitor-exit p1
:throw0
throw v0
.end method
.method private static zze(Landroid/os/PowerManager$WakeLock;Landroid/os/WorkSource;)V
.locals 0
return-void
.end method
.method public acquire(J)V
.locals 9
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzt:Ljava/util/concurrent/atomic/AtomicInteger;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->incrementAndGet()I
sget-wide v0, Lcom/google/android/gms/stats/WakeLock;->zzb:J
const-wide v2, 0x7fffffffffffffffL
invoke-static {v2, v3, v0, v1}, Ljava/lang/Math;->min(JJ)J
move-result-wide v0
const-wide/16 v4, 0x1
invoke-static {v0, v1, v4, v5}, Ljava/lang/Math;->max(JJ)J
move-result-wide v0
const-wide/16 v4, 0x0
cmp-long v6, p1, v4
if-lez v6, :cond_0
invoke-static {p1, p2, v0, v1}, Ljava/lang/Math;->min(JJ)J
move-result-wide v0
:cond_0
iget-object p1, p0, Lcom/google/android/gms/stats/WakeLock;->zzf:Ljava/lang/Object;
monitor-enter p1
invoke-virtual {p0}, Lcom/google/android/gms/stats/WakeLock;->isHeld()Z
move-result p2
const/4 v4, 0x0
const/4 v5, 0x0
if-nez p2, :cond_1
invoke-static {v4, v5}, Lcom/google/android/gms/internal/stats/zzb;->zza(ZLcom/google/android/gms/internal/stats/zzc;)Lcom/google/android/gms/internal/stats/zzb;
move-result-object p2
iput-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zza:Lcom/google/android/gms/internal/stats/zzb;
iget-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzg:Landroid/os/PowerManager$WakeLock;
invoke-virtual {p2}, Landroid/os/PowerManager$WakeLock;->acquire()V
iget-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzn:Lcom/google/android/gms/common/util/Clock;
invoke-interface {p2}, Lcom/google/android/gms/common/util/Clock;->elapsedRealtime()J
:cond_1
iget p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzh:I
add-int/lit8 p2, p2, 0x1
iput p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzh:I
iget p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzm:I
add-int/lit8 p2, p2, 0x1
iput p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzm:I
invoke-direct {p0, v5}, Lcom/google/android/gms/stats/WakeLock;->zzb(Ljava/lang/String;)Ljava/lang/String;
iget-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
invoke-interface {p2, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p2
check-cast p2, Lcom/google/android/gms/stats/zzc;
if-nez p2, :cond_2
new-instance p2, Lcom/google/android/gms/stats/zzc;
invoke-direct {p2, v5}, Lcom/google/android/gms/stats/zzc;-><init>(Lcom/google/android/gms/stats/zzb;)V
iget-object v6, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
invoke-interface {v6, v5, p2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:cond_2
iget v5, p2, Lcom/google/android/gms/stats/zzc;->zza:I
add-int/lit8 v5, v5, 0x1
iput v5, p2, Lcom/google/android/gms/stats/zzc;->zza:I
iget-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzn:Lcom/google/android/gms/common/util/Clock;
invoke-interface {p2}, Lcom/google/android/gms/common/util/Clock;->elapsedRealtime()J
move-result-wide v5
sub-long v7, v2, v5
cmp-long p2, v7, v0
if-lez p2, :cond_3
add-long v2, v5, v0
:cond_3
iget-wide v5, p0, Lcom/google/android/gms/stats/WakeLock;->zzj:J
cmp-long p2, v2, v5
if-lez p2, :cond_5
iput-wide v2, p0, Lcom/google/android/gms/stats/WakeLock;->zzj:J
iget-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzi:Ljava/util/concurrent/Future;
iget-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzu:Ljava/util/concurrent/ScheduledExecutorService;
new-instance v2, Lcom/google/android/gms/stats/zza;
invoke-direct {v2, p0}, Lcom/google/android/gms/stats/zza;-><init>(Lcom/google/android/gms/stats/WakeLock;)V
sget-object v3, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
invoke-interface {p2, v2, v0, v1, v3}, Ljava/util/concurrent/ScheduledExecutorService;->schedule(Ljava/lang/Runnable;JLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;
move-result-object p2
iput-object p2, p0, Lcom/google/android/gms/stats/WakeLock;->zzi:Ljava/util/concurrent/Future;
:cond_5
monitor-exit p1
return-void
:catchall_0
move-exception p2
monitor-exit p1
:throw0
throw p2
.end method
.method public isHeld()Z
.locals 2
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzf:Ljava/lang/Object;
monitor-enter v0
iget v1, p0, Lcom/google/android/gms/stats/WakeLock;->zzh:I
if-lez v1, :cond_0
const/4 v1, 0x1
goto :goto_0
:cond_0
const/4 v1, 0x0
:goto_0
monitor-exit v0
return v1
:catchall_0
move-exception v1
monitor-exit v0
:throw0
throw v1
.end method
.method public release()V
.locals 4
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzt:Ljava/util/concurrent/atomic/AtomicInteger;
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->decrementAndGet()I
move-result v0
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzf:Ljava/lang/Object;
monitor-enter v0
const/4 v1, 0x0
invoke-direct {p0, v1}, Lcom/google/android/gms/stats/WakeLock;->zzb(Ljava/lang/String;)Ljava/lang/String;
iget-object v2, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
invoke-interface {v2, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v2
iget-object v2, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
invoke-interface {v2, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Lcom/google/android/gms/stats/zzc;
if-eqz v2, :cond_2
iget v3, v2, Lcom/google/android/gms/stats/zzc;->zza:I
add-int/lit8 v3, v3, -0x1
iput v3, v2, Lcom/google/android/gms/stats/zzc;->zza:I
if-nez v3, :cond_2
iget-object v2, p0, Lcom/google/android/gms/stats/WakeLock;->zzs:Ljava/util/Map;
invoke-interface {v2, v1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
:cond_2
const/4 v1, 0x0
invoke-direct {p0, v1}, Lcom/google/android/gms/stats/WakeLock;->zzd(I)V
monitor-exit v0
return-void
:catchall_0
move-exception v1
monitor-exit v0
:throw0
throw v1
.end method
.method public setReferenceCounted(Z)V
.locals 1
iget-object v0, p0, Lcom/google/android/gms/stats/WakeLock;->zzf:Ljava/lang/Object;
monitor-enter v0
iput-boolean p1, p0, Lcom/google/android/gms/stats/WakeLock;->zzl:Z
monitor-exit v0
return-void
:catchall_0
move-exception p1
monitor-exit v0
:throw0
throw p1
.end method