granularity level: instruction

		.class public final Lq/d;
.super Ljava/lang/Object;
.source "SourceFile"
.implements Lq/p;


.field public final a:Landroid/content/Context;
.field public final b:Lr/d;
.field public final c:Lq/b;


.method public constructor <init>(Landroid/content/Context;Lr/d;Lq/b;)V
	.locals 0

	invoke-direct {p0}, Ljava/lang/Object;-><init>()V
	iput-object p1, p0, Lq/d;->a:Landroid/content/Context;
	iput-object p2, p0, Lq/d;->b:Lr/d;
	iput-object p3, p0, Lq/d;->c:Lq/b;
	return-void
.end method

.method public final a(Ll/l;IZ)V
	.locals 17

	move-object/from16 v0, p0
	move-object/from16 v1, p1
	move/from16 v2, p2
	new-instance v3, Landroid/content/ComponentName;
	iget-object v4, v0, Lq/d;->a:Landroid/content/Context;
	const-class v5, Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;
	invoke-direct {v3, v4, v5}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
	iget-object v4, v0, Lq/d;->a:Landroid/content/Context;
	const-string v5, "jobscheduler"
	invoke-virtual {v4, v5}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
	move-result-object v4
	check-cast v4, Landroid/app/job/JobScheduler;
	new-instance v5, Ljava/util/zip/Adler32;
	invoke-direct {v5}, Ljava/util/zip/Adler32;-><init>()V
	iget-object v6, v0, Lq/d;->a:Landroid/content/Context;
	invoke-virtual {v6}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object v6
	const-string v7, "UTF-8"
	invoke-static {v7}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
	move-result-object v8
	invoke-virtual {v6, v8}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
	move-result-object v6
	invoke-virtual {v5, v6}, Ljava/util/zip/Adler32;->update([B)V
	iget-object v6, v1, Ll/l;->a:Ljava/lang/String;
	invoke-static {v7}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
	move-result-object v7
	invoke-virtual {v6, v7}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
	move-result-object v6
	invoke-virtual {v5, v6}, Ljava/util/zip/Adler32;->update([B)V
	const/4 v6, 0x4
	invoke-static {v6}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
	move-result-object v7
	iget-object v8, v1, Ll/l;->c:Li/c;
	invoke-static {v8}, Lu/a;->a(Li/c;)I
	move-result v8
	invoke-virtual {v7, v8}, Ljava/nio/ByteBuffer;->putInt(I)Ljava/nio/ByteBuffer;
	move-result-object v7
	invoke-virtual {v7}, Ljava/nio/ByteBuffer;->array()[B
	move-result-object v7
	invoke-virtual {v5, v7}, Ljava/util/zip/Adler32;->update([B)V
	iget-object v7, v1, Ll/l;->b:[B
	if-eqz v7, :cond_0
	invoke-virtual {v5, v7}, Ljava/util/zip/Adler32;->update([B)V
	:cond_0
	invoke-virtual {v5}, Ljava/util/zip/Adler32;->getValue()J
	move-result-wide v7
	long-to-int v5, v7
	const-string v7, "JobInfoScheduler"
	const-string v8, "attemptNumber"
	const/4 v9, 0x1
	const/4 v10, 0x0
	if-nez p3, :cond_3
	invoke-virtual {v4}, Landroid/app/job/JobScheduler;->getAllPendingJobs()Ljava/util/List;
	move-result-object v11
	invoke-interface {v11}, Ljava/util/List;->iterator()Ljava/util/Iterator;
	move-result-object v11
	:cond_1
	invoke-interface {v11}, Ljava/util/Iterator;->hasNext()Z
	move-result v12
	if-eqz v12, :cond_2
	invoke-interface {v11}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v12
	check-cast v12, Landroid/app/job/JobInfo;
	invoke-virtual {v12}, Landroid/app/job/JobInfo;->getExtras()Landroid/os/PersistableBundle;
	move-result-object v13
	invoke-virtual {v13, v8}, Landroid/os/BaseBundle;->getInt(Ljava/lang/String;)I
	move-result v13
	invoke-virtual {v12}, Landroid/app/job/JobInfo;->getId()I
	move-result v12
	if-ne v12, v5, :cond_1
	if-lt v13, v2, :cond_2
	const/4 v11, 0x1
	goto :goto_0
	:cond_2
	const/4 v11, 0x0
	:goto_0
	if-eqz v11, :cond_3
	const-string v2, "Upload for context %s is already scheduled. Returning..."
	invoke-static {v7, v2, v1}, Lf0/a;->f(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
	return-void
	:cond_3
	iget-object v11, v0, Lq/d;->b:Lr/d;
	check-cast v11, Lr/k;
	invoke-virtual {v11}, Lr/k;->a()Landroid/database/sqlite/SQLiteDatabase;
	move-result-object v11
	const/4 v12, 0x2
	new-array v13, v12, [Ljava/lang/String;
	iget-object v14, v1, Ll/l;->a:Ljava/lang/String;
	aput-object v14, v13, v10
	iget-object v14, v1, Ll/l;->c:Li/c;
	invoke-static {v14}, Lu/a;->a(Li/c;)I
	move-result v14
	invoke-static {v14}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
	move-result-object v14
	aput-object v14, v13, v9
	const-string v14, "SELECT next_request_ms FROM transport_contexts WHERE backend_name = ? and priority = ?"
	invoke-virtual {v11, v14, v13}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;
	move-result-object v11
	new-instance v13, Lj/c;
	invoke-direct {v13, v6}, Lj/c;-><init>(I)V
	invoke-static {v11, v13}, Lr/k;->g(Landroid/database/Cursor;Lr/i;)Ljava/lang/Object;
	move-result-object v11
	check-cast v11, Ljava/lang/Long;
	invoke-virtual {v11}, Ljava/lang/Long;->longValue()J
	move-result-wide v13
	iget-object v11, v0, Lq/d;->c:Lq/b;
	new-instance v15, Landroid/app/job/JobInfo$Builder;
	invoke-direct {v15, v5, v3}, Landroid/app/job/JobInfo$Builder;-><init>(ILandroid/content/ComponentName;)V
	iget-object v3, v1, Ll/l;->c:Li/c;
	move-object/from16 v16, v7
	invoke-virtual {v11, v3, v13, v14, v2}, Lq/b;->a(Li/c;JI)J
	move-result-wide v6
	invoke-virtual {v15, v6, v7}, Landroid/app/job/JobInfo$Builder;->setMinimumLatency(J)Landroid/app/job/JobInfo$Builder;
	iget-object v6, v11, Lq/b;->b:Ljava/util/Map;
	invoke-interface {v6, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
	move-result-object v3
	check-cast v3, Lq/c;
	iget-object v3, v3, Lq/c;->c:Ljava/util/Set;
	sget-object v6, Lq/f;->a:Lq/f;
	invoke-interface {v3, v6}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
	move-result v6
	if-eqz v6, :cond_4
	invoke-virtual {v15, v12}, Landroid/app/job/JobInfo$Builder;->setRequiredNetworkType(I)Landroid/app/job/JobInfo$Builder;
	goto :goto_1
	:cond_4
	invoke-virtual {v15, v9}, Landroid/app/job/JobInfo$Builder;->setRequiredNetworkType(I)Landroid/app/job/JobInfo$Builder;
	:goto_1
	sget-object v6, Lq/f;->c:Lq/f;
	invoke-interface {v3, v6}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
	move-result v6
	if-eqz v6, :cond_5
	invoke-virtual {v15, v9}, Landroid/app/job/JobInfo$Builder;->setRequiresCharging(Z)Landroid/app/job/JobInfo$Builder;
	:cond_5
	sget-object v6, Lq/f;->b:Lq/f;
	invoke-interface {v3, v6}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
	move-result v3
	if-eqz v3, :cond_6
	invoke-virtual {v15, v9}, Landroid/app/job/JobInfo$Builder;->setRequiresDeviceIdle(Z)Landroid/app/job/JobInfo$Builder;
	:cond_6
	new-instance v3, Landroid/os/PersistableBundle;
	invoke-direct {v3}, Landroid/os/PersistableBundle;-><init>()V
	invoke-virtual {v3, v8, v2}, Landroid/os/BaseBundle;->putInt(Ljava/lang/String;I)V
	iget-object v6, v1, Ll/l;->a:Ljava/lang/String;
	const-string v7, "backendName"
	invoke-virtual {v3, v7, v6}, Landroid/os/BaseBundle;->putString(Ljava/lang/String;Ljava/lang/String;)V
	iget-object v6, v1, Ll/l;->c:Li/c;
	invoke-static {v6}, Lu/a;->a(Li/c;)I
	move-result v6
	const-string v7, "priority"
	invoke-virtual {v3, v7, v6}, Landroid/os/BaseBundle;->putInt(Ljava/lang/String;I)V
	iget-object v6, v1, Ll/l;->b:[B
	if-eqz v6, :cond_7
	invoke-static {v6, v10}, Landroid/util/Base64;->encodeToString([BI)Ljava/lang/String;
	move-result-object v6
	const-string v7, "extras"
	invoke-virtual {v3, v7, v6}, Landroid/os/BaseBundle;->putString(Ljava/lang/String;Ljava/lang/String;)V
	:cond_7
	invoke-virtual {v15, v3}, Landroid/app/job/JobInfo$Builder;->setExtras(Landroid/os/PersistableBundle;)Landroid/app/job/JobInfo$Builder;
	const/4 v3, 0x5
	new-array v3, v3, [Ljava/lang/Object;
	aput-object v1, v3, v10
	invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
	move-result-object v5
	aput-object v5, v3, v9
	iget-object v5, v0, Lq/d;->c:Lq/b;
	iget-object v1, v1, Ll/l;->c:Li/c;
	invoke-virtual {v5, v1, v13, v14, v2}, Lq/b;->a(Li/c;JI)J
	move-result-wide v5
	invoke-static {v5, v6}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
	move-result-object v1
	aput-object v1, v3, v12
	invoke-static {v13, v14}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
	move-result-object v1
	const/4 v5, 0x3
	aput-object v1, v3, v5
	invoke-static/range {p2 .. p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
	move-result-object v1
	const/4 v2, 0x4
	aput-object v1, v3, v2
	invoke-static/range {v16 .. v16}, Lf0/a;->k(Ljava/lang/String;)Ljava/lang/String;
	move-result-object v1
	invoke-static {v1, v5}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z
	move-result v2
	if-eqz v2, :cond_8
	const-string v2, "Scheduling upload for context %s with jobId=%d in %dms(Backend next call timestamp %d). Attempt %d"
	invoke-static {v2, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
	move-result-object v2
	invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
	:cond_8
	invoke-virtual {v15}, Landroid/app/job/JobInfo$Builder;->build()Landroid/app/job/JobInfo;
	move-result-object v1
	invoke-virtual {v4, v1}, Landroid/app/job/JobScheduler;->schedule(Landroid/app/job/JobInfo;)I
	return-void
.end method