2022-06-10 21:38:30 +09:00

676 lines
21 KiB
Smali

.class public Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;
.super Ljava/lang/Object;
.source "ConfigCacheClient.java"
# annotations
.annotation build Landroidx/annotation/AnyThread;
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient$AwaitListener;
}
.end annotation
# static fields
.field private static final DIRECT_EXECUTOR:Ljava/util/concurrent/Executor;
.field public static final DISK_READ_TIMEOUT_IN_SECONDS:J = 0x5L
.field private static final clientInstances:Ljava/util/Map;
.annotation build Landroidx/annotation/GuardedBy;
value = "ConfigCacheClient.class"
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;",
">;"
}
.end annotation
.end field
# instance fields
.field private cachedContainerTask:Lcom/google/android/gms/tasks/Task;
.annotation build Landroidx/annotation/GuardedBy;
value = "this"
.end annotation
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/google/android/gms/tasks/Task<",
"Lcom/google/firebase/remoteconfig/internal/ConfigContainer;",
">;"
}
.end annotation
.end field
.field private final executorService:Ljava/util/concurrent/ExecutorService;
.field private final storageClient:Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;
# direct methods
.method public static constructor <clinit>()V
.locals 1
.line 1
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
sput-object v0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->clientInstances:Ljava/util/Map;
.line 2
sget-object v0, Lcom/google/firebase/remoteconfig/internal/d;->a:Lcom/google/firebase/remoteconfig/internal/d;
sput-object v0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->DIRECT_EXECUTOR:Ljava/util/concurrent/Executor;
return-void
.end method
.method private constructor <init>(Ljava/util/concurrent/ExecutorService;Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;)V
.locals 0
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
iput-object p1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->executorService:Ljava/util/concurrent/ExecutorService;
.line 3
iput-object p2, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->storageClient:Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;
const/4 p1, 0x0
.line 4
iput-object p1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
return-void
.end method
.method public static synthetic a(Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)Ljava/lang/Void;
.locals 0
invoke-direct {p0, p1}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->lambda$put$0(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)Ljava/lang/Void;
move-result-object p0
return-object p0
.end method
.method private static await(Lcom/google/android/gms/tasks/Task;JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"<TResult:",
"Ljava/lang/Object;",
">(",
"Lcom/google/android/gms/tasks/Task<",
"TTResult;>;J",
"Ljava/util/concurrent/TimeUnit;",
")TTResult;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/util/concurrent/ExecutionException;,
Ljava/lang/InterruptedException;,
Ljava/util/concurrent/TimeoutException;
}
.end annotation
.line 1
new-instance v0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient$AwaitListener;
const/4 v1, 0x0
invoke-direct {v0, v1}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient$AwaitListener;-><init>(Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient$1;)V
.line 2
sget-object v1, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->DIRECT_EXECUTOR:Ljava/util/concurrent/Executor;
invoke-virtual {p0, v1, v0}, Lcom/google/android/gms/tasks/Task;->addOnSuccessListener(Ljava/util/concurrent/Executor;Lcom/google/android/gms/tasks/OnSuccessListener;)Lcom/google/android/gms/tasks/Task;
.line 3
invoke-virtual {p0, v1, v0}, Lcom/google/android/gms/tasks/Task;->addOnFailureListener(Ljava/util/concurrent/Executor;Lcom/google/android/gms/tasks/OnFailureListener;)Lcom/google/android/gms/tasks/Task;
.line 4
invoke-virtual {p0, v1, v0}, Lcom/google/android/gms/tasks/Task;->addOnCanceledListener(Ljava/util/concurrent/Executor;Lcom/google/android/gms/tasks/OnCanceledListener;)Lcom/google/android/gms/tasks/Task;
.line 5
invoke-virtual {v0, p1, p2, p3}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient$AwaitListener;->await(JLjava/util/concurrent/TimeUnit;)Z
move-result p1
if-eqz p1, :cond_1
.line 6
invoke-virtual {p0}, Lcom/google/android/gms/tasks/Task;->isSuccessful()Z
move-result p1
if-eqz p1, :cond_0
.line 7
invoke-virtual {p0}, Lcom/google/android/gms/tasks/Task;->getResult()Ljava/lang/Object;
move-result-object p0
return-object p0
.line 8
:cond_0
new-instance p1, Ljava/util/concurrent/ExecutionException;
invoke-virtual {p0}, Lcom/google/android/gms/tasks/Task;->getException()Ljava/lang/Exception;
move-result-object p0
invoke-direct {p1, p0}, Ljava/util/concurrent/ExecutionException;-><init>(Ljava/lang/Throwable;)V
throw p1
.line 9
:cond_1
new-instance p0, Ljava/util/concurrent/TimeoutException;
const-string p1, "Task await timed out."
invoke-direct {p0, p1}, Ljava/util/concurrent/TimeoutException;-><init>(Ljava/lang/String;)V
throw p0
.end method
.method public static synthetic b(Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;ZLcom/google/firebase/remoteconfig/internal/ConfigContainer;Ljava/lang/Void;)Lcom/google/android/gms/tasks/Task;
.locals 0
invoke-direct {p0, p1, p2, p3}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->lambda$put$1(ZLcom/google/firebase/remoteconfig/internal/ConfigContainer;Ljava/lang/Void;)Lcom/google/android/gms/tasks/Task;
move-result-object p0
return-object p0
.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/ConfigCacheClient;
monitor-enter v0
.line 1
:try_start_0
sget-object v1, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->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(Ljava/util/concurrent/ExecutorService;Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;)Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;
.locals 4
const-class v0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;
monitor-enter v0
.line 1
:try_start_0
invoke-virtual {p1}, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->getFileName()Ljava/lang/String;
move-result-object v1
.line 2
sget-object v2, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->clientInstances:Ljava/util/Map;
invoke-interface {v2, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
move-result v3
if-nez v3, :cond_0
.line 3
new-instance v3, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;
invoke-direct {v3, p0, p1}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;-><init>(Ljava/util/concurrent/ExecutorService;Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;)V
invoke-interface {v2, v1, v3}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 4
:cond_0
invoke-interface {v2, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;
: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
.method private synthetic lambda$put$0(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)Ljava/lang/Void;
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/Exception;
}
.end annotation
.line 1
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->storageClient:Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;
invoke-virtual {v0, p1}, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->write(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)Ljava/lang/Void;
move-result-object p1
return-object p1
.end method
.method private synthetic lambda$put$1(ZLcom/google/firebase/remoteconfig/internal/ConfigContainer;Ljava/lang/Void;)Lcom/google/android/gms/tasks/Task;
.locals 0
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/Exception;
}
.end annotation
if-eqz p1, :cond_0
.line 1
invoke-direct {p0, p2}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->updateInMemoryConfigContainer(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)V
.line 2
:cond_0
invoke-static {p2}, Lcom/google/android/gms/tasks/Tasks;->forResult(Ljava/lang/Object;)Lcom/google/android/gms/tasks/Task;
move-result-object p1
return-object p1
.end method
.method private declared-synchronized updateInMemoryConfigContainer(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)V
.locals 0
monitor-enter p0
.line 1
:try_start_0
invoke-static {p1}, Lcom/google/android/gms/tasks/Tasks;->forResult(Ljava/lang/Object;)Lcom/google/android/gms/tasks/Task;
move-result-object p1
iput-object p1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 2
monitor-exit p0
return-void
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
# virtual methods
.method public clear()V
.locals 1
.line 1
monitor-enter p0
const/4 v0, 0x0
.line 2
:try_start_0
invoke-static {v0}, Lcom/google/android/gms/tasks/Tasks;->forResult(Ljava/lang/Object;)Lcom/google/android/gms/tasks/Task;
move-result-object v0
iput-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
.line 3
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 4
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->storageClient:Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;
invoke-virtual {v0}, Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;->clear()Ljava/lang/Void;
return-void
:catchall_0
move-exception v0
.line 5
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v0
.end method
.method public declared-synchronized get()Lcom/google/android/gms/tasks/Task;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lcom/google/android/gms/tasks/Task<",
"Lcom/google/firebase/remoteconfig/internal/ConfigContainer;",
">;"
}
.end annotation
monitor-enter p0
.line 1
:try_start_0
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
if-eqz v0, :cond_0
.line 2
invoke-virtual {v0}, Lcom/google/android/gms/tasks/Task;->isComplete()Z
move-result v0
if-eqz v0, :cond_1
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
invoke-virtual {v0}, Lcom/google/android/gms/tasks/Task;->isSuccessful()Z
move-result v0
if-nez v0, :cond_1
.line 3
:cond_0
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->executorService:Ljava/util/concurrent/ExecutorService;
iget-object v1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->storageClient:Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;
invoke-static {v1}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;
new-instance v2, Lcom/google/firebase/remoteconfig/internal/c;
invoke-direct {v2, v1}, Lcom/google/firebase/remoteconfig/internal/c;-><init>(Lcom/google/firebase/remoteconfig/internal/ConfigStorageClient;)V
invoke-static {v0, v2}, Lcom/google/android/gms/tasks/Tasks;->call(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Callable;)Lcom/google/android/gms/tasks/Task;
move-result-object v0
iput-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
.line 4
:cond_1
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-object v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public getBlocking()Lcom/google/firebase/remoteconfig/internal/ConfigContainer;
.locals 2
.annotation build Landroidx/annotation/Nullable;
.end annotation
const-wide/16 v0, 0x5
.line 1
invoke-virtual {p0, v0, v1}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->getBlocking(J)Lcom/google/firebase/remoteconfig/internal/ConfigContainer;
move-result-object v0
return-object v0
.end method
.method public getBlocking(J)Lcom/google/firebase/remoteconfig/internal/ConfigContainer;
.locals 2
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.line 2
monitor-enter p0
.line 3
:try_start_0
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
if-eqz v0, :cond_0
invoke-virtual {v0}, Lcom/google/android/gms/tasks/Task;->isSuccessful()Z
move-result v0
if-eqz v0, :cond_0
.line 4
iget-object p1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
invoke-virtual {p1}, Lcom/google/android/gms/tasks/Task;->getResult()Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/google/firebase/remoteconfig/internal/ConfigContainer;
monitor-exit p0
return-object p1
.line 5
:cond_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 6
:try_start_1
invoke-virtual {p0}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->get()Lcom/google/android/gms/tasks/Task;
move-result-object v0
sget-object v1, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
invoke-static {v0, p1, p2, v1}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->await(Lcom/google/android/gms/tasks/Task;JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Lcom/google/firebase/remoteconfig/internal/ConfigContainer;
:try_end_1
.catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_2
.catch Ljava/util/concurrent/ExecutionException; {:try_start_1 .. :try_end_1} :catch_1
.catch Ljava/util/concurrent/TimeoutException; {:try_start_1 .. :try_end_1} :catch_0
return-object p1
:catch_0
move-exception p1
goto :goto_0
:catch_1
move-exception p1
goto :goto_0
:catch_2
move-exception p1
:goto_0
const-string p2, "FirebaseRemoteConfig"
const-string v0, "Reading from storage file failed."
.line 7
invoke-static {p2, v0, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
const/4 p1, 0x0
return-object p1
:catchall_0
move-exception p1
.line 8
:try_start_2
monitor-exit p0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
throw p1
.end method
.method public declared-synchronized getCachedContainerTask()Lcom/google/android/gms/tasks/Task;
.locals 1
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lcom/google/android/gms/tasks/Task<",
"Lcom/google/firebase/remoteconfig/internal/ConfigContainer;",
">;"
}
.end annotation
monitor-enter p0
.line 1
:try_start_0
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->cachedContainerTask:Lcom/google/android/gms/tasks/Task;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-object v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public put(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)Lcom/google/android/gms/tasks/Task;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/google/firebase/remoteconfig/internal/ConfigContainer;",
")",
"Lcom/google/android/gms/tasks/Task<",
"Lcom/google/firebase/remoteconfig/internal/ConfigContainer;",
">;"
}
.end annotation
const/4 v0, 0x1
.line 1
invoke-virtual {p0, p1, v0}, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->put(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;Z)Lcom/google/android/gms/tasks/Task;
move-result-object p1
return-object p1
.end method
.method public put(Lcom/google/firebase/remoteconfig/internal/ConfigContainer;Z)Lcom/google/android/gms/tasks/Task;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/google/firebase/remoteconfig/internal/ConfigContainer;",
"Z)",
"Lcom/google/android/gms/tasks/Task<",
"Lcom/google/firebase/remoteconfig/internal/ConfigContainer;",
">;"
}
.end annotation
.line 2
iget-object v0, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->executorService:Ljava/util/concurrent/ExecutorService;
new-instance v1, Lcom/google/firebase/remoteconfig/internal/b;
invoke-direct {v1, p0, p1}, Lcom/google/firebase/remoteconfig/internal/b;-><init>(Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;Lcom/google/firebase/remoteconfig/internal/ConfigContainer;)V
invoke-static {v0, v1}, Lcom/google/android/gms/tasks/Tasks;->call(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Callable;)Lcom/google/android/gms/tasks/Task;
move-result-object v0
iget-object v1, p0, Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;->executorService:Ljava/util/concurrent/ExecutorService;
new-instance v2, Lcom/google/firebase/remoteconfig/internal/a;
invoke-direct {v2, p0, p2, p1}, Lcom/google/firebase/remoteconfig/internal/a;-><init>(Lcom/google/firebase/remoteconfig/internal/ConfigCacheClient;ZLcom/google/firebase/remoteconfig/internal/ConfigContainer;)V
.line 3
invoke-virtual {v0, v1, v2}, Lcom/google/android/gms/tasks/Task;->onSuccessTask(Ljava/util/concurrent/Executor;Lcom/google/android/gms/tasks/SuccessContinuation;)Lcom/google/android/gms/tasks/Task;
move-result-object p1
return-object p1
.end method