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, 0x0
return-object v0
.end method
.method private static buildCreateFirebaseInstallationRequestBody(Ljava/lang/String;Ljava/lang/String;)Lorg/json/JSONObject;
.locals 2
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;
return-object v0
.end method
.method private static buildGenerateAuthTokenRequestBody()Lorg/json/JSONObject;
.locals 3
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;
return-object v1
.end method
.method private getFingerprintHashForPackage()Ljava/lang/String;
.locals 5
const-string v0, "ContentValues"
const/4 v1, 0x0
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
const/4 v3, 0x0
invoke-static {v2, v3}, Lcom/google/android/gms/common/util/Hex;->bytesToStringUppercase([BZ)Ljava/lang/String;
move-result-object v0
return-object v0
.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
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
return-object 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
const/16 v0, 0x12c
const/4 p0, 0x1
return p0
.end method
.method private static logBadConfigError()V
.locals 2
return-void
.end method
.method private static logFisCommunicationError(Ljava/net/HttpURLConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
.locals 1
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"
invoke-virtual {p1}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;
move-result-object p1
check-cast p1, Ljava/net/HttpURLConnection;
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
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
: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
.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
invoke-virtual {p0}, Ljava/lang/String;->length()I
move-result v0
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
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
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
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_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_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
const/4 v0, 0x0
return-object v0
.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
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_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
new-instance v0, Ljava/util/zip/GZIPOutputStream;
invoke-direct {v0, p0}, Ljava/util/zip/GZIPOutputStream;-><init>(Ljava/io/OutputStream;)V
invoke-virtual {v0, p1}, Ljava/util/zip/GZIPOutputStream;->write([B)V
: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
.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."
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
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
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
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
invoke-direct {p0, v4}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->readCreateResponse(Ljava/net/HttpURLConnection;)Lcom/google/firebase/installations/remote/InstallationResponse;
move-result-object p1
:goto_1
invoke-virtual {v4}, Ljava/net/HttpURLConnection;->disconnect()V
invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
return-object 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
return-void
.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."
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
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
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
invoke-direct {p0, v0}, Lcom/google/firebase/installations/remote/FirebaseInstallationServiceClient;->readGenerateAuthTokenResponse(Ljava/net/HttpURLConnection;)Lcom/google/firebase/installations/remote/TokenResult;
move-result-object p1
:goto_1
invoke-virtual {v0}, Ljava/net/HttpURLConnection;->disconnect()V
invoke-static {}, Landroid/net/TrafficStats;->clearThreadStatsTag()V
return-object p1
.end method