436 lines
11 KiB
Smali
436 lines
11 KiB
Smali
.class public Lru/mail/libverify/utils/VerificationJobService;
|
|
.super Landroid/app/job/JobService;
|
|
|
|
|
|
# static fields
|
|
.field private static final a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/concurrent/ConcurrentHashMap<",
|
|
"Ljava/lang/Object;",
|
|
"Ljava/lang/Object;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private static final b:Ljava/util/concurrent/ExecutorService;
|
|
|
|
.field private static final c:Ljava/util/concurrent/atomic/AtomicReference;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/concurrent/atomic/AtomicReference<",
|
|
"Landroid/app/job/JobParameters;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# instance fields
|
|
.field private final d:J
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
|
|
|
|
sput-object v0, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-static {}, Ljava/util/concurrent/Executors;->newCachedThreadPool()Ljava/util/concurrent/ExecutorService;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lru/mail/libverify/utils/VerificationJobService;->b:Ljava/util/concurrent/ExecutorService;
|
|
|
|
new-instance v0, Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
|
|
|
|
sput-object v0, Lru/mail/libverify/utils/VerificationJobService;->c:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 2
|
|
|
|
invoke-direct {p0}, Landroid/app/job/JobService;-><init>()V
|
|
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v0
|
|
|
|
iput-wide v0, p0, Lru/mail/libverify/utils/VerificationJobService;->d:J
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static synthetic a(Lru/mail/libverify/utils/VerificationJobService;)J
|
|
.locals 2
|
|
|
|
iget-wide v0, p0, Lru/mail/libverify/utils/VerificationJobService;->d:J
|
|
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method static synthetic a()Ljava/util/concurrent/ConcurrentHashMap;
|
|
.locals 1
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static a(Landroid/content/Context;)Z
|
|
.locals 2
|
|
|
|
const-string v0, "VerificationJobService"
|
|
|
|
const-string v1, "releaseAll"
|
|
|
|
invoke-static {v0, v1}, Lru/mail/libverify/utils/d;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->c:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicReference;->set(Ljava/lang/Object;)V
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentHashMap;->clear()V
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
sget-object v1, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Object;->notify()V
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-static {p0}, Lru/mail/libverify/utils/VerificationJobService;->c(Landroid/content/Context;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
:try_start_1
|
|
monitor-exit v0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public static a(Landroid/content/Context;Ljava/lang/Object;)Z
|
|
.locals 3
|
|
|
|
const-string v0, "VerificationJobService"
|
|
|
|
const-string v1, "acquire "
|
|
|
|
invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v0, v1}, Lru/mail/libverify/utils/d;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {v0, p1}, Ljava/util/concurrent/ConcurrentHashMap;->containsKey(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {v0, p1, p1}, Ljava/util/concurrent/ConcurrentHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
invoke-static {p0}, Lru/mail/libverify/utils/VerificationJobService;->b(Landroid/content/Context;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x1
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method static synthetic b()Ljava/util/concurrent/atomic/AtomicReference;
|
|
.locals 1
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->c:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private static b(Landroid/content/Context;)Z
|
|
.locals 6
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/16 v2, 0x15
|
|
|
|
if-lt v0, v2, :cond_1
|
|
|
|
:try_start_0
|
|
const-string v0, "jobscheduler"
|
|
|
|
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/app/job/JobScheduler;
|
|
|
|
const/4 v2, 0x1
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object v3
|
|
|
|
sget v4, Lru/mail/libverify/R$integer;->libverify_verification_job_id:I
|
|
|
|
invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getInteger(I)I
|
|
|
|
move-result v3
|
|
|
|
new-instance v4, Landroid/content/ComponentName;
|
|
|
|
const-class v5, Lru/mail/libverify/utils/VerificationJobService;
|
|
|
|
invoke-direct {v4, p0, v5}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
|
|
|
sget p0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v5, 0x18
|
|
|
|
if-lt p0, v5, :cond_0
|
|
|
|
const/4 p0, 0x3
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x1
|
|
|
|
:goto_0
|
|
new-instance v5, Landroid/app/job/JobInfo$Builder;
|
|
|
|
invoke-direct {v5, v3, v4}, Landroid/app/job/JobInfo$Builder;-><init>(ILandroid/content/ComponentName;)V
|
|
|
|
invoke-virtual {v5, p0}, Landroid/app/job/JobInfo$Builder;->setRequiredNetworkType(I)Landroid/app/job/JobInfo$Builder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Landroid/app/job/JobInfo$Builder;->build()Landroid/app/job/JobInfo;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {v0, p0}, Landroid/app/job/JobScheduler;->schedule(Landroid/app/job/JobInfo;)I
|
|
|
|
move-result p0
|
|
:try_end_0
|
|
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
if-ne p0, v2, :cond_1
|
|
|
|
const/4 v1, 0x1
|
|
|
|
return v1
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v0, "VerificationJobService"
|
|
|
|
const-string v2, "failed to start a service"
|
|
|
|
invoke-static {v0, v2, p0}, Lru/mail/libverify/utils/d;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
:cond_1
|
|
return v1
|
|
.end method
|
|
|
|
.method public static b(Landroid/content/Context;Ljava/lang/Object;)Z
|
|
.locals 5
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {v0, p1}, Ljava/util/concurrent/ConcurrentHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x1
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const-string v0, "VerificationJobService"
|
|
|
|
const-string v3, "release owner %s"
|
|
|
|
new-array v4, v2, [Ljava/lang/Object;
|
|
|
|
aput-object p1, v4, v1
|
|
|
|
invoke-static {v0, v3, v4}, Lru/mail/libverify/utils/d;->c(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
|
|
|
|
sget-object p1, Lru/mail/libverify/utils/VerificationJobService;->a:Ljava/util/concurrent/ConcurrentHashMap;
|
|
|
|
invoke-virtual {p1}, Ljava/util/concurrent/ConcurrentHashMap;->size()I
|
|
|
|
move-result p1
|
|
|
|
if-nez p1, :cond_1
|
|
|
|
invoke-static {p0}, Lru/mail/libverify/utils/VerificationJobService;->a(Landroid/content/Context;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
|
|
:cond_0
|
|
const-string p0, "VerificationJobService"
|
|
|
|
const-string v0, "no actions to release for owner %s"
|
|
|
|
new-array v3, v2, [Ljava/lang/Object;
|
|
|
|
aput-object p1, v3, v1
|
|
|
|
invoke-static {p0, v0, v3}, Lru/mail/libverify/utils/d;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
|
|
|
|
:cond_1
|
|
return v2
|
|
.end method
|
|
|
|
.method private static c(Landroid/content/Context;)Z
|
|
.locals 3
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/16 v2, 0x15
|
|
|
|
if-lt v0, v2, :cond_0
|
|
|
|
:try_start_0
|
|
const-string v0, "jobscheduler"
|
|
|
|
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/app/job/JobScheduler;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
|
|
|
|
move-result-object p0
|
|
|
|
sget v2, Lru/mail/libverify/R$integer;->libverify_verification_job_id:I
|
|
|
|
invoke-virtual {p0, v2}, Landroid/content/res/Resources;->getInteger(I)I
|
|
|
|
move-result p0
|
|
|
|
invoke-virtual {v0, p0}, Landroid/app/job/JobScheduler;->cancel(I)V
|
|
:try_end_0
|
|
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
const/4 p0, 0x1
|
|
|
|
const/4 v1, 0x1
|
|
|
|
return v1
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
const-string v0, "VerificationJobService"
|
|
|
|
const-string v2, "failed to stop service"
|
|
|
|
invoke-static {v0, v2, p0}, Lru/mail/libverify/utils/d;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
:cond_0
|
|
return v1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public onStartJob(Landroid/app/job/JobParameters;)Z
|
|
.locals 2
|
|
|
|
sget-object v0, Lru/mail/libverify/utils/VerificationJobService;->c:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-virtual {v0, v1, p1}, Ljava/util/concurrent/atomic/AtomicReference;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
sget-object p1, Lru/mail/libverify/utils/VerificationJobService;->b:Ljava/util/concurrent/ExecutorService;
|
|
|
|
new-instance v0, Lru/mail/libverify/utils/VerificationJobService$1;
|
|
|
|
invoke-direct {v0, p0}, Lru/mail/libverify/utils/VerificationJobService$1;-><init>(Lru/mail/libverify/utils/VerificationJobService;)V
|
|
|
|
invoke-interface {p1, v0}, Ljava/util/concurrent/ExecutorService;->submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;
|
|
|
|
:cond_0
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public onStopJob(Landroid/app/job/JobParameters;)Z
|
|
.locals 0
|
|
|
|
sget-object p1, Lru/mail/libverify/utils/VerificationJobService;->c:Ljava/util/concurrent/atomic/AtomicReference;
|
|
|
|
invoke-virtual {p1}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|