granularity level: instruction

		.class public Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;
.super Ljava/lang/Object;
.source "FirebaseInstallationServiceClient.java"


.field private static final ACCEPT_HEADER_KEY:Ljava/lang/String; = "Accept"
.field private static final API_KEY_HEADER:Ljava/lang/String; = "x-goog-api-key"
.field private static final CACHE_CONTROL_DIRECTIVE:Ljava/lang/String; = "no-cache"
.field private static final CACHE_CONTROL_HEADER_KEY:Ljava/lang/String; = "Cache-Control"
.field private static final CONTENT_ENCODING_HEADER_KEY:Ljava/lang/String; = "Content-Encoding"
.field private static final CONTENT_TYPE_HEADER_KEY:Ljava/lang/String; = "Content-Type"
.field private static final CREATE_REQUEST_RESOURCE_NAME_FORMAT:Ljava/lang/String; = "projects/%s/installations"
.field private static final DELETE_REQUEST_RESOURCE_NAME_FORMAT:Ljava/lang/String; = "projects/%s/installations/%s"
.field private static final EXPIRATION_TIMESTAMP_PATTERN:Ljava/util/regex/Pattern;
.field private static final FIREBASE_INSTALLATIONS_API_DOMAIN:Ljava/lang/String; = "firebaseinstallations.googleapis.com"
.field private static final FIREBASE_INSTALLATIONS_API_VERSION:Ljava/lang/String; = "v1"
.field private static final FIREBASE_INSTALLATIONS_ID_HEARTBEAT_TAG:Ljava/lang/String; = "fire-installations-id"
.field private static final FIREBASE_INSTALLATION_AUTH_VERSION:Ljava/lang/String; = "FIS_v2"
.field private static final FIS_TAG:Ljava/lang/String; = "Firebase-Installations"
.field private static final GENERATE_AUTH_TOKEN_REQUEST_RESOURCE_NAME_FORMAT:Ljava/lang/String; = "projects/%s/installations/%s/authTokens:generate"
.field private static final GZIP_CONTENT_ENCODING:Ljava/lang/String; = "gzip"
.field private static final HEART_BEAT_HEADER:Ljava/lang/String; = "x-firebase-client"
.field private static final JSON_CONTENT_TYPE:Ljava/lang/String; = "application/json"
.field private static final MAX_RETRIES:I = 0x1
.field private static final NETWORK_TIMEOUT_MILLIS:I = 0x2710
.field static final PARSING_EXPIRATION_TIME_ERROR_MESSAGE:Ljava/lang/String; = "Invalid Expiration Timestamp."
.field private static final SDK_VERSION_PREFIX:Ljava/lang/String; = "a:"
.field private static final TRAFFIC_STATS_CREATE_INSTALLATION_TAG:I = 0x8001
.field private static final TRAFFIC_STATS_DELETE_INSTALLATION_TAG:I = 0x8002
.field private static final TRAFFIC_STATS_FIREBASE_INSTALLATIONS_TAG:I = 0x8000
.field private static final TRAFFIC_STATS_GENERATE_AUTH_TOKEN_TAG:I = 0x8003
.field private static final UTF_8:Ljava/nio/charset/Charset;
.field private static final X_ANDROID_CERT_HEADER_KEY:Ljava/lang/String; = "X-Android-Cert"
.field private static final X_ANDROID_IID_MIGRATION_KEY:Ljava/lang/String; = "x-goog-fis-android-iid-migration-auth"
.field private static final X_ANDROID_PACKAGE_HEADER_KEY:Ljava/lang/String; = "X-Android-Package"
.field private final context:Landroid/content/Context;
.field private final heartBeatProvider:Lcom/google/firebase/inject/Provider;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/google/firebase/inject/Provider<",
"Lcom/google/firebase/heartbeatinfo/HeartBeatController;",
">;"
}
.end annotation
.end field
.field private final requestLimiter:Lcom/google/firebase/installations/remote/RequestLimiter;
.field private shouldServerErrorRetry:Z


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

	const-string v0, "[0-9]+s"
	invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
	move-result-object v0
	sput-object v0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->EXPIRATION_TIMESTAMP_PATTERN:Ljava/util/regex/Pattern;
	const-string v0, "UTF-8"
	invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
	move-result-object v0
	sput-object v0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->UTF_8:Ljava/nio/charset/Charset;
	return-void
.end method

.method public constructor <init>(Landroid/content/Context;Lcom/google/firebase/inject/Provider;)V
	.locals 0
	.annotation system Ldalvik/annotation/Signature;
	value = {
	"(",
	"Landroid/content/Context;",
	"Lcom/google/firebase/inject/Provider<",
	"Lcom/google/firebase/heartbeatinfo/HeartBeatController;",
	">;)V"
	}
	.end annotation

	invoke-direct {p0}, Ljava/lang/Object;-><init>()V
	iput-object p1, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->context:Landroid/content/Context;
	iput-object p2, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->heartBeatProvider:Lcom/google/firebase/inject/Provider;
	new-instance p1, Lcom/google/firebase/installations/remote/RequestLimiter;
	invoke-direct {p1}, Lcom/google/firebase/installations/remote/RequestLimiter;-><init>()V
	iput-object p1, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->requestLimiter:Lcom/google/firebase/installations/remote/RequestLimiter;
	return-void
.end method

.method private static availableFirebaseOptions(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
	.locals 2

	const/4 v0, 0x3
	new-array v0, v0, [Ljava/lang/Object;
	const/4 v1, 0x0
	aput-object p1, v0, v1
	const/4 p1, 0x1
	aput-object p2, v0, p1
	invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
	move-result p1
	if-eqz p1, :cond_0
	const-string p0, ""
	goto :goto_0
	:cond_0
	new-instance p1, Ljava/lang/StringBuilder;
	invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
	const-string p2, ", "
	invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {p1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object p0
	:goto_0
	const/4 p1, 0x2
	aput-object p0, v0, p1
	const-string p0, "Firebase options used while communicating with Firebase server APIs: %s, %s%s"
	invoke-static {p0, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
	move-result-object p0
	return-object p0
.end method

.method private static buildCreateFirebaseInstallationRequestBody(Ljava/lang/String;Ljava/lang/String;)Lorg/json/JSONObject;
	.locals 2

	:try_start_0
	new-instance v0, Lorg/json/JSONObject;
	invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V
	const-string v1, "fid"
	invoke-virtual {v0, v1, p0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
	const-string p0, "appId"
	invoke-virtual {v0, p0, p1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
	const-string p0, "authVersion"
	const-string p1, "FIS_v2"
	invoke-virtual {v0, p0, p1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
	const-string p0, "sdkVersion"
	const-string p1, "a:17.1.0"
	invoke-virtual {v0, p0, p1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
	:try_end_0
	.catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
	return-object v0
	:catch_0
	move-exception p0
	new-instance p1, Ljava/lang/IllegalStateException;
	invoke-direct {p1, p0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/Throwable;)V
	throw p1
.end method

.method private static buildGenerateAuthTokenRequestBody()Lorg/json/JSONObject;
	.locals 3

	:try_start_0
	new-instance v0, Lorg/json/JSONObject;
	invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V
	const-string v1, "sdkVersion"
	const-string v2, "a:17.1.0"
	invoke-virtual {v0, v1, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
	new-instance v1, Lorg/json/JSONObject;
	invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V
	const-string v2, "installation"
	invoke-virtual {v1, v2, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
	:try_end_0
	.catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
	return-object v1
	:catch_0
	move-exception v0
	new-instance v1, Ljava/lang/IllegalStateException;
	invoke-direct {v1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/Throwable;)V
	throw v1
.end method

.method private getFingerprintHashForPackage()Ljava/lang/String;
	.locals 5

	const-string v0, "ContentValues"
	const/4 v1, 0x0
	:try_start_0
	iget-object v2, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->context:Landroid/content/Context;
	invoke-virtual {v2}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object v3
	invoke-static {v2, v3}, Lcom/google/android/gms/common/util/AndroidUtilsLight;->getPackageCertificateHashBytes(Landroid/content/Context;Ljava/lang/String;)[B
	move-result-object v2
	if-nez v2, :cond_0
	new-instance v2, Ljava/lang/StringBuilder;
	invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
	const-string v3, "Could not get fingerprint hash for package: "
	invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	iget-object v3, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->context:Landroid/content/Context;
	invoke-virtual {v3}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object v3
	invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object v2
	invoke-static {v0, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
	return-object v1
	:cond_0
	const/4 v3, 0x0
	invoke-static {v2, v3}, Lcom/google/android/gms/common/util/Hex;->bytesToStringUppercase([BZ)Ljava/lang/String;
	move-result-object v0
	:try_end_0
	.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
	return-object v0
	:catch_0
	move-exception v2
	new-instance v3, Ljava/lang/StringBuilder;
	invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
	const-string v4, "No such package: "
	invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	iget-object v4, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->context:Landroid/content/Context;
	invoke-virtual {v4}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object v4
	invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object v3
	invoke-static {v0, v3, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
	return-object v1
.end method

.method private getFullyQualifiedRequestUri(Ljava/lang/String;)Ljava/net/URL;
	.locals 5
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Lcom/google/firebase/installations/FirebaseInstallationsException;
	}
	.end annotation

	:try_start_0
	new-instance v0, Ljava/net/URL;
	const-string v1, "https://%s/%s/%s"
	const/4 v2, 0x3
	new-array v2, v2, [Ljava/lang/Object;
	const/4 v3, 0x0
	const-string v4, "firebaseinstallations.googleapis.com"
	aput-object v4, v2, v3
	const/4 v3, 0x1
	const-string v4, "v1"
	aput-object v4, v2, v3
	const/4 v3, 0x2
	aput-object p1, v2, v3
	invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
	move-result-object p1
	invoke-direct {v0, p1}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
	:try_end_0
	.catch Ljava/net/MalformedURLException; {:try_start_0 .. :try_end_0} :catch_0
	return-object v0
	:catch_0
	move-exception p1
	new-instance v0, Lcom/google/firebase/installations/FirebaseInstallationsException;
	invoke-virtual {p1}, Ljava/net/MalformedURLException;->getMessage()Ljava/lang/String;
	move-result-object p1
	sget-object v1, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->UNAVAILABLE:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {v0, p1, v1}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw v0
.end method

.method private static getJsonBytes(Lorg/json/JSONObject;)[B
	.locals 1
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/io/IOException;
	}
	.end annotation

	invoke-virtual {p0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;
	move-result-object p0
	const-string v0, "UTF-8"
	invoke-virtual {p0, v0}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B
	move-result-object p0
	return-object p0
.end method

.method private static isSuccessfulResponseCode(I)Z
	.locals 1

	const/16 v0, 0xc8
	if-lt p0, v0, :cond_0
	const/16 v0, 0x12c
	if-ge p0, v0, :cond_0
	const/4 p0, 0x1
	goto :goto_0
	:cond_0
	const/4 p0, 0x0
	:goto_0
	return p0
.end method

.method private static logBadConfigError()V
	.locals 2

	const-string v0, "Firebase-Installations"
	const-string v1, "Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase."
	invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
	return-void
.end method

.method private static logFisCommunicationError(Ljava/net/HttpURLConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
	.locals 1

	invoke-static {p0}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->readErrorResponse(Ljava/net/HttpURLConnection;)Ljava/lang/String;
	move-result-object p0
	invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
	move-result v0
	if-nez v0, :cond_0
	const-string v0, "Firebase-Installations"
	invoke-static {v0, p0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
	invoke-static {p1, p2, p3}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->availableFirebaseOptions(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
	move-result-object p0
	invoke-static {v0, p0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
	:cond_0
	return-void
.end method

.method private openHttpURLConnection(Ljava/net/URL;Ljava/lang/String;)Ljava/net/HttpURLConnection;
	.locals 4
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Lcom/google/firebase/installations/FirebaseInstallationsException;
	}
	.end annotation

	const-string v0, "Failed to get heartbeats header"
	const-string v1, "ContentValues"
	:try_start_0
	invoke-virtual {p1}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;
	move-result-object p1
	check-cast p1, Ljava/net/HttpURLConnection;
	:try_end_0
	.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
	const/16 v2, 0x2710
	invoke-virtual {p1, v2}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V
	const/4 v3, 0x0
	invoke-virtual {p1, v3}, Ljava/net/HttpURLConnection;->setUseCaches(Z)V
	invoke-virtual {p1, v2}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V
	const-string v2, "Content-Type"
	const-string v3, "application/json"
	invoke-virtual {p1, v2, v3}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	const-string v2, "Accept"
	invoke-virtual {p1, v2, v3}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	const-string v2, "Content-Encoding"
	const-string v3, "gzip"
	invoke-virtual {p1, v2, v3}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	const-string v2, "Cache-Control"
	const-string v3, "no-cache"
	invoke-virtual {p1, v2, v3}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	iget-object v2, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->context:Landroid/content/Context;
	invoke-virtual {v2}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
	move-result-object v2
	const-string v3, "X-Android-Package"
	invoke-virtual {p1, v3, v2}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	iget-object v2, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->heartBeatProvider:Lcom/google/firebase/inject/Provider;
	invoke-interface {v2}, Lcom/google/firebase/inject/Provider;->get()Ljava/lang/Object;
	move-result-object v2
	check-cast v2, Lcom/google/firebase/heartbeatinfo/HeartBeatController;
	if-eqz v2, :cond_0
	:try_start_1
	const-string v3, "x-firebase-client"
	invoke-interface {v2}, Lcom/google/firebase/heartbeatinfo/HeartBeatController;->getHeartBeatsHeader()Lcom/google/android/gms/tasks/Task;
	move-result-object v2
	invoke-static {v2}, Lcom/google/android/gms/tasks/Tasks;->await(Lcom/google/android/gms/tasks/Task;)Ljava/lang/Object;
	move-result-object v2
	check-cast v2, Ljava/lang/String;
	invoke-virtual {p1, v3, v2}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	:try_end_1
	.catch Ljava/util/concurrent/ExecutionException; {:try_start_1 .. :try_end_1} :catch_1
	.catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_0
	goto :goto_0
	:catch_0
	move-exception v2
	invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
	move-result-object v3
	invoke-virtual {v3}, Ljava/lang/Thread;->interrupt()V
	invoke-static {v1, v0, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
	goto :goto_0
	:catch_1
	move-exception v2
	invoke-static {v1, v0, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
	:goto_0
	:cond_0
	invoke-direct {p0}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->getFingerprintHashForPackage()Ljava/lang/String;
	move-result-object v0
	const-string v1, "X-Android-Cert"
	invoke-virtual {p1, v1, v0}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	const-string v0, "x-goog-api-key"
	invoke-virtual {p1, v0, p2}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	return-object p1
	:catch_2
	new-instance p1, Lcom/google/firebase/installations/FirebaseInstallationsException;
	sget-object p2, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->UNAVAILABLE:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	const-string v0, "Firebase Installations Service is unavailable. Please try again later."
	invoke-direct {p1, v0, p2}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw p1
.end method

.method static parseTokenExpirationTimestamp(Ljava/lang/String;)J
	.locals 2

	sget-object v0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->EXPIRATION_TIMESTAMP_PATTERN:Ljava/util/regex/Pattern;
	invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
	move-result-object v0
	invoke-virtual {v0}, Ljava/util/regex/Matcher;->matches()Z
	move-result v0
	const-string v1, "Invalid Expiration Timestamp."
	invoke-static {v0, v1}, Lcom/google/android/gms/common/internal/Preconditions;->checkArgument(ZLjava/lang/Object;)V
	if-eqz p0, :cond_1
	invoke-virtual {p0}, Ljava/lang/String;->length()I
	move-result v0
	if-nez v0, :cond_0
	goto :goto_0
	:cond_0
	const/4 v0, 0x0
	invoke-virtual {p0}, Ljava/lang/String;->length()I
	move-result v1
	add-int/lit8 v1, v1, -0x1
	invoke-virtual {p0, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;
	move-result-object p0
	invoke-static {p0}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
	move-result-wide v0
	goto :goto_1
	:cond_1
	:goto_0
	const-wide/16 v0, 0x0
	:goto_1
	return-wide v0
.end method

.method private readCreateResponse(Ljava/net/HttpURLConnection;)Lcom/google/firebase/installations/remote/InstallationResponse;
	.locals 5
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/lang/AssertionError;,
	Ljava/io/IOException;
	}
	.end annotation

	invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;
	move-result-object p1
	new-instance v0, Landroid/util/JsonReader;
	new-instance v1, Ljava/io/InputStreamReader;
	sget-object v2, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->UTF_8:Ljava/nio/charset/Charset;
	invoke-direct {v1, p1, v2}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
	invoke-direct {v0, v1}, Landroid/util/JsonReader;-><init>(Ljava/io/Reader;)V
	invoke-static {}, Lcom/google/firebase/installations/remote/TokenResult;->builder()Lcom/google/firebase/installations/remote/TokenResult$Builder;
	move-result-object v1
	invoke-static {}, Lcom/google/firebase/installations/remote/InstallationResponse;->builder()Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	move-result-object v2
	invoke-virtual {v0}, Landroid/util/JsonReader;->beginObject()V
	:goto_0
	invoke-virtual {v0}, Landroid/util/JsonReader;->hasNext()Z
	move-result v3
	if-eqz v3, :cond_7
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextName()Ljava/lang/String;
	move-result-object v3
	const-string v4, "name"
	invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v4
	if-eqz v4, :cond_0
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextString()Ljava/lang/String;
	move-result-object v3
	invoke-virtual {v2, v3}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->setUri(Ljava/lang/String;)Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	goto :goto_0
	:cond_0
	const-string v4, "fid"
	invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v4
	if-eqz v4, :cond_1
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextString()Ljava/lang/String;
	move-result-object v3
	invoke-virtual {v2, v3}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->setFid(Ljava/lang/String;)Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	goto :goto_0
	:cond_1
	const-string v4, "refreshToken"
	invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v4
	if-eqz v4, :cond_2
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextString()Ljava/lang/String;
	move-result-object v3
	invoke-virtual {v2, v3}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->setRefreshToken(Ljava/lang/String;)Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	goto :goto_0
	:cond_2
	const-string v4, "authToken"
	invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v3
	if-eqz v3, :cond_6
	invoke-virtual {v0}, Landroid/util/JsonReader;->beginObject()V
	:goto_1
	invoke-virtual {v0}, Landroid/util/JsonReader;->hasNext()Z
	move-result v3
	if-eqz v3, :cond_5
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextName()Ljava/lang/String;
	move-result-object v3
	const-string v4, "token"
	invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v4
	if-eqz v4, :cond_3
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextString()Ljava/lang/String;
	move-result-object v3
	invoke-virtual {v1, v3}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->setToken(Ljava/lang/String;)Lcom/google/firebase/installations/remote/TokenResult$Builder;
	goto :goto_1
	:cond_3
	const-string v4, "expiresIn"
	invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v3
	if-eqz v3, :cond_4
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextString()Ljava/lang/String;
	move-result-object v3
	invoke-static {v3}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->parseTokenExpirationTimestamp(Ljava/lang/String;)J
	move-result-wide v3
	invoke-virtual {v1, v3, v4}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->setTokenExpirationTimestamp(J)Lcom/google/firebase/installations/remote/TokenResult$Builder;
	goto :goto_1
	:cond_4
	invoke-virtual {v0}, Landroid/util/JsonReader;->skipValue()V
	goto :goto_1
	:cond_5
	invoke-virtual {v1}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->build()Lcom/google/firebase/installations/remote/TokenResult;
	move-result-object v3
	invoke-virtual {v2, v3}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->setAuthToken(Lcom/google/firebase/installations/remote/TokenResult;)Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	invoke-virtual {v0}, Landroid/util/JsonReader;->endObject()V
	goto/16 :goto_0
	:cond_6
	invoke-virtual {v0}, Landroid/util/JsonReader;->skipValue()V
	goto/16 :goto_0
	:cond_7
	invoke-virtual {v0}, Landroid/util/JsonReader;->endObject()V
	invoke-virtual {v0}, Landroid/util/JsonReader;->close()V
	invoke-virtual {p1}, Ljava/io/InputStream;->close()V
	sget-object p1, Lcom/google/firebase/installations/remote/InstallationResponse$ResponseCode;->OK:Lcom/google/firebase/installations/remote/InstallationResponse$ResponseCode;
	invoke-virtual {v2, p1}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->setResponseCode(Lcom/google/firebase/installations/remote/InstallationResponse$ResponseCode;)Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	move-result-object p1
	invoke-virtual {p1}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->build()Lcom/google/firebase/installations/remote/InstallationResponse;
	move-result-object p1
	return-object p1
.end method

.method private static readErrorResponse(Ljava/net/HttpURLConnection;)Ljava/lang/String;
	.locals 7

	invoke-virtual {p0}, Ljava/net/HttpURLConnection;->getErrorStream()Ljava/io/InputStream;
	move-result-object v0
	const/4 v1, 0x0
	if-nez v0, :cond_0
	return-object v1
	:cond_0
	new-instance v2, Ljava/io/BufferedReader;
	new-instance v3, Ljava/io/InputStreamReader;
	sget-object v4, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->UTF_8:Ljava/nio/charset/Charset;
	invoke-direct {v3, v0, v4}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
	invoke-direct {v2, v3}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
	:try_start_0
	new-instance v0, Ljava/lang/StringBuilder;
	invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
	:goto_0
	invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
	move-result-object v3
	if-eqz v3, :cond_1
	invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	const/16 v3, 0xa
	invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
	goto :goto_0
	:cond_1
	const-string v3, "Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]"
	const/4 v4, 0x3
	new-array v4, v4, [Ljava/lang/Object;
	const/4 v5, 0x0
	invoke-virtual {p0}, Ljava/net/HttpURLConnection;->getResponseCode()I
	move-result v6
	invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
	move-result-object v6
	aput-object v6, v4, v5
	const/4 v5, 0x1
	invoke-virtual {p0}, Ljava/net/HttpURLConnection;->getResponseMessage()Ljava/lang/String;
	move-result-object p0
	aput-object p0, v4, v5
	const/4 p0, 0x2
	aput-object v0, v4, p0
	invoke-static {v3, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
	move-result-object p0
	:try_end_0
	.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_2
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	:try_start_1
	invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
	:try_end_1
	.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
	:catch_0
	return-object p0
	:catchall_0
	move-exception p0
	:try_start_2
	invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
	:try_end_2
	.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1
	:catch_1
	throw p0
	:try_start_3
	:catch_2
	invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
	:try_end_3
	.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_3
	:catch_3
	return-object v1
.end method

.method private readGenerateAuthTokenResponse(Ljava/net/HttpURLConnection;)Lcom/google/firebase/installations/remote/TokenResult;
	.locals 4
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/lang/AssertionError;,
	Ljava/io/IOException;
	}
	.end annotation

	invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;
	move-result-object p1
	new-instance v0, Landroid/util/JsonReader;
	new-instance v1, Ljava/io/InputStreamReader;
	sget-object v2, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->UTF_8:Ljava/nio/charset/Charset;
	invoke-direct {v1, p1, v2}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
	invoke-direct {v0, v1}, Landroid/util/JsonReader;-><init>(Ljava/io/Reader;)V
	invoke-static {}, Lcom/google/firebase/installations/remote/TokenResult;->builder()Lcom/google/firebase/installations/remote/TokenResult$Builder;
	move-result-object v1
	invoke-virtual {v0}, Landroid/util/JsonReader;->beginObject()V
	:goto_0
	invoke-virtual {v0}, Landroid/util/JsonReader;->hasNext()Z
	move-result v2
	if-eqz v2, :cond_2
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextName()Ljava/lang/String;
	move-result-object v2
	const-string v3, "token"
	invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v3
	if-eqz v3, :cond_0
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextString()Ljava/lang/String;
	move-result-object v2
	invoke-virtual {v1, v2}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->setToken(Ljava/lang/String;)Lcom/google/firebase/installations/remote/TokenResult$Builder;
	goto :goto_0
	:cond_0
	const-string v3, "expiresIn"
	invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
	move-result v2
	if-eqz v2, :cond_1
	invoke-virtual {v0}, Landroid/util/JsonReader;->nextString()Ljava/lang/String;
	move-result-object v2
	invoke-static {v2}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->parseTokenExpirationTimestamp(Ljava/lang/String;)J
	move-result-wide v2
	invoke-virtual {v1, v2, v3}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->setTokenExpirationTimestamp(J)Lcom/google/firebase/installations/remote/TokenResult$Builder;
	goto :goto_0
	:cond_1
	invoke-virtual {v0}, Landroid/util/JsonReader;->skipValue()V
	goto :goto_0
	:cond_2
	invoke-virtual {v0}, Landroid/util/JsonReader;->endObject()V
	invoke-virtual {v0}, Landroid/util/JsonReader;->close()V
	invoke-virtual {p1}, Ljava/io/InputStream;->close()V
	sget-object p1, Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;->OK:Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;
	invoke-virtual {v1, p1}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->setResponseCode(Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;)Lcom/google/firebase/installations/remote/TokenResult$Builder;
	move-result-object p1
	invoke-virtual {p1}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->build()Lcom/google/firebase/installations/remote/TokenResult;
	move-result-object p1
	return-object p1
.end method

.method private writeFIDCreateRequestBodyToOutputStream(Ljava/net/HttpURLConnection;Ljava/lang/String;Ljava/lang/String;)V
	.locals 0
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/io/IOException;
	}
	.end annotation

	invoke-static {p2, p3}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->buildCreateFirebaseInstallationRequestBody(Ljava/lang/String;Ljava/lang/String;)Lorg/json/JSONObject;
	move-result-object p2
	invoke-static {p2}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->getJsonBytes(Lorg/json/JSONObject;)[B
	move-result-object p2
	invoke-static {p1, p2}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->writeRequestBodyToOutputStream(Ljava/net/URLConnection;[B)V
	return-void
.end method

.method private writeGenerateAuthTokenRequestBodyToOutputStream(Ljava/net/HttpURLConnection;)V
	.locals 1
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/io/IOException;
	}
	.end annotation

	invoke-static {}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->buildGenerateAuthTokenRequestBody()Lorg/json/JSONObject;
	move-result-object v0
	invoke-static {v0}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->getJsonBytes(Lorg/json/JSONObject;)[B
	move-result-object v0
	invoke-static {p1, v0}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->writeRequestBodyToOutputStream(Ljava/net/URLConnection;[B)V
	return-void
.end method

.method private static writeRequestBodyToOutputStream(Ljava/net/URLConnection;[B)V
	.locals 1
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Ljava/io/IOException;
	}
	.end annotation

	invoke-virtual {p0}, Ljava/net/URLConnection;->getOutputStream()Ljava/io/OutputStream;
	move-result-object p0
	if-eqz p0, :cond_0
	new-instance v0, Ljava/util/zip/GZIPOutputStream;
	invoke-direct {v0, p0}, Ljava/util/zip/GZIPOutputStream;-><init>(Ljava/io/OutputStream;)V
	:try_start_0
	invoke-virtual {v0, p1}, Ljava/util/zip/GZIPOutputStream;->write([B)V
	:try_end_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	:try_start_1
	invoke-virtual {v0}, Ljava/util/zip/GZIPOutputStream;->close()V
	invoke-virtual {p0}, Ljava/io/OutputStream;->close()V
	:try_end_1
	.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
	:catch_0
	return-void
	:catchall_0
	move-exception p1
	:try_start_2
	invoke-virtual {v0}, Ljava/util/zip/GZIPOutputStream;->close()V
	invoke-virtual {p0}, Ljava/io/OutputStream;->close()V
	:try_end_2
	.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1
	:catch_1
	throw p1
	:cond_0
	new-instance p0, Ljava/io/IOException;
	const-string p1, "Cannot send request to FIS servers. No OutputStream available."
	invoke-direct {p0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
	throw p0
.end method

.method public createFirebaseInstallation(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/google/firebase/installations/remote/InstallationResponse;
	.locals 8
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Lcom/google/firebase/installations/FirebaseInstallationsException;
	}
	.end annotation

	iget-object v0, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->requestLimiter:Lcom/google/firebase/installations/remote/RequestLimiter;
	invoke-virtual {v0}, Lcom/google/firebase/installations/remote/RequestLimiter;->isRequestAllowed()Z
	move-result v0
	const-string v1, "Firebase Installations Service is unavailable. Please try again later."
	if-eqz v0, :cond_5
	const/4 v0, 0x1
	new-array v2, v0, [Ljava/lang/Object;
	const/4 v3, 0x0
	aput-object p3, v2, v3
	const-string v4, "projects/%s/installations"
	invoke-static {v4, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
	move-result-object v2
	invoke-direct {p0, v2}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->getFullyQualifiedRequestUri(Ljava/lang/String;)Ljava/net/URL;
	move-result-object v2
	:goto_0
	if-gt v3, v0, :cond_4
	const v4, 0x8001
	invoke-static {v4}, Landroid/net/TrafficStats;->setThreadStatsTag(I)V
	invoke-direct {p0, v2, p1}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->openHttpURLConnection(Ljava/net/URL;Ljava/lang/String;)Ljava/net/HttpURLConnection;
	move-result-object v4
	:try_start_0
	const-string v5, "POST"
	invoke-virtual {v4, v5}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V
	invoke-virtual {v4, v0}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V
	if-eqz p5, :cond_0
	const-string v5, "x-goog-fis-android-iid-migration-auth"
	invoke-virtual {v4, v5, p5}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	:cond_0
	invoke-direct {p0, v4, p2, p4}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->writeFIDCreateRequestBodyToOutputStream(Ljava/net/HttpURLConnection;Ljava/lang/String;Ljava/lang/String;)V
	invoke-virtual {v4}, Ljava/net/HttpURLConnection;->getResponseCode()I
	move-result v5
	iget-object v6, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->requestLimiter:Lcom/google/firebase/installations/remote/RequestLimiter;
	invoke-virtual {v6, v5}, Lcom/google/firebase/installations/remote/RequestLimiter;->setNextRequestTime(I)V
	invoke-static {v5}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->isSuccessfulResponseCode(I)Z
	move-result v6
	if-eqz v6, :cond_1
	invoke-direct {p0, v4}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->readCreateResponse(Ljava/net/HttpURLConnection;)Lcom/google/firebase/installations/remote/InstallationResponse;
	move-result-object p1
	:try_end_0
	.catch Ljava/lang/AssertionError; {:try_start_0 .. :try_end_0} :catch_0
	.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	:goto_1
	invoke-virtual {v4}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	return-object p1
	:try_start_1
	:cond_1
	invoke-static {v4, p4, p1, p3}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->logFisCommunicationError(Ljava/net/HttpURLConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
	const/16 v6, 0x1ad
	if-eq v5, v6, :cond_3
	const/16 v6, 0x1f4
	if-lt v5, v6, :cond_2
	const/16 v6, 0x258
	if-ge v5, v6, :cond_2
	goto :goto_2
	:cond_2
	invoke-static {}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->logBadConfigError()V
	invoke-static {}, Lcom/google/firebase/installations/remote/InstallationResponse;->builder()Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	move-result-object v5
	sget-object v6, Lcom/google/firebase/installations/remote/InstallationResponse$ResponseCode;->BAD_CONFIG:Lcom/google/firebase/installations/remote/InstallationResponse$ResponseCode;
	invoke-virtual {v5, v6}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->setResponseCode(Lcom/google/firebase/installations/remote/InstallationResponse$ResponseCode;)Lcom/google/firebase/installations/remote/InstallationResponse$Builder;
	move-result-object v5
	invoke-virtual {v5}, Lcom/google/firebase/installations/remote/InstallationResponse$Builder;->build()Lcom/google/firebase/installations/remote/InstallationResponse;
	move-result-object p1
	goto :goto_1
	:cond_3
	new-instance v5, Lcom/google/firebase/installations/FirebaseInstallationsException;
	const-string v6, "Firebase servers have received too many requests from this client in a short period of time. Please try again later."
	sget-object v7, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->TOO_MANY_REQUESTS:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {v5, v6, v7}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw v5
	:try_end_1
	.catch Ljava/lang/AssertionError; {:try_start_1 .. :try_end_1} :catch_0
	.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
	.catchall {:try_start_1 .. :try_end_1} :catchall_0
	:catchall_0
	move-exception p1
	invoke-virtual {v4}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	throw p1
	:goto_2
	:catch_0
	invoke-virtual {v4}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	add-int/lit8 v3, v3, 0x1
	goto :goto_0
	:cond_4
	new-instance p1, Lcom/google/firebase/installations/FirebaseInstallationsException;
	sget-object p2, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->UNAVAILABLE:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {p1, v1, p2}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw p1
	:cond_5
	new-instance p1, Lcom/google/firebase/installations/FirebaseInstallationsException;
	sget-object p2, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->UNAVAILABLE:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {p1, v1, p2}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw p1
.end method

.method public deleteFirebaseInstallation(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
	.locals 6
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Lcom/google/firebase/installations/FirebaseInstallationsException;
	}
	.end annotation

	const/4 v0, 0x2
	new-array v0, v0, [Ljava/lang/Object;
	const/4 v1, 0x0
	aput-object p3, v0, v1
	const/4 v2, 0x1
	aput-object p2, v0, v2
	const-string p2, "projects/%s/installations/%s"
	invoke-static {p2, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
	move-result-object p2
	invoke-direct {p0, p2}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->getFullyQualifiedRequestUri(Ljava/lang/String;)Ljava/net/URL;
	move-result-object p2
	:goto_0
	if-gt v1, v2, :cond_4
	const v0, 0x8002
	invoke-static {v0}, Landroid/net/TrafficStats;->setThreadStatsTag(I)V
	invoke-direct {p0, p2, p1}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->openHttpURLConnection(Ljava/net/URL;Ljava/lang/String;)Ljava/net/HttpURLConnection;
	move-result-object v0
	:try_start_0
	const-string v3, "DELETE"
	invoke-virtual {v0, v3}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V
	const-string v3, "Authorization"
	new-instance v4, Ljava/lang/StringBuilder;
	invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
	const-string v5, "FIS_v2 "
	invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v4, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object v4
	invoke-virtual {v0, v3, v4}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getResponseCode()I
	move-result v3
	const/16 v4, 0xc8
	if-eq v3, v4, :cond_3
	const/16 v4, 0x191
	if-eq v3, v4, :cond_3
	const/16 v4, 0x194
	if-ne v3, v4, :cond_0
	goto :goto_2
	:cond_0
	const/4 v4, 0x0
	invoke-static {v0, v4, p1, p3}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->logFisCommunicationError(Ljava/net/HttpURLConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
	const/16 v4, 0x1ad
	if-eq v3, v4, :cond_2
	const/16 v4, 0x1f4
	if-lt v3, v4, :cond_1
	const/16 v4, 0x258
	if-ge v3, v4, :cond_1
	goto :goto_1
	:cond_1
	invoke-static {}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->logBadConfigError()V
	new-instance v3, Lcom/google/firebase/installations/FirebaseInstallationsException;
	const-string v4, "Bad config while trying to delete FID"
	sget-object v5, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->BAD_CONFIG:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {v3, v4, v5}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw v3
	:try_end_0
	.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	:goto_1
	:catch_0
	:cond_2
	add-int/lit8 v1, v1, 0x1
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	goto :goto_0
	:goto_2
	:cond_3
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	return-void
	:catchall_0
	move-exception p1
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	throw p1
	:cond_4
	new-instance p1, Lcom/google/firebase/installations/FirebaseInstallationsException;
	sget-object p2, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->UNAVAILABLE:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	const-string p3, "Firebase Installations Service is unavailable. Please try again later."
	invoke-direct {p1, p3, p2}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw p1
.end method

.method public generateAuthToken(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/google/firebase/installations/remote/TokenResult;
	.locals 7
	.annotation system Ldalvik/annotation/Throws;
	value = {
	Lcom/google/firebase/installations/FirebaseInstallationsException;
	}
	.end annotation

	iget-object v0, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->requestLimiter:Lcom/google/firebase/installations/remote/RequestLimiter;
	invoke-virtual {v0}, Lcom/google/firebase/installations/remote/RequestLimiter;->isRequestAllowed()Z
	move-result v0
	const-string v1, "Firebase Installations Service is unavailable. Please try again later."
	if-eqz v0, :cond_6
	const/4 v0, 0x2
	new-array v0, v0, [Ljava/lang/Object;
	const/4 v2, 0x0
	aput-object p3, v0, v2
	const/4 v3, 0x1
	aput-object p2, v0, v3
	const-string p2, "projects/%s/installations/%s/authTokens:generate"
	invoke-static {p2, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
	move-result-object p2
	invoke-direct {p0, p2}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->getFullyQualifiedRequestUri(Ljava/lang/String;)Ljava/net/URL;
	move-result-object p2
	:goto_0
	if-gt v2, v3, :cond_5
	const v0, 0x8003
	invoke-static {v0}, Landroid/net/TrafficStats;->setThreadStatsTag(I)V
	invoke-direct {p0, p2, p1}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->openHttpURLConnection(Ljava/net/URL;Ljava/lang/String;)Ljava/net/HttpURLConnection;
	move-result-object v0
	:try_start_0
	const-string v4, "POST"
	invoke-virtual {v0, v4}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V
	const-string v4, "Authorization"
	new-instance v5, Ljava/lang/StringBuilder;
	invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
	const-string v6, "FIS_v2 "
	invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v5, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
	invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
	move-result-object v5
	invoke-virtual {v0, v4, v5}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
	invoke-virtual {v0, v3}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V
	invoke-direct {p0, v0}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->writeGenerateAuthTokenRequestBodyToOutputStream(Ljava/net/HttpURLConnection;)V
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->getResponseCode()I
	move-result v4
	iget-object v5, p0, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->requestLimiter:Lcom/google/firebase/installations/remote/RequestLimiter;
	invoke-virtual {v5, v4}, Lcom/google/firebase/installations/remote/RequestLimiter;->setNextRequestTime(I)V
	invoke-static {v4}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->isSuccessfulResponseCode(I)Z
	move-result v5
	if-eqz v5, :cond_0
	invoke-direct {p0, v0}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->readGenerateAuthTokenResponse(Ljava/net/HttpURLConnection;)Lcom/google/firebase/installations/remote/TokenResult;
	move-result-object p1
	:try_end_0
	.catch Ljava/lang/AssertionError; {:try_start_0 .. :try_end_0} :catch_0
	.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
	.catchall {:try_start_0 .. :try_end_0} :catchall_0
	:goto_1
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	return-object p1
	:cond_0
	const/4 v5, 0x0
	:try_start_1
	invoke-static {v0, v5, p1, p3}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->logFisCommunicationError(Ljava/net/HttpURLConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
	const/16 v5, 0x191
	if-eq v4, v5, :cond_4
	const/16 v5, 0x194
	if-ne v4, v5, :cond_1
	goto :goto_2
	:cond_1
	const/16 v5, 0x1ad
	if-eq v4, v5, :cond_3
	const/16 v5, 0x1f4
	if-lt v4, v5, :cond_2
	const/16 v5, 0x258
	if-ge v4, v5, :cond_2
	goto :goto_3
	:cond_2
	invoke-static {}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->logBadConfigError()V
	invoke-static {}, Lcom/google/firebase/installations/remote/TokenResult;->builder()Lcom/google/firebase/installations/remote/TokenResult$Builder;
	move-result-object v4
	sget-object v5, Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;->BAD_CONFIG:Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;
	invoke-virtual {v4, v5}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->setResponseCode(Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;)Lcom/google/firebase/installations/remote/TokenResult$Builder;
	move-result-object v4
	invoke-virtual {v4}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->build()Lcom/google/firebase/installations/remote/TokenResult;
	move-result-object p1
	goto :goto_1
	:cond_3
	new-instance v4, Lcom/google/firebase/installations/FirebaseInstallationsException;
	const-string v5, "Firebase servers have received too many requests from this client in a short period of time. Please try again later."
	sget-object v6, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->TOO_MANY_REQUESTS:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {v4, v5, v6}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw v4
	:goto_2
	:cond_4
	invoke-static {}, Lcom/google/firebase/installations/remote/TokenResult;->builder()Lcom/google/firebase/installations/remote/TokenResult$Builder;
	move-result-object v4
	sget-object v5, Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;->AUTH_ERROR:Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;
	invoke-virtual {v4, v5}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->setResponseCode(Lcom/google/firebase/installations/remote/TokenResult$ResponseCode;)Lcom/google/firebase/installations/remote/TokenResult$Builder;
	move-result-object v4
	invoke-virtual {v4}, Lcom/google/firebase/installations/remote/TokenResult$Builder;->build()Lcom/google/firebase/installations/remote/TokenResult;
	move-result-object p1
	:try_end_1
	.catch Ljava/lang/AssertionError; {:try_start_1 .. :try_end_1} :catch_0
	.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
	.catchall {:try_start_1 .. :try_end_1} :catchall_0
	goto :goto_1
	:catchall_0
	move-exception p1
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	throw p1
	:goto_3
	:catch_0
	invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
	invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
	add-int/lit8 v2, v2, 0x1
	goto/16 :goto_0
	:cond_5
	new-instance p1, Lcom/google/firebase/installations/FirebaseInstallationsException;
	sget-object p2, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->UNAVAILABLE:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {p1, v1, p2}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw p1
	:cond_6
	new-instance p1, Lcom/google/firebase/installations/FirebaseInstallationsException;
	sget-object p2, Lcom/google/firebase/installations/FirebaseInstallationsException$Status;->UNAVAILABLE:Lcom/google/firebase/installations/FirebaseInstallationsException$Status;
	invoke-direct {p1, v1, p2}, Lcom/google/firebase/installations/FirebaseInstallationsException;-><init>(Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsException$Status;)V
	throw p1
.end method