granularity level: instruction

		.class public Lcom/google/android/datatransport/runtime/TransportRuntime;
.super Ljava/lang/Object;
.source "TransportRuntime.java"
.implements Lcom/google/android/datatransport/runtime/TransportInternal;

.annotation runtime Ljavax/inject/Singleton;
.end annotation

.field private static volatile instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
.field private final eventClock:Lcom/google/android/datatransport/runtime/time/Clock;
.field private final scheduler:Lcom/google/android/datatransport/runtime/scheduling/Scheduler;
.field private final uploader:Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;
.field private final uptimeClock:Lcom/google/android/datatransport/runtime/time/Clock;


.method static constructor <clinit>()V
	.locals 0

	return-void
.end method

.method constructor <init>(Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/scheduling/Scheduler;Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/WorkInitializer;)V
	.locals 0
	.annotation runtime Ljavax/inject/Inject;
	.end annotation

	invoke-direct {p0}, Ljava/lang/Object;-><init>()V
	iput-object p1, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->eventClock:Lcom/google/android/datatransport/runtime/time/Clock;
	iput-object p2, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->uptimeClock:Lcom/google/android/datatransport/runtime/time/Clock;
	iput-object p3, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->scheduler:Lcom/google/android/datatransport/runtime/scheduling/Scheduler;
	iput-object p4, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->uploader:Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;
	invoke-virtual {p5}, Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/WorkInitializer;->ensureContextsScheduled()V
	return-void
.end method

.method private convert(Lcom/google/android/datatransport/runtime/SendRequest;)Lcom/google/android/datatransport/runtime/EventInternal;
	.locals 4

	invoke-static {}, Lcom/google/android/datatransport/runtime/EventInternal;->builder()Lcom/google/android/datatransport/runtime/EventInternal$Builder;
	move-result-object v0
	iget-object v1, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->eventClock:Lcom/google/android/datatransport/runtime/time/Clock;
	invoke-interface {v1}, Lcom/google/android/datatransport/runtime/time/Clock;->getTime()J
	move-result-wide v1
	invoke-virtual {v0, v1, v2}, Lcom/google/android/datatransport/runtime/EventInternal$Builder;->setEventMillis(J)Lcom/google/android/datatransport/runtime/EventInternal$Builder;
	move-result-object v0
	iget-object v1, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->uptimeClock:Lcom/google/android/datatransport/runtime/time/Clock;
	invoke-interface {v1}, Lcom/google/android/datatransport/runtime/time/Clock;->getTime()J
	move-result-wide v1
	invoke-virtual {v0, v1, v2}, Lcom/google/android/datatransport/runtime/EventInternal$Builder;->setUptimeMillis(J)Lcom/google/android/datatransport/runtime/EventInternal$Builder;
	move-result-object v0
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/SendRequest;->getTransportName()Ljava/lang/String;
	move-result-object v1
	invoke-virtual {v0, v1}, Lcom/google/android/datatransport/runtime/EventInternal$Builder;->setTransportName(Ljava/lang/String;)Lcom/google/android/datatransport/runtime/EventInternal$Builder;
	move-result-object v0
	new-instance v1, Lcom/google/android/datatransport/runtime/EncodedPayload;
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/SendRequest;->getEncoding()Lcom/google/android/datatransport/Encoding;
	move-result-object v2
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/SendRequest;->getPayload()[B
	move-result-object v3
	invoke-direct {v1, v2, v3}, Lcom/google/android/datatransport/runtime/EncodedPayload;-><init>(Lcom/google/android/datatransport/Encoding;[B)V
	invoke-virtual {v0, v1}, Lcom/google/android/datatransport/runtime/EventInternal$Builder;->setEncodedPayload(Lcom/google/android/datatransport/runtime/EncodedPayload;)Lcom/google/android/datatransport/runtime/EventInternal$Builder;
	move-result-object v0
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/SendRequest;->getEvent()Lcom/google/android/datatransport/Event;
	move-result-object p1
	invoke-virtual {p1}, Lcom/google/android/datatransport/Event;->getCode()Ljava/lang/Integer;
	move-result-object p1
	invoke-virtual {v0, p1}, Lcom/google/android/datatransport/runtime/EventInternal$Builder;->setCode(Ljava/lang/Integer;)Lcom/google/android/datatransport/runtime/EventInternal$Builder;
	move-result-object p1
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/EventInternal$Builder;->build()Lcom/google/android/datatransport/runtime/EventInternal;
	move-result-object p1
	return-object p1
.end method

.method public static getInstance()Lcom/google/android/datatransport/runtime/TransportRuntime;
	.locals 2

	sget-object v0, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	if-eqz v0, :cond_0
	invoke-virtual {v0}, Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;->getTransportRuntime()Lcom/google/android/datatransport/runtime/TransportRuntime;
	move-result-object v0
	return-object v0
	:cond_0
	new-instance v0, Ljava/lang/IllegalStateException;
	const-string v1, "Not initialized!"
	invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
	throw v0
.end method

.method private static getSupportedEncodings(Lcom/google/android/datatransport/runtime/Destination;)Ljava/util/Set;
	.locals 1
	.annotation system Ldalvik/annotation/Signature;
	value = {
	"(",
	"Lcom/google/android/datatransport/runtime/Destination;",
	")",
	"Ljava/util/Set<",
	"Lcom/google/android/datatransport/Encoding;",
	">;"
	}
	.end annotation

	instance-of v0, p0, Lcom/google/android/datatransport/runtime/EncodedDestination;
	if-eqz v0, :cond_0
	check-cast p0, Lcom/google/android/datatransport/runtime/EncodedDestination;
	invoke-interface {p0}, Lcom/google/android/datatransport/runtime/EncodedDestination;->getSupportedEncodings()Ljava/util/Set;
	move-result-object p0
	invoke-static {p0}, Ljava/util/Collections;->unmodifiableSet(Ljava/util/Set;)Ljava/util/Set;
	move-result-object p0
	return-object p0
	:cond_0
	const-string p0, "proto"
	invoke-static {p0}, Lcom/google/android/datatransport/Encoding;->of(Ljava/lang/String;)Lcom/google/android/datatransport/Encoding;
	move-result-object p0
	invoke-static {p0}, Ljava/util/Collections;->singleton(Ljava/lang/Object;)Ljava/util/Set;
	move-result-object p0
	return-object p0
.end method

.method public static initialize(Landroid/content/Context;)V
	.locals 2

	sget-object v0, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	if-nez v0, :cond_1
	const-class v0, Lcom/google/android/datatransport/runtime/TransportRuntime;
	monitor-enter v0
	:try_start_0
	sget-object v1, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	if-nez v1, :cond_0
	invoke-static {}, Lcom/google/android/datatransport/runtime/DaggerTransportRuntimeComponent;->builder()Lcom/google/android/datatransport/runtime/TransportRuntimeComponent$Builder;
	move-result-object v1
	invoke-interface {v1, p0}, Lcom/google/android/datatransport/runtime/TransportRuntimeComponent$Builder;->setApplicationContext(Landroid/content/Context;)Lcom/google/android/datatransport/runtime/TransportRuntimeComponent$Builder;
	move-result-object p0
	invoke-interface {p0}, Lcom/google/android/datatransport/runtime/TransportRuntimeComponent$Builder;->build()Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	move-result-object p0
	sput-object p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	:cond_0
	monitor-exit v0
	goto :goto_0
	:catchall_0
	move-exception p0
	monitor-exit v0
	:try_end_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	throw p0
	:goto_0
	:cond_1
	return-void
.end method

.method static withInstance(Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;Ljava/util/concurrent/Callable;)V
	.locals 2
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/lang/Throwable;
	}
	.end annotation
	.annotation system Ldalvik/annotation/Signature;
	value = {
	"(",
	"Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;",
	"Ljava/util/concurrent/Callable<",
	"Ljava/lang/Void;",
	">;)V"
	}
	.end annotation

	const-class v0, Lcom/google/android/datatransport/runtime/TransportRuntime;
	monitor-enter v0
	:try_start_0
	sget-object v1, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	sput-object p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	monitor-exit v0
	:try_end_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_3
	:try_start_1
	invoke-interface {p1}, Ljava/util/concurrent/Callable;->call()Ljava/lang/Object;
	:try_end_1
	.catchall {:try_start_1 .. :try_end_1} :catchall_1
	monitor-enter v0
	:try_start_2
	sput-object v1, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	monitor-exit v0
	return-void
	:catchall_0
	move-exception p0
	monitor-exit v0
	:try_end_2
	.catchall {:try_start_2 .. :try_end_2} :catchall_0
	throw p0
	:catchall_1
	move-exception p0
	monitor-enter v0
	:try_start_3
	sput-object v1, Lcom/google/android/datatransport/runtime/TransportRuntime;->instance:Lcom/google/android/datatransport/runtime/TransportRuntimeComponent;
	monitor-exit v0
	:try_end_3
	.catchall {:try_start_3 .. :try_end_3} :catchall_2
	throw p0
	:catchall_2
	move-exception p0
	:try_start_4
	monitor-exit v0
	:try_end_4
	.catchall {:try_start_4 .. :try_end_4} :catchall_2
	throw p0
	:catchall_3
	move-exception p0
	:try_start_5
	monitor-exit v0
	:try_end_5
	.catchall {:try_start_5 .. :try_end_5} :catchall_3
	throw p0
.end method

.method public getUploader()Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;
	.locals 1

	iget-object v0, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->uploader:Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;
	return-object v0
.end method

.method public newFactory(Lcom/google/android/datatransport/runtime/Destination;)Lcom/google/android/datatransport/TransportFactory;
	.locals 4

	new-instance v0, Lcom/google/android/datatransport/runtime/TransportFactoryImpl;
	invoke-static {p1}, Lcom/google/android/datatransport/runtime/TransportRuntime;->getSupportedEncodings(Lcom/google/android/datatransport/runtime/Destination;)Ljava/util/Set;
	move-result-object v1
	invoke-static {}, Lcom/google/android/datatransport/runtime/TransportContext;->builder()Lcom/google/android/datatransport/runtime/TransportContext$Builder;
	move-result-object v2
	invoke-interface {p1}, Lcom/google/android/datatransport/runtime/Destination;->getName()Ljava/lang/String;
	move-result-object v3
	invoke-virtual {v2, v3}, Lcom/google/android/datatransport/runtime/TransportContext$Builder;->setBackendName(Ljava/lang/String;)Lcom/google/android/datatransport/runtime/TransportContext$Builder;
	move-result-object v2
	invoke-interface {p1}, Lcom/google/android/datatransport/runtime/Destination;->getExtras()[B
	move-result-object p1
	invoke-virtual {v2, p1}, Lcom/google/android/datatransport/runtime/TransportContext$Builder;->setExtras([B)Lcom/google/android/datatransport/runtime/TransportContext$Builder;
	move-result-object p1
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/TransportContext$Builder;->build()Lcom/google/android/datatransport/runtime/TransportContext;
	move-result-object p1
	invoke-direct {v0, v1, p1, p0}, Lcom/google/android/datatransport/runtime/TransportFactoryImpl;-><init>(Ljava/util/Set;Lcom/google/android/datatransport/runtime/TransportContext;Lcom/google/android/datatransport/runtime/TransportInternal;)V
	return-object v0
.end method

.method public newFactory(Ljava/lang/String;)Lcom/google/android/datatransport/TransportFactory;
	.locals 3
	.annotation runtime Ljava/lang/Deprecated;
	.end annotation

	new-instance v0, Lcom/google/android/datatransport/runtime/TransportFactoryImpl;
	const/4 v1, 0x0
	invoke-static {v1}, Lcom/google/android/datatransport/runtime/TransportRuntime;->getSupportedEncodings(Lcom/google/android/datatransport/runtime/Destination;)Ljava/util/Set;
	move-result-object v1
	invoke-static {}, Lcom/google/android/datatransport/runtime/TransportContext;->builder()Lcom/google/android/datatransport/runtime/TransportContext$Builder;
	move-result-object v2
	invoke-virtual {v2, p1}, Lcom/google/android/datatransport/runtime/TransportContext$Builder;->setBackendName(Ljava/lang/String;)Lcom/google/android/datatransport/runtime/TransportContext$Builder;
	move-result-object p1
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/TransportContext$Builder;->build()Lcom/google/android/datatransport/runtime/TransportContext;
	move-result-object p1
	invoke-direct {v0, v1, p1, p0}, Lcom/google/android/datatransport/runtime/TransportFactoryImpl;-><init>(Ljava/util/Set;Lcom/google/android/datatransport/runtime/TransportContext;Lcom/google/android/datatransport/runtime/TransportInternal;)V
	return-object v0
.end method

.method public send(Lcom/google/android/datatransport/runtime/SendRequest;Lcom/google/android/datatransport/TransportScheduleCallback;)V
	.locals 3

	iget-object v0, p0, Lcom/google/android/datatransport/runtime/TransportRuntime;->scheduler:Lcom/google/android/datatransport/runtime/scheduling/Scheduler;
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/SendRequest;->getTransportContext()Lcom/google/android/datatransport/runtime/TransportContext;
	move-result-object v1
	invoke-virtual {p1}, Lcom/google/android/datatransport/runtime/SendRequest;->getEvent()Lcom/google/android/datatransport/Event;
	move-result-object v2
	invoke-virtual {v2}, Lcom/google/android/datatransport/Event;->getPriority()Lcom/google/android/datatransport/Priority;
	move-result-object v2
	invoke-virtual {v1, v2}, Lcom/google/android/datatransport/runtime/TransportContext;->withPriority(Lcom/google/android/datatransport/Priority;)Lcom/google/android/datatransport/runtime/TransportContext;
	move-result-object v1
	invoke-direct {p0, p1}, Lcom/google/android/datatransport/runtime/TransportRuntime;->convert(Lcom/google/android/datatransport/runtime/SendRequest;)Lcom/google/android/datatransport/runtime/EventInternal;
	move-result-object p1
	invoke-interface {v0, v1, p1, p2}, Lcom/google/android/datatransport/runtime/scheduling/Scheduler;->schedule(Lcom/google/android/datatransport/runtime/TransportContext;Lcom/google/android/datatransport/runtime/EventInternal;Lcom/google/android/datatransport/TransportScheduleCallback;)V
	return-void
.end method