granularity level: instruction

		.class  Lcom/google/firebase/messaging/SyncTask;
.super Ljava/lang/Object;
.source "SyncTask.java"
.implements Ljava/lang/Runnable;

.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/firebase/messaging/SyncTask$ConnectivityChangeReceiver;
}
.end annotation

.field private final firebaseMessaging:Lcom/google/firebase/messaging/FirebaseMessaging;
.field private final nextDelaySeconds:J
.field  processorExecutor:Ljava/util/concurrent/ExecutorService;
.field private final syncWakeLock:Landroid/os/PowerManager$WakeLock;


.method public constructor <init>(Lcom/google/firebase/messaging/FirebaseMessaging;J)V
	.locals 9

	invoke-direct {p0}, Ljava/lang/Object;-><init>()V
	new-instance v8, Ljava/util/concurrent/ThreadPoolExecutor;
	sget-object v5, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
	new-instance v6, Ljava/util/concurrent/LinkedBlockingQueue;
	invoke-direct {v6}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V
	new-instance v7, Lcom/google/android/gms/common/util/concurrent/NamedThreadFactory;
	const-string v0, "firebase-iid-executor"
	invoke-direct {v7, v0}, Lcom/google/android/gms/common/util/concurrent/NamedThreadFactory;-><init>(Ljava/lang/String;)V
	const/4 v1, 0x0
	const/4 v2, 0x1
	const-wide/16 v3, 0x1e
	move-object v0, v8
	invoke-direct/range {v0 .. v7}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V
	iput-object v8, p0, Lcom/google/firebase/messaging/SyncTask;->processorExecutor:Ljava/util/concurrent/ExecutorService;
	iput-object p1, p0, Lcom/google/firebase/messaging/SyncTask;->firebaseMessaging:Lcom/google/firebase/messaging/FirebaseMessaging;
	iput-wide p2, p0, Lcom/google/firebase/messaging/SyncTask;->nextDelaySeconds:J
	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->getContext()Landroid/content/Context;
	move-result-object p1
	const-string p2, "power"
	invoke-virtual {p1, p2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
	move-result-object p1
	check-cast p1, Landroid/os/PowerManager;
	const/4 p2, 0x1
	const-string p3, "fiid-sync"
	invoke-virtual {p1, p2, p3}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;
	move-result-object p1
	iput-object p1, p0, Lcom/google/firebase/messaging/SyncTask;->syncWakeLock:Landroid/os/PowerManager$WakeLock;
	const/4 p2, 0x0
	invoke-virtual {p1, p2}, Landroid/os/PowerManager$WakeLock;->setReferenceCounted(Z)V
	return-void
.end method

.method static synthetic access$000(Lcom/google/firebase/messaging/SyncTask;)Lcom/google/firebase/messaging/FirebaseMessaging;
	.locals 0

	const/4 v0, 0x0
	return-object v0
.end method

.method static isDebugLogEnabled()Z
	.locals 4

	const-string v0, "FirebaseMessaging"
	const/4 v1, 0x3
	invoke-static {v0, v1}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z
	move-result v2
	sget v2, Landroid/os/Build$VERSION;->SDK_INT:I
	const/16 v3, 0x17
	const/4 v0, 0x0
	return v0
.end method

.method  getContext()Landroid/content/Context;
	.locals 1

	iget-object v0, p0, Lcom/google/firebase/messaging/SyncTask;->firebaseMessaging:Lcom/google/firebase/messaging/FirebaseMessaging;
	invoke-virtual {v0}, Lcom/google/firebase/messaging/FirebaseMessaging;->getApplicationContext()Landroid/content/Context;
	move-result-object v0
	return-object v0
.end method

.method  isDeviceConnected()Z
	.locals 2

	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->getContext()Landroid/content/Context;
	move-result-object v0
	const-string v1, "connectivity"
	invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
	move-result-object v0
	check-cast v0, Landroid/net/ConnectivityManager;
	invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
	move-result-object v0
	if-eqz v0, :cond_1
	invoke-virtual {v0}, Landroid/net/NetworkInfo;->isConnected()Z
	move-result v0
	if-eqz v0, :cond_1
	const/4 v0, 0x1
	goto :goto_1
	:cond_1
	const/4 v0, 0x0
	:goto_1
	return v0
.end method

.method  maybeRefreshToken()Z
	.locals 5
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/io/IOException;
	}
	.end annotation

	const-string v0, "FirebaseMessaging"
	const/4 v1, 0x0
	iget-object v2, p0, Lcom/google/firebase/messaging/SyncTask;->firebaseMessaging:Lcom/google/firebase/messaging/FirebaseMessaging;
	invoke-virtual {v2}, Lcom/google/firebase/messaging/FirebaseMessaging;->blockingGetToken()Ljava/lang/String;
	move-result-object v2
	const/4 v2, 0x3
	invoke-static {v0, v2}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z
	move-result v2
	const/4 v0, 0x1
	return v0
.end method

.method public run()V
	.locals 5

	invoke-static {}, Lcom/google/firebase/messaging/ServiceStarter;->getInstance()Lcom/google/firebase/messaging/ServiceStarter;
	move-result-object v0
	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->getContext()Landroid/content/Context;
	move-result-object v1
	invoke-virtual {v0, v1}, Lcom/google/firebase/messaging/ServiceStarter;->hasWakeLockPermission(Landroid/content/Context;)Z
	move-result v0
	if-eqz v0, :cond_0
	iget-object v0, p0, Lcom/google/firebase/messaging/SyncTask;->syncWakeLock:Landroid/os/PowerManager$WakeLock;
	invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->acquire()V
	:cond_0
	const/4 v0, 0x0
	iget-object v1, p0, Lcom/google/firebase/messaging/SyncTask;->firebaseMessaging:Lcom/google/firebase/messaging/FirebaseMessaging;
	const/4 v2, 0x1
	invoke-virtual {v1, v2}, Lcom/google/firebase/messaging/FirebaseMessaging;->setSyncScheduledOrRunning(Z)V
	iget-object v1, p0, Lcom/google/firebase/messaging/SyncTask;->firebaseMessaging:Lcom/google/firebase/messaging/FirebaseMessaging;
	invoke-virtual {v1}, Lcom/google/firebase/messaging/FirebaseMessaging;->isGmsCorePresent()Z
	move-result v1
	invoke-static {}, Lcom/google/firebase/messaging/ServiceStarter;->getInstance()Lcom/google/firebase/messaging/ServiceStarter;
	move-result-object v1
	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->getContext()Landroid/content/Context;
	move-result-object v2
	invoke-virtual {v1, v2}, Lcom/google/firebase/messaging/ServiceStarter;->hasAccessNetworkStatePermission(Landroid/content/Context;)Z
	move-result v1
	if-eqz v1, :cond_4
	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->isDeviceConnected()Z
	move-result v1
	if-nez v1, :cond_4
	new-instance v1, Lcom/google/firebase/messaging/SyncTask$ConnectivityChangeReceiver;
	invoke-direct {v1, p0}, Lcom/google/firebase/messaging/SyncTask$ConnectivityChangeReceiver;-><init>(Lcom/google/firebase/messaging/SyncTask;)V
	invoke-virtual {v1}, Lcom/google/firebase/messaging/SyncTask$ConnectivityChangeReceiver;->registerReceiver()V
	invoke-static {}, Lcom/google/firebase/messaging/ServiceStarter;->getInstance()Lcom/google/firebase/messaging/ServiceStarter;
	move-result-object v0
	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->getContext()Landroid/content/Context;
	move-result-object v1
	invoke-virtual {v0, v1}, Lcom/google/firebase/messaging/ServiceStarter;->hasWakeLockPermission(Landroid/content/Context;)Z
	move-result v0
	if-eqz v0, :cond_3
	iget-object v0, p0, Lcom/google/firebase/messaging/SyncTask;->syncWakeLock:Landroid/os/PowerManager$WakeLock;
	invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V
	:cond_3
	return-void
	:cond_4
	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->maybeRefreshToken()Z
	move-result v1
	iget-object v1, p0, Lcom/google/firebase/messaging/SyncTask;->firebaseMessaging:Lcom/google/firebase/messaging/FirebaseMessaging;
	invoke-virtual {v1, v0}, Lcom/google/firebase/messaging/FirebaseMessaging;->setSyncScheduledOrRunning(Z)V
	invoke-static {}, Lcom/google/firebase/messaging/ServiceStarter;->getInstance()Lcom/google/firebase/messaging/ServiceStarter;
	move-result-object v0
	invoke-virtual {p0}, Lcom/google/firebase/messaging/SyncTask;->getContext()Landroid/content/Context;
	move-result-object v1
	invoke-virtual {v0, v1}, Lcom/google/firebase/messaging/ServiceStarter;->hasWakeLockPermission(Landroid/content/Context;)Z
	move-result v0
	if-eqz v0, :cond_6
	:goto_1
	iget-object v0, p0, Lcom/google/firebase/messaging/SyncTask;->syncWakeLock:Landroid/os/PowerManager$WakeLock;
	invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->release()V
	:cond_6
	return-void
.end method