.class public Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient; .super Ljava/lang/Object; .source "ConfigStorageClient.java" # annotations .annotation build Landroidx/annotation/AnyThread; .end annotation # static fields .field private static final JSON_STRING_ENCODING:Ljava/lang/String; = "UTF-8" .field private static final clientInstances:Ljava/util/Map; .annotation build Landroidx/annotation/GuardedBy; value = "ConfigStorageClient.class" .end annotation .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Map<", "Ljava/lang/String;", "Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;", ">;" } .end annotation .end field # instance fields .field private final context:Landroid/content/Context; .field private final fileName:Ljava/lang/String; # direct methods .method public static constructor ()V .locals 1 .line 1 new-instance v0, Ljava/util/HashMap; invoke-direct {v0}, Ljava/util/HashMap;->()V sput-object v0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->clientInstances:Ljava/util/Map; return-void .end method .method private constructor (Landroid/content/Context;Ljava/lang/String;)V .locals 0 .line 1 invoke-direct {p0}, Ljava/lang/Object;->()V .line 2 iput-object p1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->context:Landroid/content/Context; .line 3 iput-object p2, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->fileName:Ljava/lang/String; return-void .end method .method public static declared-synchronized clearInstancesForTest()V .locals 2 .annotation build Landroidx/annotation/VisibleForTesting; .end annotation const-class v0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient; monitor-enter v0 .line 1 :try_start_0 sget-object v1, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->clientInstances:Ljava/util/Map; invoke-interface {v1}, Ljava/util/Map;->clear()V :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 2 monitor-exit v0 return-void :catchall_0 move-exception v1 monitor-exit v0 throw v1 .end method .method public static declared-synchronized getInstance(Landroid/content/Context;Ljava/lang/String;)Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient; .locals 3 const-class v0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient; monitor-enter v0 .line 1 :try_start_0 sget-object v1, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->clientInstances:Ljava/util/Map; invoke-interface {v1, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z move-result v2 if-nez v2, :cond_0 .line 2 new-instance v2, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient; invoke-direct {v2, p0, p1}, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->(Landroid/content/Context;Ljava/lang/String;)V invoke-interface {v1, p1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 3 :cond_0 invoke-interface {v1, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object p0 check-cast p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient; :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 monitor-exit v0 return-object p0 :catchall_0 move-exception p0 monitor-exit v0 throw p0 .end method # virtual methods .method public declared-synchronized clear()Ljava/lang/Void; .locals 2 monitor-enter p0 .line 1 :try_start_0 iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->context:Landroid/content/Context; iget-object v1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->fileName:Ljava/lang/String; invoke-virtual {v0, v1}, Landroid/content/Context;->deleteFile(Ljava/lang/String;)Z :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 const/4 v0, 0x0 .line 2 monitor-exit p0 return-object v0 :catchall_0 move-exception v0 monitor-exit p0 throw v0 .end method .method public getFileName()Ljava/lang/String; .locals 1 .line 1 iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->fileName:Ljava/lang/String; return-object v0 .end method .method public declared-synchronized read()Lcom/google/firebase/remoteconfig/internal/ConfigContainer; .locals 6 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation .annotation runtime Ljavax/annotation/Nullable; .end annotation monitor-enter p0 const/4 v0, 0x0 .line 1 :try_start_0 iget-object v1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->context:Landroid/content/Context; iget-object v2, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->fileName:Ljava/lang/String; invoke-virtual {v1, v2}, Landroid/content/Context;->openFileInput(Ljava/lang/String;)Ljava/io/FileInputStream; move-result-object v1 :try_end_0 .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0 .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0 .catchall {:try_start_0 .. :try_end_0} :catchall_1 .line 2 :try_start_1 invoke-virtual {v1}, Ljava/io/FileInputStream;->available()I move-result v2 new-array v3, v2, [B const/4 v4, 0x0 .line 3 invoke-virtual {v1, v3, v4, v2}, Ljava/io/FileInputStream;->read([BII)I .line 4 new-instance v2, Ljava/lang/String; const-string v4, "UTF-8" invoke-direct {v2, v3, v4}, Ljava/lang/String;->([BLjava/lang/String;)V .line 5 new-instance v3, Lorg/json/JSONObject; invoke-direct {v3, v2}, Lorg/json/JSONObject;->(Ljava/lang/String;)V .line 6 invoke-static {v3}, Lcom/google/firebase/remoteconfig/internal/ConfigContainer;->copyOf(Lorg/json/JSONObject;)Lcom/google/firebase/remoteconfig/internal/ConfigContainer; move-result-object v0 :try_end_1 .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_1 .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 7 :try_start_2 invoke-virtual {v1}, Ljava/io/FileInputStream;->close()V :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_2 .line 8 monitor-exit p0 return-object v0 :catchall_0 move-exception v0 goto :goto_0 :catchall_1 move-exception v1 move-object v5, v1 move-object v1, v0 move-object v0, v5 :goto_0 if-eqz v1, :cond_0 .line 9 :try_start_3 invoke-virtual {v1}, Ljava/io/FileInputStream;->close()V .line 10 :cond_0 throw v0 :catch_0 move-object v1, v0 :catch_1 if-eqz v1, :cond_1 .line 11 invoke-virtual {v1}, Ljava/io/FileInputStream;->close()V :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_2 goto :goto_1 :catchall_2 move-exception v0 monitor-exit p0 throw v0 .line 12 :cond_1 :goto_1 monitor-exit p0 return-object v0 .end method .method public declared-synchronized write(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)Ljava/lang/Void; .locals 3 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation monitor-enter p0 .line 1 :try_start_0 iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->context:Landroid/content/Context; iget-object v1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->fileName:Ljava/lang/String; const/4 v2, 0x0 invoke-virtual {v0, v1, v2}, Landroid/content/Context;->openFileOutput(Ljava/lang/String;I)Ljava/io/FileOutputStream; move-result-object v0 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_1 .line 2 :try_start_1 invoke-virtual {p1}, Lcom/google/firebase/remoteconfig/internal/ConfigContainer;->toString()Ljava/lang/String; move-result-object p1 const-string v1, "UTF-8" invoke-virtual {p1, v1}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B move-result-object p1 invoke-virtual {v0, p1}, Ljava/io/FileOutputStream;->write([B)V :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 3 :try_start_2 invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_1 const/4 p1, 0x0 .line 4 monitor-exit p0 return-object p1 :catchall_0 move-exception p1 .line 5 :try_start_3 invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V .line 6 throw p1 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_1 :catchall_1 move-exception p1 monitor-exit p0 throw p1 .end method