300 lines
9 KiB
Smali
300 lines
9 KiB
Smali
.class public Landroidx/lifecycle/ProcessLifecycleOwner;
|
|
.super Ljava/lang/Object;
|
|
.source "ProcessLifecycleOwner.java"
|
|
|
|
# interfaces
|
|
.implements Landroidx/lifecycle/LifecycleOwner;
|
|
|
|
|
|
# static fields
|
|
.field static final TIMEOUT_MS:J = 0x2bcL
|
|
|
|
.field private static final sInstance:Landroidx/lifecycle/ProcessLifecycleOwner;
|
|
|
|
|
|
# instance fields
|
|
.field private mDelayedPauseRunnable:Ljava/lang/Runnable;
|
|
|
|
.field private mHandler:Landroid/os/Handler;
|
|
|
|
.field mInitializationListener:Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
|
|
|
|
.field private mPauseSent:Z
|
|
|
|
.field private final mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
.field private mResumedCounter:I
|
|
|
|
.field private mStartedCounter:I
|
|
|
|
.field private mStopSent:Z
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Landroidx/lifecycle/ProcessLifecycleOwner;
|
|
|
|
invoke-direct {v0}, Landroidx/lifecycle/ProcessLifecycleOwner;-><init>()V
|
|
|
|
sput-object v0, Landroidx/lifecycle/ProcessLifecycleOwner;->sInstance:Landroidx/lifecycle/ProcessLifecycleOwner;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 1
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStartedCounter:I
|
|
|
|
iput v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
const/4 v0, 0x1
|
|
|
|
iput-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mPauseSent:Z
|
|
|
|
iput-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStopSent:Z
|
|
|
|
new-instance v0, Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
invoke-direct {v0, p0}, Landroidx/lifecycle/LifecycleRegistry;-><init>(Landroidx/lifecycle/LifecycleOwner;)V
|
|
|
|
iput-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
new-instance v0, Landroidx/lifecycle/ProcessLifecycleOwner$1;
|
|
|
|
invoke-direct {v0, p0}, Landroidx/lifecycle/ProcessLifecycleOwner$1;-><init>(Landroidx/lifecycle/ProcessLifecycleOwner;)V
|
|
|
|
iput-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mDelayedPauseRunnable:Ljava/lang/Runnable;
|
|
|
|
new-instance v0, Landroidx/lifecycle/ProcessLifecycleOwner$2;
|
|
|
|
invoke-direct {v0, p0}, Landroidx/lifecycle/ProcessLifecycleOwner$2;-><init>(Landroidx/lifecycle/ProcessLifecycleOwner;)V
|
|
|
|
iput-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mInitializationListener:Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static get()Landroidx/lifecycle/LifecycleOwner;
|
|
.locals 1
|
|
|
|
sget-object v0, Landroidx/lifecycle/ProcessLifecycleOwner;->sInstance:Landroidx/lifecycle/ProcessLifecycleOwner;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method static init(Landroid/content/Context;)V
|
|
.locals 1
|
|
|
|
sget-object v0, Landroidx/lifecycle/ProcessLifecycleOwner;->sInstance:Landroidx/lifecycle/ProcessLifecycleOwner;
|
|
|
|
invoke-virtual {v0, p0}, Landroidx/lifecycle/ProcessLifecycleOwner;->attach(Landroid/content/Context;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method activityPaused()V
|
|
.locals 4
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
add-int/lit8 v0, v0, -0x1
|
|
|
|
iput v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mHandler:Landroid/os/Handler;
|
|
|
|
iget-object v1, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mDelayedPauseRunnable:Ljava/lang/Runnable;
|
|
|
|
const-wide/16 v2, 0x2bc
|
|
|
|
invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method activityResumed()V
|
|
.locals 2
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
add-int/2addr v0, v1
|
|
|
|
iput v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
if-ne v0, v1, :cond_1
|
|
|
|
iget-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mPauseSent:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
sget-object v1, Landroidx/lifecycle/Lifecycle$Event;->ON_RESUME:Landroidx/lifecycle/Lifecycle$Event;
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/lifecycle/LifecycleRegistry;->handleLifecycleEvent(Landroidx/lifecycle/Lifecycle$Event;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mPauseSent:Z
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mHandler:Landroid/os/Handler;
|
|
|
|
iget-object v1, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mDelayedPauseRunnable:Ljava/lang/Runnable;
|
|
|
|
invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method activityStarted()V
|
|
.locals 2
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStartedCounter:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
add-int/2addr v0, v1
|
|
|
|
iput v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStartedCounter:I
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStartedCounter:I
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
iget-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStopSent:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
sget-object v1, Landroidx/lifecycle/Lifecycle$Event;->ON_START:Landroidx/lifecycle/Lifecycle$Event;
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/lifecycle/LifecycleRegistry;->handleLifecycleEvent(Landroidx/lifecycle/Lifecycle$Event;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStopSent:Z
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method activityStopped()V
|
|
.locals 1
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStartedCounter:I
|
|
|
|
add-int/lit8 v0, v0, -0x1
|
|
|
|
iput v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStartedCounter:I
|
|
|
|
invoke-virtual {p0}, Landroidx/lifecycle/ProcessLifecycleOwner;->dispatchStopIfNeeded()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method attach(Landroid/content/Context;)V
|
|
.locals 2
|
|
|
|
new-instance v0, Landroid/os/Handler;
|
|
|
|
invoke-direct {v0}, Landroid/os/Handler;-><init>()V
|
|
|
|
iput-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mHandler:Landroid/os/Handler;
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
sget-object v1, Landroidx/lifecycle/Lifecycle$Event;->ON_CREATE:Landroidx/lifecycle/Lifecycle$Event;
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/lifecycle/LifecycleRegistry;->handleLifecycleEvent(Landroidx/lifecycle/Lifecycle$Event;)V
|
|
|
|
invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Landroid/app/Application;
|
|
|
|
new-instance v0, Landroidx/lifecycle/ProcessLifecycleOwner$3;
|
|
|
|
invoke-direct {v0, p0}, Landroidx/lifecycle/ProcessLifecycleOwner$3;-><init>(Landroidx/lifecycle/ProcessLifecycleOwner;)V
|
|
|
|
invoke-virtual {p1, v0}, Landroid/app/Application;->registerActivityLifecycleCallbacks(Landroid/app/Application$ActivityLifecycleCallbacks;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method dispatchPauseIfNeeded()V
|
|
.locals 2
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mResumedCounter:I
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
iput-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mPauseSent:Z
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
sget-object v1, Landroidx/lifecycle/Lifecycle$Event;->ON_PAUSE:Landroidx/lifecycle/Lifecycle$Event;
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/lifecycle/LifecycleRegistry;->handleLifecycleEvent(Landroidx/lifecycle/Lifecycle$Event;)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method dispatchStopIfNeeded()V
|
|
.locals 2
|
|
|
|
iget v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStartedCounter:I
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
iget-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mPauseSent:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
sget-object v1, Landroidx/lifecycle/Lifecycle$Event;->ON_STOP:Landroidx/lifecycle/Lifecycle$Event;
|
|
|
|
invoke-virtual {v0, v1}, Landroidx/lifecycle/LifecycleRegistry;->handleLifecycleEvent(Landroidx/lifecycle/Lifecycle$Event;)V
|
|
|
|
const/4 v0, 0x1
|
|
|
|
iput-boolean v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mStopSent:Z
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public getLifecycle()Landroidx/lifecycle/Lifecycle;
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Landroidx/lifecycle/ProcessLifecycleOwner;->mRegistry:Landroidx/lifecycle/LifecycleRegistry;
|
|
|
|
return-object v0
|
|
.end method
|