277 lines
7.9 KiB
Smali
277 lines
7.9 KiB
Smali
|
.class public Landroidx/work/impl/utils/ForceStopRunnable;
|
||
|
.super Ljava/lang/Object;
|
||
|
|
||
|
# interfaces
|
||
|
.implements Ljava/lang/Runnable;
|
||
|
|
||
|
|
||
|
# annotations
|
||
|
.annotation build Landroidx/annotation/RestrictTo;
|
||
|
value = {
|
||
|
.enum Landroidx/annotation/RestrictTo$Scope;->LIBRARY_GROUP:Landroidx/annotation/RestrictTo$Scope;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
.annotation system Ldalvik/annotation/MemberClasses;
|
||
|
value = {
|
||
|
Landroidx/work/impl/utils/ForceStopRunnable$BroadcastReceiver;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field static final ACTION_FORCE_STOP_RESCHEDULE:Ljava/lang/String; = "ACTION_FORCE_STOP_RESCHEDULE"
|
||
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field private static final ALARM_ID:I = -0x1
|
||
|
|
||
|
.field private static final TAG:Ljava/lang/String; = "ForceStopRunnable"
|
||
|
|
||
|
.field private static final TEN_YEARS:J
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field private final mContext:Landroid/content/Context;
|
||
|
|
||
|
.field private final mWorkManager:Landroidx/work/impl/WorkManagerImpl;
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method static constructor <clinit>()V
|
||
|
.locals 3
|
||
|
|
||
|
sget-object v0, Ljava/util/concurrent/TimeUnit;->DAYS:Ljava/util/concurrent/TimeUnit;
|
||
|
|
||
|
const-wide/16 v1, 0xe42
|
||
|
|
||
|
invoke-virtual {v0, v1, v2}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
|
||
|
|
||
|
move-result-wide v0
|
||
|
|
||
|
sput-wide v0, Landroidx/work/impl/utils/ForceStopRunnable;->TEN_YEARS:J
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public constructor <init>(Landroid/content/Context;Landroidx/work/impl/WorkManagerImpl;)V
|
||
|
.locals 0
|
||
|
.param p1 # Landroid/content/Context;
|
||
|
.annotation build Landroidx/annotation/NonNull;
|
||
|
.end annotation
|
||
|
.end param
|
||
|
.param p2 # Landroidx/work/impl/WorkManagerImpl;
|
||
|
.annotation build Landroidx/annotation/NonNull;
|
||
|
.end annotation
|
||
|
.end param
|
||
|
|
||
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||
|
|
||
|
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
|
||
|
|
||
|
move-result-object p1
|
||
|
|
||
|
iput-object p1, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mContext:Landroid/content/Context;
|
||
|
|
||
|
iput-object p2, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mWorkManager:Landroidx/work/impl/WorkManagerImpl;
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method static getIntent(Landroid/content/Context;)Landroid/content/Intent;
|
||
|
.locals 3
|
||
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
||
|
.end annotation
|
||
|
|
||
|
new-instance v0, Landroid/content/Intent;
|
||
|
|
||
|
invoke-direct {v0}, Landroid/content/Intent;-><init>()V
|
||
|
|
||
|
new-instance v1, Landroid/content/ComponentName;
|
||
|
|
||
|
const-class v2, Landroidx/work/impl/utils/ForceStopRunnable$BroadcastReceiver;
|
||
|
|
||
|
invoke-direct {v1, p0, v2}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
|
||
|
|
||
|
const-string p0, "ACTION_FORCE_STOP_RESCHEDULE"
|
||
|
|
||
|
invoke-virtual {v0, p0}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method private static getPendingIntent(Landroid/content/Context;I)Landroid/app/PendingIntent;
|
||
|
.locals 2
|
||
|
|
||
|
invoke-static {p0}, Landroidx/work/impl/utils/ForceStopRunnable;->getIntent(Landroid/content/Context;)Landroid/content/Intent;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const/4 v1, -0x1
|
||
|
|
||
|
invoke-static {p0, v1, v0, p1}, Landroid/app/PendingIntent;->getBroadcast(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;
|
||
|
|
||
|
move-result-object p0
|
||
|
|
||
|
return-object p0
|
||
|
.end method
|
||
|
|
||
|
.method static setAlarm(Landroid/content/Context;)V
|
||
|
.locals 6
|
||
|
|
||
|
const-string v0, "alarm"
|
||
|
|
||
|
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Landroid/app/AlarmManager;
|
||
|
|
||
|
const/high16 v1, 0x8000000
|
||
|
|
||
|
invoke-static {p0, v1}, Landroidx/work/impl/utils/ForceStopRunnable;->getPendingIntent(Landroid/content/Context;I)Landroid/app/PendingIntent;
|
||
|
|
||
|
move-result-object p0
|
||
|
|
||
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
||
|
|
||
|
move-result-wide v1
|
||
|
|
||
|
sget-wide v3, Landroidx/work/impl/utils/ForceStopRunnable;->TEN_YEARS:J
|
||
|
|
||
|
add-long/2addr v1, v3
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
sget v3, Landroid/os/Build$VERSION;->SDK_INT:I
|
||
|
|
||
|
const/16 v4, 0x13
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
if-lt v3, v4, :cond_0
|
||
|
|
||
|
invoke-virtual {v0, v5, v1, v2, p0}, Landroid/app/AlarmManager;->setExact(IJLandroid/app/PendingIntent;)V
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:cond_0
|
||
|
invoke-virtual {v0, v5, v1, v2, p0}, Landroid/app/AlarmManager;->set(IJLandroid/app/PendingIntent;)V
|
||
|
|
||
|
:cond_1
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public isForceStopped()Z
|
||
|
.locals 2
|
||
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
||
|
.end annotation
|
||
|
|
||
|
iget-object v0, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mContext:Landroid/content/Context;
|
||
|
|
||
|
const/high16 v1, 0x20000000
|
||
|
|
||
|
invoke-static {v0, v1}, Landroidx/work/impl/utils/ForceStopRunnable;->getPendingIntent(Landroid/content/Context;I)Landroid/app/PendingIntent;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
iget-object v0, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mContext:Landroid/content/Context;
|
||
|
|
||
|
invoke-static {v0}, Landroidx/work/impl/utils/ForceStopRunnable;->setAlarm(Landroid/content/Context;)V
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
return v0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public run()V
|
||
|
.locals 4
|
||
|
|
||
|
invoke-virtual {p0}, Landroidx/work/impl/utils/ForceStopRunnable;->shouldRescheduleWorkers()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
const-string v0, "ForceStopRunnable"
|
||
|
|
||
|
const-string v2, "Rescheduling Workers."
|
||
|
|
||
|
new-array v3, v1, [Ljava/lang/Throwable;
|
||
|
|
||
|
invoke-static {v0, v2, v3}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
||
|
|
||
|
iget-object v0, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mWorkManager:Landroidx/work/impl/WorkManagerImpl;
|
||
|
|
||
|
invoke-virtual {v0}, Landroidx/work/impl/WorkManagerImpl;->rescheduleEligibleWork()V
|
||
|
|
||
|
iget-object v0, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mWorkManager:Landroidx/work/impl/WorkManagerImpl;
|
||
|
|
||
|
invoke-virtual {v0}, Landroidx/work/impl/WorkManagerImpl;->getPreferences()Landroidx/work/impl/utils/Preferences;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroidx/work/impl/utils/Preferences;->setNeedsReschedule(Z)V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
invoke-virtual {p0}, Landroidx/work/impl/utils/ForceStopRunnable;->isForceStopped()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
const-string v0, "ForceStopRunnable"
|
||
|
|
||
|
const-string v2, "Application was force-stopped, rescheduling."
|
||
|
|
||
|
new-array v1, v1, [Ljava/lang/Throwable;
|
||
|
|
||
|
invoke-static {v0, v2, v1}, Landroidx/work/Logger;->debug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
|
||
|
|
||
|
iget-object v0, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mWorkManager:Landroidx/work/impl/WorkManagerImpl;
|
||
|
|
||
|
invoke-virtual {v0}, Landroidx/work/impl/WorkManagerImpl;->rescheduleEligibleWork()V
|
||
|
|
||
|
:cond_1
|
||
|
:goto_0
|
||
|
iget-object v0, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mWorkManager:Landroidx/work/impl/WorkManagerImpl;
|
||
|
|
||
|
invoke-virtual {v0}, Landroidx/work/impl/WorkManagerImpl;->onForceStopRunnableCompleted()V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method shouldRescheduleWorkers()Z
|
||
|
.locals 1
|
||
|
.annotation build Landroidx/annotation/VisibleForTesting;
|
||
|
.end annotation
|
||
|
|
||
|
iget-object v0, p0, Landroidx/work/impl/utils/ForceStopRunnable;->mWorkManager:Landroidx/work/impl/WorkManagerImpl;
|
||
|
|
||
|
invoke-virtual {v0}, Landroidx/work/impl/WorkManagerImpl;->getPreferences()Landroidx/work/impl/utils/Preferences;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroidx/work/impl/utils/Preferences;->needsReschedule()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
.end method
|