228 lines
5.9 KiB
Smali
228 lines
5.9 KiB
Smali
.class public Landroidx/work/impl/Schedulers;
|
|
.super Ljava/lang/Object;
|
|
.source "Schedulers.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final TAG:Ljava/lang/String;
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-string v0, "Schedulers"
|
|
|
|
invoke-static {v0}, Landroidx/work/Logger;->tagWithPrefix(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Landroidx/work/impl/Schedulers;->TAG:Ljava/lang/String;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static createBestAvailableBackgroundScheduler(Landroid/content/Context;Landroidx/work/impl/WorkManagerImpl;)Landroidx/work/impl/Scheduler;
|
|
.locals 5
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
const/16 v3, 0x17
|
|
|
|
if-lt v0, v3, :cond_0
|
|
|
|
new-instance v0, Landroidx/work/impl/background/systemjob/SystemJobScheduler;
|
|
|
|
invoke-direct {v0, p0, p1}, Landroidx/work/impl/background/systemjob/SystemJobScheduler;-><init>(Landroid/content/Context;Landroidx/work/impl/WorkManagerImpl;)V
|
|
|
|
const-class p1, Landroidx/work/impl/background/systemjob/SystemJobService;
|
|
|
|
invoke-static {p0, p1, v1}, Landroidx/work/impl/utils/PackageManagerHelper;->setComponentEnabled(Landroid/content/Context;Ljava/lang/Class;Z)V
|
|
|
|
invoke-static {}, Landroidx/work/Logger;->get()Landroidx/work/Logger;
|
|
|
|
move-result-object p1
|
|
|
|
sget-object v1, Landroidx/work/impl/Schedulers;->TAG:Ljava/lang/String;
|
|
|
|
new-array v3, v2, [Ljava/lang/Throwable;
|
|
|
|
const-string v4, "Created SystemJobScheduler and enabled SystemJobService"
|
|
|
|
invoke-virtual {p1, v1, v4, v3}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
const/4 v1, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
new-instance v0, Landroidx/work/impl/background/systemalarm/SystemAlarmScheduler;
|
|
|
|
invoke-direct {v0, p0}, Landroidx/work/impl/background/systemalarm/SystemAlarmScheduler;-><init>(Landroid/content/Context;)V
|
|
|
|
invoke-static {}, Landroidx/work/Logger;->get()Landroidx/work/Logger;
|
|
|
|
move-result-object p1
|
|
|
|
sget-object v3, Landroidx/work/impl/Schedulers;->TAG:Ljava/lang/String;
|
|
|
|
new-array v2, v2, [Ljava/lang/Throwable;
|
|
|
|
const-string v4, "Created SystemAlarmScheduler"
|
|
|
|
invoke-virtual {p1, v3, v4, v2}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
|
|
|
:goto_0
|
|
const-class p1, Landroidx/work/impl/background/systemalarm/SystemAlarmService;
|
|
|
|
invoke-static {p0, p1, v1}, Landroidx/work/impl/utils/PackageManagerHelper;->setComponentEnabled(Landroid/content/Context;Ljava/lang/Class;Z)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static schedule(Landroidx/work/Configuration;Landroidx/work/impl/WorkDatabase;Ljava/util/List;)V
|
|
.locals 5
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Landroidx/work/Configuration;",
|
|
"Landroidx/work/impl/WorkDatabase;",
|
|
"Ljava/util/List<",
|
|
"Landroidx/work/impl/Scheduler;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
if-eqz p2, :cond_3
|
|
|
|
invoke-interface {p2}, Ljava/util/List;->size()I
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
goto :goto_2
|
|
|
|
:cond_0
|
|
invoke-virtual {p1}, Landroidx/work/impl/WorkDatabase;->workSpecDao()Landroidx/work/impl/model/WorkSpecDao;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p1}, Landroidx/work/impl/WorkDatabase;->beginTransaction()V
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0}, Landroidx/work/Configuration;->getMaxSchedulerLimit()I
|
|
|
|
move-result p0
|
|
|
|
invoke-interface {v0, p0}, Landroidx/work/impl/model/WorkSpecDao;->getEligibleWorkForScheduling(I)Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
if-eqz p0, :cond_1
|
|
|
|
invoke-interface {p0}, Ljava/util/List;->size()I
|
|
|
|
move-result v1
|
|
|
|
if-lez v1, :cond_1
|
|
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v1
|
|
|
|
invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v3
|
|
|
|
:goto_0
|
|
invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_1
|
|
|
|
invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
check-cast v4, Landroidx/work/impl/model/WorkSpec;
|
|
|
|
iget-object v4, v4, Landroidx/work/impl/model/WorkSpec;->id:Ljava/lang/String;
|
|
|
|
invoke-interface {v0, v4, v1, v2}, Landroidx/work/impl/model/WorkSpecDao;->markWorkSpecScheduled(Ljava/lang/String;J)I
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-virtual {p1}, Landroidx/work/impl/WorkDatabase;->setTransactionSuccessful()V
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-virtual {p1}, Landroidx/work/impl/WorkDatabase;->endTransaction()V
|
|
|
|
if-eqz p0, :cond_2
|
|
|
|
invoke-interface {p0}, Ljava/util/List;->size()I
|
|
|
|
move-result p1
|
|
|
|
if-lez p1, :cond_2
|
|
|
|
const/4 p1, 0x0
|
|
|
|
new-array p1, p1, [Landroidx/work/impl/model/WorkSpec;
|
|
|
|
invoke-interface {p0, p1}, Ljava/util/List;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, [Landroidx/work/impl/model/WorkSpec;
|
|
|
|
invoke-interface {p2}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p1
|
|
|
|
:goto_1
|
|
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object p2
|
|
|
|
check-cast p2, Landroidx/work/impl/Scheduler;
|
|
|
|
invoke-interface {p2, p0}, Landroidx/work/impl/Scheduler;->schedule([Landroidx/work/impl/model/WorkSpec;)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
invoke-virtual {p1}, Landroidx/work/impl/WorkDatabase;->endTransaction()V
|
|
|
|
throw p0
|
|
|
|
:cond_3
|
|
:goto_2
|
|
return-void
|
|
.end method
|