Primer paso de la investigacion. Se aportan el .apk, las carpetas con el apk extraido y el apk descompilado. El archivo API_DOCUMENTATION.md es un archivo donde se anotaran los descubrimientos del funcionamiento de la API, y los .py son scripts para probar la funcionalidad de la API con los métodos que vayamos encontrando. Finalmente, los archivos .js son scripts de Frida para extraer informacion de la APP durante la ejecucion.

This commit is contained in:
2025-12-04 13:59:54 +01:00
parent f2fd1c3bf5
commit e0133d2ca2
10432 changed files with 1019085 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
package com.google.firebase.remoteconfig.internal;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.SOURCE)
/* loaded from: classes3.dex */
public @interface Code {
public static final int ABORTED = 10;
public static final int ALREADY_EXISTS = 6;
public static final int CANCELLED = 1;
public static final int DATA_LOSS = 15;
public static final int DEADLINE_EXCEEDED = 4;
public static final int FAILED_PRECONDITION = 9;
public static final int INTERNAL = 13;
public static final int INVALID_ARGUMENT = 3;
public static final int NOT_FOUND = 5;
public static final int OK = 0;
public static final int OUT_OF_RANGE = 11;
public static final int PERMISSION_DENIED = 7;
public static final int RESOURCE_EXHAUSTED = 8;
public static final int UNAUTHENTICATED = 16;
public static final int UNAVAILABLE = 14;
public static final int UNIMPLEMENTED = 12;
public static final int UNKNOWN = 2;
}

View File

@@ -0,0 +1,275 @@
package com.google.firebase.remoteconfig.internal;
import android.util.Log;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.remoteconfig.ConfigUpdate;
import com.google.firebase.remoteconfig.ConfigUpdateListener;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException;
import com.google.firebase.remoteconfig.internal.ConfigFetchHandler;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/* loaded from: classes3.dex */
public class ConfigAutoFetch {
private static final int MAXIMUM_FETCH_ATTEMPTS = 3;
private static final String REALTIME_DISABLED_KEY = "featureDisabled";
private static final String TEMPLATE_VERSION_KEY = "latestTemplateVersionNumber";
private final ConfigCacheClient activatedCache;
private final ConfigFetchHandler configFetchHandler;
private final Set<ConfigUpdateListener> eventListeners;
private final HttpURLConnection httpURLConnection;
private final Random random = new Random();
private final ConfigUpdateListener retryCallback;
private final ScheduledExecutorService scheduledExecutorService;
public ConfigAutoFetch(HttpURLConnection httpURLConnection, ConfigFetchHandler configFetchHandler, ConfigCacheClient configCacheClient, Set<ConfigUpdateListener> set, ConfigUpdateListener configUpdateListener, ScheduledExecutorService scheduledExecutorService) {
this.httpURLConnection = httpURLConnection;
this.configFetchHandler = configFetchHandler;
this.activatedCache = configCacheClient;
this.eventListeners = set;
this.retryCallback = configUpdateListener;
this.scheduledExecutorService = scheduledExecutorService;
}
private void autoFetch(final int i, final long j4) {
if (i == 0) {
propagateErrors(new FirebaseRemoteConfigServerException("Unable to fetch the latest version of the template.", FirebaseRemoteConfigException.Code.CONFIG_UPDATE_NOT_FETCHED));
} else {
this.scheduledExecutorService.schedule(new Runnable() { // from class: com.google.firebase.remoteconfig.internal.ConfigAutoFetch.1
@Override // java.lang.Runnable
public void run() {
ConfigAutoFetch.this.fetchLatestConfig(i, j4);
}
}, this.random.nextInt(4), TimeUnit.SECONDS);
}
}
private synchronized void executeAllListenerCallbacks(ConfigUpdate configUpdate) {
Iterator<ConfigUpdateListener> it = this.eventListeners.iterator();
while (it.hasNext()) {
it.next().onUpdate(configUpdate);
}
}
private static Boolean fetchResponseIsUpToDate(ConfigFetchHandler.FetchResponse fetchResponse, long j4) {
if (fetchResponse.getFetchedConfigs() != null) {
return Boolean.valueOf(fetchResponse.getFetchedConfigs().getTemplateVersionNumber() >= j4);
}
return Boolean.valueOf(fetchResponse.getStatus() == 1);
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0030, code lost:
r5 = new org.json.JSONObject(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:12:0x0039, code lost:
if (r5.has(com.google.firebase.remoteconfig.internal.ConfigAutoFetch.REALTIME_DISABLED_KEY) == false) goto L38;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x003f, code lost:
if (r5.getBoolean(com.google.firebase.remoteconfig.internal.ConfigAutoFetch.REALTIME_DISABLED_KEY) == false) goto L39;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0041, code lost:
r9.retryCallback.onError(new com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException("The server is temporarily unavailable. Try again in a few minutes.", com.google.firebase.remoteconfig.FirebaseRemoteConfigException.Code.CONFIG_UPDATE_UNAVAILABLE));
*/
/* JADX WARN: Code restructure failed: missing block: B:24:0x0056, code lost:
if (isEventListenersEmpty() == false) goto L21;
*/
/* JADX WARN: Code restructure failed: missing block: B:26:0x005d, code lost:
if (r5.has(com.google.firebase.remoteconfig.internal.ConfigAutoFetch.TEMPLATE_VERSION_KEY) == false) goto L41;
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x005f, code lost:
r6 = r9.configFetchHandler.getTemplateVersionNumber();
r4 = r5.getLong(com.google.firebase.remoteconfig.internal.ConfigAutoFetch.TEMPLATE_VERSION_KEY);
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x006b, code lost:
if (r4 <= r6) goto L42;
*/
/* JADX WARN: Code restructure failed: missing block: B:31:0x006d, code lost:
autoFetch(3, r4);
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void handleNotifications(java.io.InputStream r10) throws java.io.IOException {
/*
r9 = this;
java.lang.String r0 = "latestTemplateVersionNumber"
java.lang.String r1 = "featureDisabled"
java.io.BufferedReader r2 = new java.io.BufferedReader
java.io.InputStreamReader r3 = new java.io.InputStreamReader
java.lang.String r4 = "utf-8"
r3.<init>(r10, r4)
r2.<init>(r3)
java.lang.String r3 = ""
L12:
r4 = r3
L13:
java.lang.String r5 = r2.readLine()
if (r5 == 0) goto L8a
java.lang.String r4 = C.w.n(r4, r5)
java.lang.String r6 = "}"
boolean r5 = r5.contains(r6)
if (r5 == 0) goto L13
java.lang.String r4 = r9.parseAndValidateConfigUpdateMessage(r4)
boolean r5 = r4.isEmpty()
if (r5 == 0) goto L30
goto L13
L30:
org.json.JSONObject r5 = new org.json.JSONObject // Catch: org.json.JSONException -> L50
r5.<init>(r4) // Catch: org.json.JSONException -> L50
boolean r4 = r5.has(r1) // Catch: org.json.JSONException -> L50
if (r4 == 0) goto L52
boolean r4 = r5.getBoolean(r1) // Catch: org.json.JSONException -> L50
if (r4 == 0) goto L52
com.google.firebase.remoteconfig.ConfigUpdateListener r4 = r9.retryCallback // Catch: org.json.JSONException -> L50
com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException r5 = new com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException // Catch: org.json.JSONException -> L50
java.lang.String r6 = "The server is temporarily unavailable. Try again in a few minutes."
com.google.firebase.remoteconfig.FirebaseRemoteConfigException$Code r7 = com.google.firebase.remoteconfig.FirebaseRemoteConfigException.Code.CONFIG_UPDATE_UNAVAILABLE // Catch: org.json.JSONException -> L50
r5.<init>(r6, r7) // Catch: org.json.JSONException -> L50
r4.onError(r5) // Catch: org.json.JSONException -> L50
goto L8a
L50:
r4 = move-exception
goto L72
L52:
boolean r4 = r9.isEventListenersEmpty() // Catch: org.json.JSONException -> L50
if (r4 == 0) goto L59
goto L8a
L59:
boolean r4 = r5.has(r0) // Catch: org.json.JSONException -> L50
if (r4 == 0) goto L12
com.google.firebase.remoteconfig.internal.ConfigFetchHandler r4 = r9.configFetchHandler // Catch: org.json.JSONException -> L50
long r6 = r4.getTemplateVersionNumber() // Catch: org.json.JSONException -> L50
long r4 = r5.getLong(r0) // Catch: org.json.JSONException -> L50
int r6 = (r4 > r6 ? 1 : (r4 == r6 ? 0 : -1))
if (r6 <= 0) goto L12
r6 = 3
r9.autoFetch(r6, r4) // Catch: org.json.JSONException -> L50
goto L12
L72:
com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException r5 = new com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException
java.lang.Throwable r6 = r4.getCause()
com.google.firebase.remoteconfig.FirebaseRemoteConfigException$Code r7 = com.google.firebase.remoteconfig.FirebaseRemoteConfigException.Code.CONFIG_UPDATE_MESSAGE_INVALID
java.lang.String r8 = "Unable to parse config update message."
r5.<init>(r8, r6, r7)
r9.propagateErrors(r5)
java.lang.String r5 = "FirebaseRemoteConfig"
java.lang.String r6 = "Unable to parse latest config update message."
android.util.Log.e(r5, r6, r4)
goto L12
L8a:
r2.close()
r10.close()
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.remoteconfig.internal.ConfigAutoFetch.handleNotifications(java.io.InputStream):void");
}
private synchronized boolean isEventListenersEmpty() {
return this.eventListeners.isEmpty();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ Task lambda$fetchLatestConfig$0(Task task, Task task2, long j4, int i, Task task3) throws Exception {
if (!task.isSuccessful()) {
return Tasks.forException(new FirebaseRemoteConfigClientException("Failed to auto-fetch config update.", task.getException()));
}
if (!task2.isSuccessful()) {
return Tasks.forException(new FirebaseRemoteConfigClientException("Failed to get activated config for auto-fetch", task2.getException()));
}
ConfigFetchHandler.FetchResponse fetchResponse = (ConfigFetchHandler.FetchResponse) task.getResult();
ConfigContainer configContainer = (ConfigContainer) task2.getResult();
if (!fetchResponseIsUpToDate(fetchResponse, j4).booleanValue()) {
Log.d(FirebaseRemoteConfig.TAG, "Fetched template version is the same as SDK's current version. Retrying fetch.");
autoFetch(i, j4);
return Tasks.forResult(null);
}
if (fetchResponse.getFetchedConfigs() == null) {
Log.d(FirebaseRemoteConfig.TAG, "The fetch succeeded, but the backend had no updates.");
return Tasks.forResult(null);
}
if (configContainer == null) {
configContainer = ConfigContainer.newBuilder().build();
}
Set<String> changedParams = configContainer.getChangedParams(fetchResponse.getFetchedConfigs());
if (changedParams.isEmpty()) {
Log.d(FirebaseRemoteConfig.TAG, "Config was fetched, but no params changed.");
return Tasks.forResult(null);
}
executeAllListenerCallbacks(ConfigUpdate.create(changedParams));
return Tasks.forResult(null);
}
private String parseAndValidateConfigUpdateMessage(String str) {
int indexOf = str.indexOf(123);
int lastIndexOf = str.lastIndexOf(125);
return (indexOf < 0 || lastIndexOf < 0 || indexOf >= lastIndexOf) ? "" : str.substring(indexOf, lastIndexOf + 1);
}
private synchronized void propagateErrors(FirebaseRemoteConfigException firebaseRemoteConfigException) {
Iterator<ConfigUpdateListener> it = this.eventListeners.iterator();
while (it.hasNext()) {
it.next().onError(firebaseRemoteConfigException);
}
}
public synchronized Task<Void> fetchLatestConfig(int i, final long j4) {
final int i4 = i - 1;
try {
try {
final Task<ConfigFetchHandler.FetchResponse> fetchNowWithTypeAndAttemptNumber = this.configFetchHandler.fetchNowWithTypeAndAttemptNumber(ConfigFetchHandler.FetchType.REALTIME, 3 - i4);
final Task<ConfigContainer> task = this.activatedCache.get();
return Tasks.whenAllComplete((Task<?>[]) new Task[]{fetchNowWithTypeAndAttemptNumber, task}).continueWithTask(this.scheduledExecutorService, new Continuation() { // from class: com.google.firebase.remoteconfig.internal.a
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task2) {
Task lambda$fetchLatestConfig$0;
lambda$fetchLatestConfig$0 = ConfigAutoFetch.this.lambda$fetchLatestConfig$0(fetchNowWithTypeAndAttemptNumber, task, j4, i4, task2);
return lambda$fetchLatestConfig$0;
}
});
} catch (Throwable th) {
th = th;
throw th;
}
} catch (Throwable th2) {
th = th2;
throw th;
}
}
public void listenForNotifications() {
HttpURLConnection httpURLConnection = this.httpURLConnection;
if (httpURLConnection == null) {
return;
}
try {
InputStream inputStream = httpURLConnection.getInputStream();
handleNotifications(inputStream);
inputStream.close();
} catch (IOException e4) {
Log.d(FirebaseRemoteConfig.TAG, "Stream was cancelled due to an exception. Retrying the connection...", e4);
} finally {
this.httpURLConnection.disconnect();
}
}
}

View File

@@ -0,0 +1,189 @@
package com.google.firebase.remoteconfig.internal;
import android.util.Log;
import com.google.android.gms.tasks.OnCanceledListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.SuccessContinuation;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import n.ExecutorC0507a;
/* loaded from: classes3.dex */
public class ConfigCacheClient {
static final long DISK_READ_TIMEOUT_IN_SECONDS = 5;
private Task<ConfigContainer> cachedContainerTask = null;
private final Executor executor;
private final ConfigStorageClient storageClient;
private static final Map<String, ConfigCacheClient> clientInstances = new HashMap();
private static final Executor DIRECT_EXECUTOR = new ExecutorC0507a(1);
/* loaded from: classes3.dex */
public static class AwaitListener<TResult> implements OnSuccessListener<TResult>, OnFailureListener, OnCanceledListener {
private final CountDownLatch latch;
private AwaitListener() {
this.latch = new CountDownLatch(1);
}
public void await() throws InterruptedException {
this.latch.await();
}
@Override // com.google.android.gms.tasks.OnCanceledListener
public void onCanceled() {
this.latch.countDown();
}
@Override // com.google.android.gms.tasks.OnFailureListener
public void onFailure(Exception exc) {
this.latch.countDown();
}
@Override // com.google.android.gms.tasks.OnSuccessListener
public void onSuccess(TResult tresult) {
this.latch.countDown();
}
public boolean await(long j4, TimeUnit timeUnit) throws InterruptedException {
return this.latch.await(j4, timeUnit);
}
public /* synthetic */ AwaitListener(AnonymousClass1 anonymousClass1) {
this();
}
}
private ConfigCacheClient(Executor executor, ConfigStorageClient configStorageClient) {
this.executor = executor;
this.storageClient = configStorageClient;
}
private static <TResult> TResult await(Task<TResult> task, long j4, TimeUnit timeUnit) throws ExecutionException, InterruptedException, TimeoutException {
AwaitListener awaitListener = new AwaitListener();
Executor executor = DIRECT_EXECUTOR;
task.addOnSuccessListener(executor, awaitListener);
task.addOnFailureListener(executor, awaitListener);
task.addOnCanceledListener(executor, awaitListener);
if (!awaitListener.await(j4, timeUnit)) {
throw new TimeoutException("Task await timed out.");
}
if (task.isSuccessful()) {
return task.getResult();
}
throw new ExecutionException(task.getException());
}
public static synchronized void clearInstancesForTest() {
synchronized (ConfigCacheClient.class) {
clientInstances.clear();
}
}
public static synchronized ConfigCacheClient getInstance(Executor executor, ConfigStorageClient configStorageClient) {
ConfigCacheClient configCacheClient;
synchronized (ConfigCacheClient.class) {
try {
String fileName = configStorageClient.getFileName();
Map<String, ConfigCacheClient> map = clientInstances;
if (!map.containsKey(fileName)) {
map.put(fileName, new ConfigCacheClient(executor, configStorageClient));
}
configCacheClient = map.get(fileName);
} catch (Throwable th) {
throw th;
}
}
return configCacheClient;
}
public /* synthetic */ Void lambda$put$0(ConfigContainer configContainer) throws Exception {
return this.storageClient.write(configContainer);
}
public /* synthetic */ Task lambda$put$1(boolean z3, ConfigContainer configContainer, Void r32) throws Exception {
if (z3) {
updateInMemoryConfigContainer(configContainer);
}
return Tasks.forResult(configContainer);
}
private synchronized void updateInMemoryConfigContainer(ConfigContainer configContainer) {
this.cachedContainerTask = Tasks.forResult(configContainer);
}
public void clear() {
synchronized (this) {
this.cachedContainerTask = Tasks.forResult(null);
}
this.storageClient.clear();
}
public synchronized Task<ConfigContainer> get() {
try {
Task<ConfigContainer> task = this.cachedContainerTask;
if (task != null) {
if (task.isComplete() && !this.cachedContainerTask.isSuccessful()) {
}
}
Executor executor = this.executor;
ConfigStorageClient configStorageClient = this.storageClient;
Objects.requireNonNull(configStorageClient);
this.cachedContainerTask = Tasks.call(executor, new com.google.firebase.installations.b(configStorageClient, 2));
} catch (Throwable th) {
throw th;
}
return this.cachedContainerTask;
}
public ConfigContainer getBlocking() {
return getBlocking(DISK_READ_TIMEOUT_IN_SECONDS);
}
public synchronized Task<ConfigContainer> getCachedContainerTask() {
return this.cachedContainerTask;
}
public Task<ConfigContainer> put(ConfigContainer configContainer) {
return put(configContainer, true);
}
public ConfigContainer getBlocking(long j4) {
synchronized (this) {
try {
Task<ConfigContainer> task = this.cachedContainerTask;
if (task != null && task.isSuccessful()) {
return this.cachedContainerTask.getResult();
}
try {
return (ConfigContainer) await(get(), j4, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e4) {
Log.d(FirebaseRemoteConfig.TAG, "Reading from storage file failed.", e4);
return null;
}
} catch (Throwable th) {
throw th;
}
}
}
public Task<ConfigContainer> put(final ConfigContainer configContainer, final boolean z3) {
return Tasks.call(this.executor, new com.google.firebase.crashlytics.internal.metadata.a(2, this, configContainer)).onSuccessTask(this.executor, new SuccessContinuation() { // from class: com.google.firebase.remoteconfig.internal.b
@Override // com.google.android.gms.tasks.SuccessContinuation
public final Task then(Object obj) {
Task lambda$put$1;
lambda$put$1 = ConfigCacheClient.this.lambda$put$1(z3, configContainer, (Void) obj);
return lambda$put$1;
}
});
}
}

View File

@@ -0,0 +1,247 @@
package com.google.firebase.remoteconfig.internal;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class ConfigContainer {
static final String ABT_EXPERIMENTS_KEY = "abt_experiments_key";
static final String CONFIGS_KEY = "configs_key";
private static final Date DEFAULTS_FETCH_TIME = new Date(0);
static final String FETCH_TIME_KEY = "fetch_time_key";
static final String PERSONALIZATION_METADATA_KEY = "personalization_metadata_key";
public static final String ROLLOUT_METADATA_AFFECTED_KEYS = "affectedParameterKeys";
public static final String ROLLOUT_METADATA_ID = "rolloutId";
static final String ROLLOUT_METADATA_KEY = "rollout_metadata_key";
public static final String ROLLOUT_METADATA_VARIANT_ID = "variantId";
static final String TEMPLATE_VERSION_NUMBER_KEY = "template_version_number_key";
private JSONArray abtExperiments;
private JSONObject configsJson;
private JSONObject containerJson;
private Date fetchTime;
private JSONObject personalizationMetadata;
private JSONArray rolloutMetadata;
private long templateVersionNumber;
/* loaded from: classes3.dex */
public static class Builder {
private JSONArray builderAbtExperiments;
private JSONObject builderConfigsJson;
private Date builderFetchTime;
private JSONObject builderPersonalizationMetadata;
private JSONArray builderRolloutMetadata;
private long builderTemplateVersionNumber;
public ConfigContainer build() throws JSONException {
return new ConfigContainer(this.builderConfigsJson, this.builderFetchTime, this.builderAbtExperiments, this.builderPersonalizationMetadata, this.builderTemplateVersionNumber, this.builderRolloutMetadata);
}
public Builder replaceConfigsWith(Map<String, String> map) {
this.builderConfigsJson = new JSONObject(map);
return this;
}
public Builder withAbtExperiments(JSONArray jSONArray) {
try {
this.builderAbtExperiments = new JSONArray(jSONArray.toString());
} catch (JSONException unused) {
}
return this;
}
public Builder withFetchTime(Date date) {
this.builderFetchTime = date;
return this;
}
public Builder withPersonalizationMetadata(JSONObject jSONObject) {
try {
this.builderPersonalizationMetadata = new JSONObject(jSONObject.toString());
} catch (JSONException unused) {
}
return this;
}
public Builder withRolloutMetadata(JSONArray jSONArray) {
try {
this.builderRolloutMetadata = new JSONArray(jSONArray.toString());
} catch (JSONException unused) {
}
return this;
}
public Builder withTemplateVersionNumber(long j4) {
this.builderTemplateVersionNumber = j4;
return this;
}
private Builder() {
this.builderConfigsJson = new JSONObject();
this.builderFetchTime = ConfigContainer.DEFAULTS_FETCH_TIME;
this.builderAbtExperiments = new JSONArray();
this.builderPersonalizationMetadata = new JSONObject();
this.builderTemplateVersionNumber = 0L;
this.builderRolloutMetadata = new JSONArray();
}
public Builder replaceConfigsWith(JSONObject jSONObject) {
try {
this.builderConfigsJson = new JSONObject(jSONObject.toString());
} catch (JSONException unused) {
}
return this;
}
public Builder(ConfigContainer configContainer) {
this.builderConfigsJson = configContainer.getConfigs();
this.builderFetchTime = configContainer.getFetchTime();
this.builderAbtExperiments = configContainer.getAbtExperiments();
this.builderPersonalizationMetadata = configContainer.getPersonalizationMetadata();
this.builderTemplateVersionNumber = configContainer.getTemplateVersionNumber();
this.builderRolloutMetadata = configContainer.getRolloutMetadata();
}
}
public static ConfigContainer copyOf(JSONObject jSONObject) throws JSONException {
JSONObject optJSONObject = jSONObject.optJSONObject(PERSONALIZATION_METADATA_KEY);
if (optJSONObject == null) {
optJSONObject = new JSONObject();
}
JSONObject jSONObject2 = optJSONObject;
JSONArray optJSONArray = jSONObject.optJSONArray(ROLLOUT_METADATA_KEY);
if (optJSONArray == null) {
optJSONArray = new JSONArray();
}
return new ConfigContainer(jSONObject.getJSONObject(CONFIGS_KEY), new Date(jSONObject.getLong(FETCH_TIME_KEY)), jSONObject.getJSONArray(ABT_EXPERIMENTS_KEY), jSONObject2, jSONObject.optLong(TEMPLATE_VERSION_NUMBER_KEY), optJSONArray);
}
private Map<String, Map<String, String>> createRolloutParameterKeyMap() throws JSONException {
HashMap hashMap = new HashMap();
for (int i = 0; i < getRolloutMetadata().length(); i++) {
JSONObject jSONObject = getRolloutMetadata().getJSONObject(i);
String string = jSONObject.getString(ROLLOUT_METADATA_ID);
String string2 = jSONObject.getString("variantId");
JSONArray jSONArray = jSONObject.getJSONArray(ROLLOUT_METADATA_AFFECTED_KEYS);
for (int i4 = 0; i4 < jSONArray.length(); i4++) {
String string3 = jSONArray.getString(i4);
if (!hashMap.containsKey(string3)) {
hashMap.put(string3, new HashMap());
}
Map map = (Map) hashMap.get(string3);
if (map != null) {
map.put(string, string2);
}
}
}
return hashMap;
}
private static ConfigContainer deepCopyOf(JSONObject jSONObject) throws JSONException {
return copyOf(new JSONObject(jSONObject.toString()));
}
public static Builder newBuilder() {
return new Builder();
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof ConfigContainer) {
return this.containerJson.toString().equals(((ConfigContainer) obj).toString());
}
return false;
}
public JSONArray getAbtExperiments() {
return this.abtExperiments;
}
public Set<String> getChangedParams(ConfigContainer configContainer) throws JSONException {
JSONObject configs = deepCopyOf(configContainer.containerJson).getConfigs();
Map<String, Map<String, String>> createRolloutParameterKeyMap = createRolloutParameterKeyMap();
Map<String, Map<String, String>> createRolloutParameterKeyMap2 = configContainer.createRolloutParameterKeyMap();
HashSet hashSet = new HashSet();
Iterator<String> keys = getConfigs().keys();
while (keys.hasNext()) {
String next = keys.next();
if (!configContainer.getConfigs().has(next)) {
hashSet.add(next);
} else if (!getConfigs().get(next).equals(configContainer.getConfigs().get(next))) {
hashSet.add(next);
} else if ((getPersonalizationMetadata().has(next) && !configContainer.getPersonalizationMetadata().has(next)) || (!getPersonalizationMetadata().has(next) && configContainer.getPersonalizationMetadata().has(next))) {
hashSet.add(next);
} else if (getPersonalizationMetadata().has(next) && configContainer.getPersonalizationMetadata().has(next) && !getPersonalizationMetadata().getJSONObject(next).toString().equals(configContainer.getPersonalizationMetadata().getJSONObject(next).toString())) {
hashSet.add(next);
} else if (createRolloutParameterKeyMap.containsKey(next) != createRolloutParameterKeyMap2.containsKey(next)) {
hashSet.add(next);
} else if (createRolloutParameterKeyMap.containsKey(next) && createRolloutParameterKeyMap2.containsKey(next) && !createRolloutParameterKeyMap.get(next).equals(createRolloutParameterKeyMap2.get(next))) {
hashSet.add(next);
} else {
configs.remove(next);
}
}
Iterator<String> keys2 = configs.keys();
while (keys2.hasNext()) {
hashSet.add(keys2.next());
}
return hashSet;
}
public JSONObject getConfigs() {
return this.configsJson;
}
public Date getFetchTime() {
return this.fetchTime;
}
public JSONObject getPersonalizationMetadata() {
return this.personalizationMetadata;
}
public JSONArray getRolloutMetadata() {
return this.rolloutMetadata;
}
public long getTemplateVersionNumber() {
return this.templateVersionNumber;
}
public int hashCode() {
return this.containerJson.hashCode();
}
public String toString() {
return this.containerJson.toString();
}
private ConfigContainer(JSONObject jSONObject, Date date, JSONArray jSONArray, JSONObject jSONObject2, long j4, JSONArray jSONArray2) throws JSONException {
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put(CONFIGS_KEY, jSONObject);
jSONObject3.put(FETCH_TIME_KEY, date.getTime());
jSONObject3.put(ABT_EXPERIMENTS_KEY, jSONArray);
jSONObject3.put(PERSONALIZATION_METADATA_KEY, jSONObject2);
jSONObject3.put(TEMPLATE_VERSION_NUMBER_KEY, j4);
jSONObject3.put(ROLLOUT_METADATA_KEY, jSONArray2);
this.configsJson = jSONObject;
this.fetchTime = date;
this.abtExperiments = jSONArray;
this.personalizationMetadata = jSONObject2;
this.templateVersionNumber = j4;
this.rolloutMetadata = jSONArray2;
this.containerJson = jSONObject3;
}
public static Builder newBuilder(ConfigContainer configContainer) {
return new Builder(configContainer);
}
}

View File

@@ -0,0 +1,343 @@
package com.google.firebase.remoteconfig.internal;
import C.w;
import I2.k;
import android.text.format.DateUtils;
import c2.i;
import c2.j;
import com.google.android.gms.common.util.Clock;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.analytics.connector.AnalyticsConnector;
import com.google.firebase.inject.Provider;
import com.google.firebase.installations.FirebaseInstallationsApi;
import com.google.firebase.installations.InstallationTokenResult;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchThrottledException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException;
import com.google.firebase.remoteconfig.internal.ConfigMetadataClient;
import com.google.firebase.sessions.settings.RemoteSettings;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
/* loaded from: classes3.dex */
public class ConfigFetchHandler {
static final String FIRST_OPEN_TIME_KEY = "_fot";
static final int HTTP_TOO_MANY_REQUESTS = 429;
private static final String X_FIREBASE_RC_FETCH_TYPE = "X-Firebase-RC-Fetch-Type";
private final Provider<AnalyticsConnector> analyticsConnector;
private final Clock clock;
private final Map<String, String> customHttpHeaders;
private final Executor executor;
private final ConfigCacheClient fetchedConfigsCache;
private final FirebaseInstallationsApi firebaseInstallations;
private final ConfigFetchHttpClient frcBackendApiClient;
private final ConfigMetadataClient frcMetadata;
private final Random randomGenerator;
public static final long DEFAULT_MINIMUM_FETCH_INTERVAL_IN_SECONDS = TimeUnit.HOURS.toSeconds(12);
static final int[] BACKOFF_TIME_DURATIONS_IN_MINUTES = {2, 4, 8, 16, 32, 64, 128, 256};
/* loaded from: classes3.dex */
public static class FetchResponse {
private final Date fetchTime;
private final ConfigContainer fetchedConfigs;
private final String lastFetchETag;
private final int status;
@Retention(RetentionPolicy.SOURCE)
/* loaded from: classes3.dex */
public @interface Status {
public static final int BACKEND_HAS_NO_UPDATES = 1;
public static final int BACKEND_UPDATES_FETCHED = 0;
public static final int LOCAL_STORAGE_USED = 2;
}
private FetchResponse(Date date, int i, ConfigContainer configContainer, String str) {
this.fetchTime = date;
this.status = i;
this.fetchedConfigs = configContainer;
this.lastFetchETag = str;
}
public static FetchResponse forBackendHasNoUpdates(Date date, ConfigContainer configContainer) {
return new FetchResponse(date, 1, configContainer, null);
}
public static FetchResponse forBackendUpdatesFetched(ConfigContainer configContainer, String str) {
return new FetchResponse(configContainer.getFetchTime(), 0, configContainer, str);
}
public static FetchResponse forLocalStorageUsed(Date date) {
return new FetchResponse(date, 2, null, null);
}
public Date getFetchTime() {
return this.fetchTime;
}
public ConfigContainer getFetchedConfigs() {
return this.fetchedConfigs;
}
public String getLastFetchETag() {
return this.lastFetchETag;
}
public int getStatus() {
return this.status;
}
}
/* loaded from: classes3.dex */
public enum FetchType {
BASE("BASE"),
REALTIME("REALTIME");
private final String value;
FetchType(String str) {
this.value = str;
}
public String getValue() {
return this.value;
}
}
public ConfigFetchHandler(FirebaseInstallationsApi firebaseInstallationsApi, Provider<AnalyticsConnector> provider, Executor executor, Clock clock, Random random, ConfigCacheClient configCacheClient, ConfigFetchHttpClient configFetchHttpClient, ConfigMetadataClient configMetadataClient, Map<String, String> map) {
this.firebaseInstallations = firebaseInstallationsApi;
this.analyticsConnector = provider;
this.executor = executor;
this.clock = clock;
this.randomGenerator = random;
this.fetchedConfigsCache = configCacheClient;
this.frcBackendApiClient = configFetchHttpClient;
this.frcMetadata = configMetadataClient;
this.customHttpHeaders = map;
}
private boolean areCachedFetchConfigsValid(long j4, Date date) {
Date lastSuccessfulFetchTime = this.frcMetadata.getLastSuccessfulFetchTime();
if (lastSuccessfulFetchTime.equals(ConfigMetadataClient.LAST_FETCH_TIME_NO_FETCH_YET)) {
return false;
}
return date.before(new Date(TimeUnit.SECONDS.toMillis(j4) + lastSuccessfulFetchTime.getTime()));
}
private FirebaseRemoteConfigServerException createExceptionWithGenericMessage(FirebaseRemoteConfigServerException firebaseRemoteConfigServerException) throws FirebaseRemoteConfigClientException {
String str;
int httpStatusCode = firebaseRemoteConfigServerException.getHttpStatusCode();
if (httpStatusCode == 401) {
str = "The request did not have the required credentials. Please make sure your google-services.json is valid.";
} else if (httpStatusCode == 403) {
str = "The user is not authorized to access the project. Please make sure you are using the API key that corresponds to your Firebase project.";
} else {
if (httpStatusCode == HTTP_TOO_MANY_REQUESTS) {
throw new FirebaseRemoteConfigClientException("The throttled response from the server was not handled correctly by the FRC SDK.");
}
if (httpStatusCode != 500) {
switch (httpStatusCode) {
case 502:
case 503:
case 504:
str = "The server is unavailable. Please try again later.";
break;
default:
str = "The server returned an unexpected error.";
break;
}
} else {
str = "There was an internal server error.";
}
}
return new FirebaseRemoteConfigServerException(firebaseRemoteConfigServerException.getHttpStatusCode(), "Fetch failed: ".concat(str), firebaseRemoteConfigServerException);
}
private String createThrottledMessage(long j4) {
return w.z("Fetch is throttled. Please wait before calling fetch again: ", DateUtils.formatElapsedTime(TimeUnit.MILLISECONDS.toSeconds(j4)));
}
private FetchResponse fetchFromBackend(String str, String str2, Date date, Map<String, String> map) throws FirebaseRemoteConfigException {
Date date2;
try {
date2 = date;
} catch (FirebaseRemoteConfigServerException e4) {
e = e4;
date2 = date;
}
try {
FetchResponse fetch = this.frcBackendApiClient.fetch(this.frcBackendApiClient.createHttpURLConnection(), str, str2, getUserProperties(), this.frcMetadata.getLastFetchETag(), map, getFirstOpenTime(), date2);
if (fetch.getFetchedConfigs() != null) {
this.frcMetadata.setLastTemplateVersion(fetch.getFetchedConfigs().getTemplateVersionNumber());
}
if (fetch.getLastFetchETag() != null) {
this.frcMetadata.setLastFetchETag(fetch.getLastFetchETag());
}
this.frcMetadata.resetBackoff();
return fetch;
} catch (FirebaseRemoteConfigServerException e5) {
e = e5;
FirebaseRemoteConfigServerException firebaseRemoteConfigServerException = e;
ConfigMetadataClient.BackoffMetadata updateAndReturnBackoffMetadata = updateAndReturnBackoffMetadata(firebaseRemoteConfigServerException.getHttpStatusCode(), date2);
if (shouldThrottle(updateAndReturnBackoffMetadata, firebaseRemoteConfigServerException.getHttpStatusCode())) {
throw new FirebaseRemoteConfigFetchThrottledException(updateAndReturnBackoffMetadata.getBackoffEndTime().getTime());
}
throw createExceptionWithGenericMessage(firebaseRemoteConfigServerException);
}
}
private Task<FetchResponse> fetchFromBackendAndCacheResponse(String str, String str2, Date date, Map<String, String> map) {
try {
FetchResponse fetchFromBackend = fetchFromBackend(str, str2, date, map);
return fetchFromBackend.getStatus() != 0 ? Tasks.forResult(fetchFromBackend) : this.fetchedConfigsCache.put(fetchFromBackend.getFetchedConfigs()).onSuccessTask(this.executor, new k(fetchFromBackend, 20));
} catch (FirebaseRemoteConfigException e4) {
return Tasks.forException(e4);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: fetchIfCacheExpiredAndNotThrottled, reason: merged with bridge method [inline-methods] */
public Task<FetchResponse> lambda$fetch$0(Task<ConfigContainer> task, long j4, final Map<String, String> map) {
final ConfigFetchHandler configFetchHandler;
Task continueWithTask;
final Date date = new Date(this.clock.currentTimeMillis());
if (task.isSuccessful() && areCachedFetchConfigsValid(j4, date)) {
return Tasks.forResult(FetchResponse.forLocalStorageUsed(date));
}
Date backoffEndTimeInMillis = getBackoffEndTimeInMillis(date);
if (backoffEndTimeInMillis != null) {
continueWithTask = Tasks.forException(new FirebaseRemoteConfigFetchThrottledException(createThrottledMessage(backoffEndTimeInMillis.getTime() - date.getTime()), backoffEndTimeInMillis.getTime()));
configFetchHandler = this;
} else {
final Task<String> id = this.firebaseInstallations.getId();
final Task<InstallationTokenResult> token = this.firebaseInstallations.getToken(false);
configFetchHandler = this;
continueWithTask = Tasks.whenAllComplete((Task<?>[]) new Task[]{id, token}).continueWithTask(this.executor, new Continuation() { // from class: com.google.firebase.remoteconfig.internal.c
@Override // com.google.android.gms.tasks.Continuation
public final Object then(Task task2) {
Task lambda$fetchIfCacheExpiredAndNotThrottled$2;
lambda$fetchIfCacheExpiredAndNotThrottled$2 = ConfigFetchHandler.this.lambda$fetchIfCacheExpiredAndNotThrottled$2(id, token, date, map, task2);
return lambda$fetchIfCacheExpiredAndNotThrottled$2;
}
});
}
return continueWithTask.continueWithTask(configFetchHandler.executor, new i(2, configFetchHandler, date));
}
private Date getBackoffEndTimeInMillis(Date date) {
Date backoffEndTime = this.frcMetadata.getBackoffMetadata().getBackoffEndTime();
if (date.before(backoffEndTime)) {
return backoffEndTime;
}
return null;
}
private Long getFirstOpenTime() {
AnalyticsConnector analyticsConnector = this.analyticsConnector.get();
if (analyticsConnector == null) {
return null;
}
return (Long) analyticsConnector.getUserProperties(true).get(FIRST_OPEN_TIME_KEY);
}
private long getRandomizedBackoffDurationInMillis(int i) {
TimeUnit timeUnit = TimeUnit.MINUTES;
int[] iArr = BACKOFF_TIME_DURATIONS_IN_MINUTES;
return (timeUnit.toMillis(iArr[Math.min(i, iArr.length) - 1]) / 2) + this.randomGenerator.nextInt((int) r0);
}
private Map<String, String> getUserProperties() {
HashMap hashMap = new HashMap();
AnalyticsConnector analyticsConnector = this.analyticsConnector.get();
if (analyticsConnector != null) {
for (Map.Entry<String, Object> entry : analyticsConnector.getUserProperties(false).entrySet()) {
hashMap.put(entry.getKey(), entry.getValue().toString());
}
}
return hashMap;
}
private boolean isThrottleableServerError(int i) {
return i == HTTP_TOO_MANY_REQUESTS || i == 502 || i == 503 || i == 504;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ Task lambda$fetchIfCacheExpiredAndNotThrottled$2(Task task, Task task2, Date date, Map map, Task task3) throws Exception {
return !task.isSuccessful() ? Tasks.forException(new FirebaseRemoteConfigClientException("Firebase Installations failed to get installation ID for fetch.", task.getException())) : !task2.isSuccessful() ? Tasks.forException(new FirebaseRemoteConfigClientException("Firebase Installations failed to get installation auth token for fetch.", task2.getException())) : fetchFromBackendAndCacheResponse((String) task.getResult(), ((InstallationTokenResult) task2.getResult()).getToken(), date, map);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ Task lambda$fetchIfCacheExpiredAndNotThrottled$3(Date date, Task task) throws Exception {
updateLastFetchStatusAndTime(task, date);
return task;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ Task lambda$fetchNowWithTypeAndAttemptNumber$1(Map map, Task task) throws Exception {
return lambda$fetch$0(task, 0L, map);
}
private boolean shouldThrottle(ConfigMetadataClient.BackoffMetadata backoffMetadata, int i) {
return backoffMetadata.getNumFailedFetches() > 1 || i == HTTP_TOO_MANY_REQUESTS;
}
private ConfigMetadataClient.BackoffMetadata updateAndReturnBackoffMetadata(int i, Date date) {
if (isThrottleableServerError(i)) {
updateBackoffMetadataWithLastFailedFetchTime(date);
}
return this.frcMetadata.getBackoffMetadata();
}
private void updateBackoffMetadataWithLastFailedFetchTime(Date date) {
int numFailedFetches = this.frcMetadata.getBackoffMetadata().getNumFailedFetches() + 1;
this.frcMetadata.setBackoffMetadata(numFailedFetches, new Date(date.getTime() + getRandomizedBackoffDurationInMillis(numFailedFetches)));
}
private void updateLastFetchStatusAndTime(Task<FetchResponse> task, Date date) {
if (task.isSuccessful()) {
this.frcMetadata.updateLastFetchAsSuccessfulAt(date);
return;
}
Exception exception = task.getException();
if (exception == null) {
return;
}
if (exception instanceof FirebaseRemoteConfigFetchThrottledException) {
this.frcMetadata.updateLastFetchAsThrottled();
} else {
this.frcMetadata.updateLastFetchAsFailed();
}
}
public Task<FetchResponse> fetch() {
return fetch(this.frcMetadata.getMinimumFetchIntervalInSeconds());
}
public Task<FetchResponse> fetchNowWithTypeAndAttemptNumber(FetchType fetchType, int i) {
HashMap hashMap = new HashMap(this.customHttpHeaders);
hashMap.put(X_FIREBASE_RC_FETCH_TYPE, fetchType.getValue() + RemoteSettings.FORWARD_SLASH_STRING + i);
return this.fetchedConfigsCache.get().continueWithTask(this.executor, new i(3, this, hashMap));
}
public Provider<AnalyticsConnector> getAnalyticsConnector() {
return this.analyticsConnector;
}
public long getTemplateVersionNumber() {
return this.frcMetadata.getLastTemplateVersion();
}
public Task<FetchResponse> fetch(long j4) {
HashMap hashMap = new HashMap(this.customHttpHeaders);
hashMap.put(X_FIREBASE_RC_FETCH_TYPE, FetchType.BASE.getValue() + "/1");
return this.fetchedConfigsCache.get().continueWithTask(this.executor, new j(this, j4, hashMap));
}
}

View File

@@ -0,0 +1,280 @@
package com.google.firebase.remoteconfig.internal;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
import androidx.annotation.Keep;
import com.google.android.gms.common.util.AndroidUtilsLight;
import com.google.android.gms.common.util.Hex;
import com.google.firebase.remoteconfig.BuildConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException;
import com.google.firebase.remoteconfig.RemoteConfigConstants;
import com.google.firebase.remoteconfig.internal.ConfigContainer;
import com.google.firebase.remoteconfig.internal.ConfigFetchHandler;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class ConfigFetchHttpClient {
private static final String API_KEY_HEADER = "X-Goog-Api-Key";
private static final String ETAG_HEADER = "ETag";
private static final Pattern GMP_APP_ID_PATTERN = Pattern.compile("^[^:]+:([0-9]+):(android|ios|web):([0-9a-f]+)");
private static final String IF_NONE_MATCH_HEADER = "If-None-Match";
private static final String INSTALLATIONS_AUTH_TOKEN_HEADER = "X-Goog-Firebase-Installations-Auth";
private static final String ISO_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
private static final String X_ANDROID_CERT_HEADER = "X-Android-Cert";
private static final String X_ANDROID_PACKAGE_HEADER = "X-Android-Package";
private static final String X_GOOGLE_GFE_CAN_RETRY = "X-Google-GFE-Can-Retry";
private final String apiKey;
private final String appId;
private final long connectTimeoutInSeconds;
private final Context context;
private final String namespace;
private final String projectNumber;
private final long readTimeoutInSeconds;
public ConfigFetchHttpClient(Context context, String str, String str2, String str3, long j4, long j5) {
this.context = context;
this.appId = str;
this.apiKey = str2;
this.projectNumber = extractProjectNumberFromAppId(str);
this.namespace = str3;
this.connectTimeoutInSeconds = j4;
this.readTimeoutInSeconds = j5;
}
private boolean backendHasUpdates(JSONObject jSONObject) {
try {
return true ^ jSONObject.get(RemoteConfigConstants.ResponseFieldKey.STATE).equals("NO_CHANGE");
} catch (JSONException unused) {
return true;
}
}
private String convertToISOString(long j4) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ISO_DATE_PATTERN, Locale.US);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormat.format(Long.valueOf(j4));
}
private JSONObject createFetchRequestBody(String str, String str2, Map<String, String> map, Long l4) throws FirebaseRemoteConfigClientException {
HashMap hashMap = new HashMap();
if (str == null) {
throw new FirebaseRemoteConfigClientException("Fetch failed: Firebase installation id is null.");
}
hashMap.put(RemoteConfigConstants.RequestFieldKey.INSTANCE_ID, str);
hashMap.put(RemoteConfigConstants.RequestFieldKey.INSTANCE_ID_TOKEN, str2);
hashMap.put(RemoteConfigConstants.RequestFieldKey.APP_ID, this.appId);
Locale locale = this.context.getResources().getConfiguration().locale;
hashMap.put(RemoteConfigConstants.RequestFieldKey.COUNTRY_CODE, locale.getCountry());
int i = Build.VERSION.SDK_INT;
hashMap.put(RemoteConfigConstants.RequestFieldKey.LANGUAGE_CODE, locale.toLanguageTag());
hashMap.put(RemoteConfigConstants.RequestFieldKey.PLATFORM_VERSION, Integer.toString(i));
hashMap.put(RemoteConfigConstants.RequestFieldKey.TIME_ZONE, TimeZone.getDefault().getID());
try {
PackageInfo packageInfo = this.context.getPackageManager().getPackageInfo(this.context.getPackageName(), 0);
if (packageInfo != null) {
hashMap.put(RemoteConfigConstants.RequestFieldKey.APP_VERSION, packageInfo.versionName);
hashMap.put(RemoteConfigConstants.RequestFieldKey.APP_BUILD, Long.toString(E.a.b(packageInfo)));
}
} catch (PackageManager.NameNotFoundException unused) {
}
hashMap.put(RemoteConfigConstants.RequestFieldKey.PACKAGE_NAME, this.context.getPackageName());
hashMap.put(RemoteConfigConstants.RequestFieldKey.SDK_VERSION, BuildConfig.VERSION_NAME);
hashMap.put(RemoteConfigConstants.RequestFieldKey.ANALYTICS_USER_PROPERTIES, new JSONObject(map));
if (l4 != null) {
hashMap.put(RemoteConfigConstants.RequestFieldKey.FIRST_OPEN_TIME, convertToISOString(l4.longValue()));
}
return new JSONObject(hashMap);
}
private static ConfigContainer extractConfigs(JSONObject jSONObject, Date date) throws FirebaseRemoteConfigClientException {
JSONObject jSONObject2;
JSONArray jSONArray;
JSONObject jSONObject3;
try {
ConfigContainer.Builder withFetchTime = ConfigContainer.newBuilder().withFetchTime(date);
JSONArray jSONArray2 = null;
try {
jSONObject2 = jSONObject.getJSONObject(RemoteConfigConstants.ResponseFieldKey.ENTRIES);
} catch (JSONException unused) {
jSONObject2 = null;
}
if (jSONObject2 != null) {
withFetchTime = withFetchTime.replaceConfigsWith(jSONObject2);
}
try {
jSONArray = jSONObject.getJSONArray(RemoteConfigConstants.ResponseFieldKey.EXPERIMENT_DESCRIPTIONS);
} catch (JSONException unused2) {
jSONArray = null;
}
if (jSONArray != null) {
withFetchTime = withFetchTime.withAbtExperiments(jSONArray);
}
try {
jSONObject3 = jSONObject.getJSONObject(RemoteConfigConstants.ResponseFieldKey.PERSONALIZATION_METADATA);
} catch (JSONException unused3) {
jSONObject3 = null;
}
if (jSONObject3 != null) {
withFetchTime = withFetchTime.withPersonalizationMetadata(jSONObject3);
}
String string = jSONObject.has(RemoteConfigConstants.ResponseFieldKey.TEMPLATE_VERSION_NUMBER) ? jSONObject.getString(RemoteConfigConstants.ResponseFieldKey.TEMPLATE_VERSION_NUMBER) : null;
if (string != null) {
withFetchTime.withTemplateVersionNumber(Long.parseLong(string));
}
try {
jSONArray2 = jSONObject.getJSONArray(RemoteConfigConstants.ResponseFieldKey.ROLLOUT_METADATA);
} catch (JSONException unused4) {
}
if (jSONArray2 != null) {
withFetchTime = withFetchTime.withRolloutMetadata(jSONArray2);
}
return withFetchTime.build();
} catch (JSONException e4) {
throw new FirebaseRemoteConfigClientException("Fetch failed: fetch response could not be parsed.", e4);
}
}
private static String extractProjectNumberFromAppId(String str) {
Matcher matcher = GMP_APP_ID_PATTERN.matcher(str);
if (matcher.matches()) {
return matcher.group(1);
}
return null;
}
private JSONObject getFetchResponseBody(URLConnection uRLConnection) throws IOException, JSONException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(uRLConnection.getInputStream(), "utf-8"));
StringBuilder sb = new StringBuilder();
while (true) {
int read = bufferedReader.read();
if (read == -1) {
return new JSONObject(sb.toString());
}
sb.append((char) read);
}
}
private String getFetchUrl(String str, String str2) {
return "https://firebaseremoteconfig.googleapis.com/v1/projects/" + str + "/namespaces/" + str2 + ":fetch";
}
private String getFingerprintHashForPackage() {
try {
Context context = this.context;
byte[] packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
if (packageCertificateHashBytes != null) {
return Hex.bytesToStringUppercase(packageCertificateHashBytes, false);
}
Log.e(FirebaseRemoteConfig.TAG, "Could not get fingerprint hash for package: " + this.context.getPackageName());
return null;
} catch (PackageManager.NameNotFoundException e4) {
Log.e(FirebaseRemoteConfig.TAG, "No such package: " + this.context.getPackageName(), e4);
return null;
}
}
private void setCommonRequestHeaders(HttpURLConnection httpURLConnection, String str) {
httpURLConnection.setRequestProperty(API_KEY_HEADER, this.apiKey);
httpURLConnection.setRequestProperty(X_ANDROID_PACKAGE_HEADER, this.context.getPackageName());
httpURLConnection.setRequestProperty(X_ANDROID_CERT_HEADER, getFingerprintHashForPackage());
httpURLConnection.setRequestProperty(X_GOOGLE_GFE_CAN_RETRY, "yes");
httpURLConnection.setRequestProperty(INSTALLATIONS_AUTH_TOKEN_HEADER, str);
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.setRequestProperty("Accept", "application/json");
}
private void setCustomRequestHeaders(HttpURLConnection httpURLConnection, Map<String, String> map) {
for (Map.Entry<String, String> entry : map.entrySet()) {
httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue());
}
}
private void setFetchRequestBody(HttpURLConnection httpURLConnection, byte[] bArr) throws IOException {
httpURLConnection.setFixedLengthStreamingMode(bArr.length);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(httpURLConnection.getOutputStream());
bufferedOutputStream.write(bArr);
bufferedOutputStream.flush();
bufferedOutputStream.close();
}
private void setUpUrlConnection(HttpURLConnection httpURLConnection, String str, String str2, Map<String, String> map) {
httpURLConnection.setDoOutput(true);
TimeUnit timeUnit = TimeUnit.SECONDS;
httpURLConnection.setConnectTimeout((int) timeUnit.toMillis(this.connectTimeoutInSeconds));
httpURLConnection.setReadTimeout((int) timeUnit.toMillis(this.readTimeoutInSeconds));
httpURLConnection.setRequestProperty(IF_NONE_MATCH_HEADER, str);
setCommonRequestHeaders(httpURLConnection, str2);
setCustomRequestHeaders(httpURLConnection, map);
}
public HttpURLConnection createHttpURLConnection() throws FirebaseRemoteConfigException {
try {
return (HttpURLConnection) new URL(getFetchUrl(this.projectNumber, this.namespace)).openConnection();
} catch (IOException e4) {
throw new FirebaseRemoteConfigException(e4.getMessage());
}
}
@Keep
public ConfigFetchHandler.FetchResponse fetch(HttpURLConnection httpURLConnection, String str, String str2, Map<String, String> map, String str3, Map<String, String> map2, Long l4, Date date) throws FirebaseRemoteConfigException {
setUpUrlConnection(httpURLConnection, str3, str2, map2);
try {
try {
setFetchRequestBody(httpURLConnection, createFetchRequestBody(str, str2, map, l4).toString().getBytes("utf-8"));
httpURLConnection.connect();
int responseCode = httpURLConnection.getResponseCode();
if (responseCode != 200) {
throw new FirebaseRemoteConfigServerException(responseCode, httpURLConnection.getResponseMessage());
}
String headerField = httpURLConnection.getHeaderField(ETAG_HEADER);
JSONObject fetchResponseBody = getFetchResponseBody(httpURLConnection);
try {
httpURLConnection.getInputStream().close();
} catch (IOException unused) {
}
ConfigContainer extractConfigs = extractConfigs(fetchResponseBody, date);
return !backendHasUpdates(fetchResponseBody) ? ConfigFetchHandler.FetchResponse.forBackendHasNoUpdates(date, extractConfigs) : ConfigFetchHandler.FetchResponse.forBackendUpdatesFetched(extractConfigs, headerField);
} catch (IOException | JSONException e4) {
throw new FirebaseRemoteConfigClientException("The client had an error while calling the backend!", e4);
}
} finally {
httpURLConnection.disconnect();
try {
httpURLConnection.getInputStream().close();
} catch (IOException unused2) {
}
}
}
public long getConnectTimeoutInSeconds() {
return this.connectTimeoutInSeconds;
}
public long getReadTimeoutInSeconds() {
return this.readTimeoutInSeconds;
}
}

View File

@@ -0,0 +1,252 @@
package com.google.firebase.remoteconfig.internal;
import android.util.Log;
import androidx.fragment.app.RunnableC0143e;
import com.google.android.gms.common.util.BiConsumer;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.Executor;
import java.util.regex.Pattern;
import org.json.JSONException;
/* loaded from: classes3.dex */
public class ConfigGetParameterHandler {
private final ConfigCacheClient activatedConfigsCache;
private final ConfigCacheClient defaultConfigsCache;
private final Executor executor;
private final Set<BiConsumer<String, ConfigContainer>> listeners = new HashSet();
public static final Charset FRC_BYTE_ARRAY_ENCODING = Charset.forName("UTF-8");
static final Pattern TRUE_REGEX = Pattern.compile("^(1|true|t|yes|y|on)$", 2);
static final Pattern FALSE_REGEX = Pattern.compile("^(0|false|f|no|n|off|)$", 2);
public ConfigGetParameterHandler(Executor executor, ConfigCacheClient configCacheClient, ConfigCacheClient configCacheClient2) {
this.executor = executor;
this.activatedConfigsCache = configCacheClient;
this.defaultConfigsCache = configCacheClient2;
}
public static /* synthetic */ void a(BiConsumer biConsumer, String str, ConfigContainer configContainer) {
biConsumer.accept(str, configContainer);
}
private void callListeners(String str, ConfigContainer configContainer) {
if (configContainer == null) {
return;
}
synchronized (this.listeners) {
try {
Iterator<BiConsumer<String, ConfigContainer>> it = this.listeners.iterator();
while (it.hasNext()) {
this.executor.execute(new RunnableC0143e(it.next(), str, configContainer, 4));
}
} catch (Throwable th) {
throw th;
}
}
}
private static ConfigContainer getConfigsFromCache(ConfigCacheClient configCacheClient) {
return configCacheClient.getBlocking();
}
private static Double getDoubleFromCache(ConfigCacheClient configCacheClient, String str) {
ConfigContainer configsFromCache = getConfigsFromCache(configCacheClient);
if (configsFromCache == null) {
return null;
}
try {
return Double.valueOf(configsFromCache.getConfigs().getDouble(str));
} catch (JSONException unused) {
return null;
}
}
private static Set<String> getKeySetFromCache(ConfigCacheClient configCacheClient) {
HashSet hashSet = new HashSet();
ConfigContainer configsFromCache = getConfigsFromCache(configCacheClient);
if (configsFromCache != null) {
Iterator<String> keys = configsFromCache.getConfigs().keys();
while (keys.hasNext()) {
hashSet.add(keys.next());
}
}
return hashSet;
}
private static Long getLongFromCache(ConfigCacheClient configCacheClient, String str) {
ConfigContainer configsFromCache = getConfigsFromCache(configCacheClient);
if (configsFromCache == null) {
return null;
}
try {
return Long.valueOf(configsFromCache.getConfigs().getLong(str));
} catch (JSONException unused) {
return null;
}
}
private static String getStringFromCache(ConfigCacheClient configCacheClient, String str) {
ConfigContainer configsFromCache = getConfigsFromCache(configCacheClient);
if (configsFromCache == null) {
return null;
}
try {
return configsFromCache.getConfigs().getString(str);
} catch (JSONException unused) {
return null;
}
}
private static void logParameterValueDoesNotExist(String str, String str2) {
Log.w(FirebaseRemoteConfig.TAG, "No value of type '" + str2 + "' exists for parameter key '" + str + "'.");
}
public void addListener(BiConsumer<String, ConfigContainer> biConsumer) {
synchronized (this.listeners) {
this.listeners.add(biConsumer);
}
}
public Map<String, FirebaseRemoteConfigValue> getAll() {
HashSet hashSet = new HashSet();
hashSet.addAll(getKeySetFromCache(this.activatedConfigsCache));
hashSet.addAll(getKeySetFromCache(this.defaultConfigsCache));
HashMap hashMap = new HashMap();
Iterator it = hashSet.iterator();
while (it.hasNext()) {
String str = (String) it.next();
hashMap.put(str, getValue(str));
}
return hashMap;
}
public boolean getBoolean(String str) {
String stringFromCache = getStringFromCache(this.activatedConfigsCache, str);
if (stringFromCache != null) {
if (TRUE_REGEX.matcher(stringFromCache).matches()) {
callListeners(str, getConfigsFromCache(this.activatedConfigsCache));
return true;
}
if (FALSE_REGEX.matcher(stringFromCache).matches()) {
callListeners(str, getConfigsFromCache(this.activatedConfigsCache));
return false;
}
}
String stringFromCache2 = getStringFromCache(this.defaultConfigsCache, str);
if (stringFromCache2 != null) {
if (TRUE_REGEX.matcher(stringFromCache2).matches()) {
return true;
}
if (FALSE_REGEX.matcher(stringFromCache2).matches()) {
return false;
}
}
logParameterValueDoesNotExist(str, "Boolean");
return false;
}
public byte[] getByteArray(String str) {
String stringFromCache = getStringFromCache(this.activatedConfigsCache, str);
if (stringFromCache != null) {
callListeners(str, getConfigsFromCache(this.activatedConfigsCache));
return stringFromCache.getBytes(FRC_BYTE_ARRAY_ENCODING);
}
String stringFromCache2 = getStringFromCache(this.defaultConfigsCache, str);
if (stringFromCache2 != null) {
return stringFromCache2.getBytes(FRC_BYTE_ARRAY_ENCODING);
}
logParameterValueDoesNotExist(str, "ByteArray");
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BYTE_ARRAY;
}
public double getDouble(String str) {
Double doubleFromCache = getDoubleFromCache(this.activatedConfigsCache, str);
if (doubleFromCache != null) {
callListeners(str, getConfigsFromCache(this.activatedConfigsCache));
return doubleFromCache.doubleValue();
}
Double doubleFromCache2 = getDoubleFromCache(this.defaultConfigsCache, str);
if (doubleFromCache2 != null) {
return doubleFromCache2.doubleValue();
}
logParameterValueDoesNotExist(str, "Double");
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
}
public Set<String> getKeysByPrefix(String str) {
if (str == null) {
str = "";
}
TreeSet treeSet = new TreeSet();
ConfigContainer configsFromCache = getConfigsFromCache(this.activatedConfigsCache);
if (configsFromCache != null) {
treeSet.addAll(getKeysByPrefix(str, configsFromCache));
}
ConfigContainer configsFromCache2 = getConfigsFromCache(this.defaultConfigsCache);
if (configsFromCache2 != null) {
treeSet.addAll(getKeysByPrefix(str, configsFromCache2));
}
return treeSet;
}
public long getLong(String str) {
Long longFromCache = getLongFromCache(this.activatedConfigsCache, str);
if (longFromCache != null) {
callListeners(str, getConfigsFromCache(this.activatedConfigsCache));
return longFromCache.longValue();
}
Long longFromCache2 = getLongFromCache(this.defaultConfigsCache, str);
if (longFromCache2 != null) {
return longFromCache2.longValue();
}
logParameterValueDoesNotExist(str, "Long");
return 0L;
}
public String getString(String str) {
String stringFromCache = getStringFromCache(this.activatedConfigsCache, str);
if (stringFromCache != null) {
callListeners(str, getConfigsFromCache(this.activatedConfigsCache));
return stringFromCache;
}
String stringFromCache2 = getStringFromCache(this.defaultConfigsCache, str);
if (stringFromCache2 != null) {
return stringFromCache2;
}
logParameterValueDoesNotExist(str, "String");
return "";
}
public FirebaseRemoteConfigValue getValue(String str) {
String stringFromCache = getStringFromCache(this.activatedConfigsCache, str);
if (stringFromCache != null) {
callListeners(str, getConfigsFromCache(this.activatedConfigsCache));
return new FirebaseRemoteConfigValueImpl(stringFromCache, 2);
}
String stringFromCache2 = getStringFromCache(this.defaultConfigsCache, str);
if (stringFromCache2 != null) {
return new FirebaseRemoteConfigValueImpl(stringFromCache2, 1);
}
logParameterValueDoesNotExist(str, "FirebaseRemoteConfigValue");
return new FirebaseRemoteConfigValueImpl("", 0);
}
private static TreeSet<String> getKeysByPrefix(String str, ConfigContainer configContainer) {
TreeSet<String> treeSet = new TreeSet<>();
Iterator<String> keys = configContainer.getConfigs().keys();
while (keys.hasNext()) {
String next = keys.next();
if (next.startsWith(str)) {
treeSet.add(next);
}
}
return treeSet;
}
}

View File

@@ -0,0 +1,190 @@
package com.google.firebase.remoteconfig.internal;
import android.content.SharedPreferences;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigInfo;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
import java.util.Date;
/* loaded from: classes3.dex */
public class ConfigMetadataClient {
private static final String BACKOFF_END_TIME_IN_MILLIS_KEY = "backoff_end_time_in_millis";
private static final String FETCH_TIMEOUT_IN_SECONDS_KEY = "fetch_timeout_in_seconds";
private static final String LAST_FETCH_ETAG_KEY = "last_fetch_etag";
private static final String LAST_FETCH_STATUS_KEY = "last_fetch_status";
public static final long LAST_FETCH_TIME_IN_MILLIS_NO_FETCH_YET = -1;
private static final String LAST_SUCCESSFUL_FETCH_TIME_IN_MILLIS_KEY = "last_fetch_time_in_millis";
private static final String LAST_TEMPLATE_VERSION = "last_template_version";
private static final String MINIMUM_FETCH_INTERVAL_IN_SECONDS_KEY = "minimum_fetch_interval_in_seconds";
private static final long NO_BACKOFF_TIME_IN_MILLIS = -1;
static final int NO_FAILED_FETCHES = 0;
static final int NO_FAILED_REALTIME_STREAMS = 0;
private static final String NUM_FAILED_FETCHES_KEY = "num_failed_fetches";
private static final String NUM_FAILED_REALTIME_STREAMS_KEY = "num_failed_realtime_streams";
private static final String REALTIME_BACKOFF_END_TIME_IN_MILLIS_KEY = "realtime_backoff_end_time_in_millis";
private final SharedPreferences frcMetadata;
static final Date LAST_FETCH_TIME_NO_FETCH_YET = new Date(-1);
static final Date NO_BACKOFF_TIME = new Date(-1);
private final Object frcInfoLock = new Object();
private final Object backoffMetadataLock = new Object();
private final Object realtimeBackoffMetadataLock = new Object();
/* loaded from: classes3.dex */
public static class BackoffMetadata {
private Date backoffEndTime;
private int numFailedFetches;
public BackoffMetadata(int i, Date date) {
this.numFailedFetches = i;
this.backoffEndTime = date;
}
public Date getBackoffEndTime() {
return this.backoffEndTime;
}
public int getNumFailedFetches() {
return this.numFailedFetches;
}
}
/* loaded from: classes3.dex */
public static class RealtimeBackoffMetadata {
private Date backoffEndTime;
private int numFailedStreams;
public RealtimeBackoffMetadata(int i, Date date) {
this.numFailedStreams = i;
this.backoffEndTime = date;
}
public Date getBackoffEndTime() {
return this.backoffEndTime;
}
public int getNumFailedStreams() {
return this.numFailedStreams;
}
}
public ConfigMetadataClient(SharedPreferences sharedPreferences) {
this.frcMetadata = sharedPreferences;
}
public void clear() {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().clear().commit();
}
}
public BackoffMetadata getBackoffMetadata() {
BackoffMetadata backoffMetadata;
synchronized (this.backoffMetadataLock) {
backoffMetadata = new BackoffMetadata(this.frcMetadata.getInt(NUM_FAILED_FETCHES_KEY, 0), new Date(this.frcMetadata.getLong(BACKOFF_END_TIME_IN_MILLIS_KEY, -1L)));
}
return backoffMetadata;
}
public long getFetchTimeoutInSeconds() {
return this.frcMetadata.getLong(FETCH_TIMEOUT_IN_SECONDS_KEY, 60L);
}
public FirebaseRemoteConfigInfo getInfo() {
FirebaseRemoteConfigInfoImpl build;
synchronized (this.frcInfoLock) {
long j4 = this.frcMetadata.getLong(LAST_SUCCESSFUL_FETCH_TIME_IN_MILLIS_KEY, -1L);
int i = this.frcMetadata.getInt(LAST_FETCH_STATUS_KEY, 0);
build = FirebaseRemoteConfigInfoImpl.newBuilder().withLastFetchStatus(i).withLastSuccessfulFetchTimeInMillis(j4).withConfigSettings(new FirebaseRemoteConfigSettings.Builder().setFetchTimeoutInSeconds(this.frcMetadata.getLong(FETCH_TIMEOUT_IN_SECONDS_KEY, 60L)).setMinimumFetchIntervalInSeconds(this.frcMetadata.getLong(MINIMUM_FETCH_INTERVAL_IN_SECONDS_KEY, ConfigFetchHandler.DEFAULT_MINIMUM_FETCH_INTERVAL_IN_SECONDS)).build()).build();
}
return build;
}
public String getLastFetchETag() {
return this.frcMetadata.getString(LAST_FETCH_ETAG_KEY, null);
}
public int getLastFetchStatus() {
return this.frcMetadata.getInt(LAST_FETCH_STATUS_KEY, 0);
}
public Date getLastSuccessfulFetchTime() {
return new Date(this.frcMetadata.getLong(LAST_SUCCESSFUL_FETCH_TIME_IN_MILLIS_KEY, -1L));
}
public long getLastTemplateVersion() {
return this.frcMetadata.getLong(LAST_TEMPLATE_VERSION, 0L);
}
public long getMinimumFetchIntervalInSeconds() {
return this.frcMetadata.getLong(MINIMUM_FETCH_INTERVAL_IN_SECONDS_KEY, ConfigFetchHandler.DEFAULT_MINIMUM_FETCH_INTERVAL_IN_SECONDS);
}
public RealtimeBackoffMetadata getRealtimeBackoffMetadata() {
RealtimeBackoffMetadata realtimeBackoffMetadata;
synchronized (this.realtimeBackoffMetadataLock) {
realtimeBackoffMetadata = new RealtimeBackoffMetadata(this.frcMetadata.getInt(NUM_FAILED_REALTIME_STREAMS_KEY, 0), new Date(this.frcMetadata.getLong(REALTIME_BACKOFF_END_TIME_IN_MILLIS_KEY, -1L)));
}
return realtimeBackoffMetadata;
}
public void resetBackoff() {
setBackoffMetadata(0, NO_BACKOFF_TIME);
}
public void resetRealtimeBackoff() {
setRealtimeBackoffMetadata(0, NO_BACKOFF_TIME);
}
public void setBackoffMetadata(int i, Date date) {
synchronized (this.backoffMetadataLock) {
this.frcMetadata.edit().putInt(NUM_FAILED_FETCHES_KEY, i).putLong(BACKOFF_END_TIME_IN_MILLIS_KEY, date.getTime()).apply();
}
}
public void setConfigSettings(FirebaseRemoteConfigSettings firebaseRemoteConfigSettings) {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().putLong(FETCH_TIMEOUT_IN_SECONDS_KEY, firebaseRemoteConfigSettings.getFetchTimeoutInSeconds()).putLong(MINIMUM_FETCH_INTERVAL_IN_SECONDS_KEY, firebaseRemoteConfigSettings.getMinimumFetchIntervalInSeconds()).commit();
}
}
public void setConfigSettingsWithoutWaitingOnDiskWrite(FirebaseRemoteConfigSettings firebaseRemoteConfigSettings) {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().putLong(FETCH_TIMEOUT_IN_SECONDS_KEY, firebaseRemoteConfigSettings.getFetchTimeoutInSeconds()).putLong(MINIMUM_FETCH_INTERVAL_IN_SECONDS_KEY, firebaseRemoteConfigSettings.getMinimumFetchIntervalInSeconds()).apply();
}
}
public void setLastFetchETag(String str) {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().putString(LAST_FETCH_ETAG_KEY, str).apply();
}
}
public void setLastTemplateVersion(long j4) {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().putLong(LAST_TEMPLATE_VERSION, j4).apply();
}
}
public void setRealtimeBackoffMetadata(int i, Date date) {
synchronized (this.realtimeBackoffMetadataLock) {
this.frcMetadata.edit().putInt(NUM_FAILED_REALTIME_STREAMS_KEY, i).putLong(REALTIME_BACKOFF_END_TIME_IN_MILLIS_KEY, date.getTime()).apply();
}
}
public void updateLastFetchAsFailed() {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().putInt(LAST_FETCH_STATUS_KEY, 1).apply();
}
}
public void updateLastFetchAsSuccessfulAt(Date date) {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().putInt(LAST_FETCH_STATUS_KEY, -1).putLong(LAST_SUCCESSFUL_FETCH_TIME_IN_MILLIS_KEY, date.getTime()).apply();
}
}
public void updateLastFetchAsThrottled() {
synchronized (this.frcInfoLock) {
this.frcMetadata.edit().putInt(LAST_FETCH_STATUS_KEY, 2).apply();
}
}
}

View File

@@ -0,0 +1,76 @@
package com.google.firebase.remoteconfig.internal;
import android.content.Context;
import com.google.firebase.FirebaseApp;
import com.google.firebase.installations.FirebaseInstallationsApi;
import com.google.firebase.remoteconfig.ConfigUpdateListener;
import com.google.firebase.remoteconfig.ConfigUpdateListenerRegistration;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
/* loaded from: classes3.dex */
public class ConfigRealtimeHandler {
private final ConfigCacheClient activatedCacheClient;
private final ConfigFetchHandler configFetchHandler;
private final ConfigRealtimeHttpClient configRealtimeHttpClient;
private final Context context;
private final FirebaseApp firebaseApp;
private final FirebaseInstallationsApi firebaseInstallations;
private final Set<ConfigUpdateListener> listeners;
private final ConfigMetadataClient metadataClient;
private final String namespace;
private final ScheduledExecutorService scheduledExecutorService;
/* loaded from: classes3.dex */
public class ConfigUpdateListenerRegistrationInternal implements ConfigUpdateListenerRegistration {
private final ConfigUpdateListener listener;
public ConfigUpdateListenerRegistrationInternal(ConfigUpdateListener configUpdateListener) {
this.listener = configUpdateListener;
}
@Override // com.google.firebase.remoteconfig.ConfigUpdateListenerRegistration
public void remove() {
ConfigRealtimeHandler.this.removeRealtimeConfigUpdateListener(this.listener);
}
}
public ConfigRealtimeHandler(FirebaseApp firebaseApp, FirebaseInstallationsApi firebaseInstallationsApi, ConfigFetchHandler configFetchHandler, ConfigCacheClient configCacheClient, Context context, String str, ConfigMetadataClient configMetadataClient, ScheduledExecutorService scheduledExecutorService) {
LinkedHashSet linkedHashSet = new LinkedHashSet();
this.listeners = linkedHashSet;
this.configRealtimeHttpClient = new ConfigRealtimeHttpClient(firebaseApp, firebaseInstallationsApi, configFetchHandler, configCacheClient, context, str, linkedHashSet, configMetadataClient, scheduledExecutorService);
this.firebaseApp = firebaseApp;
this.configFetchHandler = configFetchHandler;
this.firebaseInstallations = firebaseInstallationsApi;
this.activatedCacheClient = configCacheClient;
this.context = context;
this.namespace = str;
this.metadataClient = configMetadataClient;
this.scheduledExecutorService = scheduledExecutorService;
}
private synchronized void beginRealtime() {
if (!this.listeners.isEmpty()) {
this.configRealtimeHttpClient.startHttpConnection();
}
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void removeRealtimeConfigUpdateListener(ConfigUpdateListener configUpdateListener) {
this.listeners.remove(configUpdateListener);
}
public synchronized ConfigUpdateListenerRegistration addRealtimeConfigUpdateListener(ConfigUpdateListener configUpdateListener) {
this.listeners.add(configUpdateListener);
beginRealtime();
return new ConfigUpdateListenerRegistrationInternal(configUpdateListener);
}
public synchronized void setBackgroundState(boolean z3) {
this.configRealtimeHttpClient.setRealtimeBackgroundState(z3);
if (!z3) {
beginRealtime();
}
}
}

View File

@@ -0,0 +1,469 @@
package com.google.firebase.remoteconfig.internal;
import B0.C0031i;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.util.Log;
import c2.i;
import com.google.android.gms.common.util.AndroidUtilsLight;
import com.google.android.gms.common.util.Clock;
import com.google.android.gms.common.util.DefaultClock;
import com.google.android.gms.common.util.Hex;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.FirebaseApp;
import com.google.firebase.installations.FirebaseInstallationsApi;
import com.google.firebase.installations.InstallationTokenResult;
import com.google.firebase.remoteconfig.BuildConfig;
import com.google.firebase.remoteconfig.ConfigUpdate;
import com.google.firebase.remoteconfig.ConfigUpdateListener;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException;
import com.google.firebase.remoteconfig.RemoteConfigConstants;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class ConfigRealtimeHttpClient {
private static final String API_KEY_HEADER = "X-Goog-Api-Key";
static final int[] BACKOFF_TIME_DURATIONS_IN_MINUTES = {2, 4, 8, 16, 32, 64, 128, 256};
private static final Pattern GMP_APP_ID_PATTERN = Pattern.compile("^[^:]+:([0-9]+):(android|ios|web):([0-9a-f]+)");
private static final String INSTALLATIONS_AUTH_TOKEN_HEADER = "X-Goog-Firebase-Installations-Auth";
private static final String X_ACCEPT_RESPONSE_STREAMING = "X-Accept-Response-Streaming";
private static final String X_ANDROID_CERT_HEADER = "X-Android-Cert";
private static final String X_ANDROID_PACKAGE_HEADER = "X-Android-Package";
private static final String X_GOOGLE_GFE_CAN_RETRY = "X-Google-GFE-Can-Retry";
ConfigCacheClient activatedCache;
private final ConfigFetchHandler configFetchHandler;
private final Context context;
private final FirebaseApp firebaseApp;
private final FirebaseInstallationsApi firebaseInstallations;
private int httpRetriesRemaining;
private final Set<ConfigUpdateListener> listeners;
private final ConfigMetadataClient metadataClient;
private final String namespace;
private final ScheduledExecutorService scheduledExecutorService;
private final int ORIGINAL_RETRIES = 8;
private boolean isHttpConnectionRunning = false;
private final Random random = new Random();
private final Clock clock = DefaultClock.getInstance();
private boolean isRealtimeDisabled = false;
private boolean isInBackground = false;
/* renamed from: com.google.firebase.remoteconfig.internal.ConfigRealtimeHttpClient$1 */
/* loaded from: classes3.dex */
public class AnonymousClass1 implements Runnable {
public AnonymousClass1() {
}
@Override // java.lang.Runnable
public void run() {
ConfigRealtimeHttpClient.this.beginRealtimeHttpStream();
}
}
/* renamed from: com.google.firebase.remoteconfig.internal.ConfigRealtimeHttpClient$2 */
/* loaded from: classes3.dex */
public class AnonymousClass2 implements ConfigUpdateListener {
public AnonymousClass2() {
}
@Override // com.google.firebase.remoteconfig.ConfigUpdateListener
public void onError(FirebaseRemoteConfigException firebaseRemoteConfigException) {
ConfigRealtimeHttpClient.this.enableBackoff();
ConfigRealtimeHttpClient.this.propagateErrors(firebaseRemoteConfigException);
}
@Override // com.google.firebase.remoteconfig.ConfigUpdateListener
public void onUpdate(ConfigUpdate configUpdate) {
}
}
public ConfigRealtimeHttpClient(FirebaseApp firebaseApp, FirebaseInstallationsApi firebaseInstallationsApi, ConfigFetchHandler configFetchHandler, ConfigCacheClient configCacheClient, Context context, String str, Set<ConfigUpdateListener> set, ConfigMetadataClient configMetadataClient, ScheduledExecutorService scheduledExecutorService) {
this.listeners = set;
this.scheduledExecutorService = scheduledExecutorService;
this.httpRetriesRemaining = Math.max(8 - configMetadataClient.getRealtimeBackoffMetadata().getNumFailedStreams(), 1);
this.firebaseApp = firebaseApp;
this.configFetchHandler = configFetchHandler;
this.firebaseInstallations = firebaseInstallationsApi;
this.activatedCache = configCacheClient;
this.context = context;
this.namespace = str;
this.metadataClient = configMetadataClient;
}
private synchronized boolean canMakeHttpStreamConnection() {
boolean z3;
if (!this.listeners.isEmpty() && !this.isHttpConnectionRunning && !this.isRealtimeDisabled) {
z3 = this.isInBackground ? false : true;
}
return z3;
}
private JSONObject createRequestBody(String str) {
HashMap hashMap = new HashMap();
hashMap.put("project", extractProjectNumberFromAppId(this.firebaseApp.getOptions().getApplicationId()));
hashMap.put("namespace", this.namespace);
hashMap.put("lastKnownVersionNumber", Long.toString(this.configFetchHandler.getTemplateVersionNumber()));
hashMap.put(RemoteConfigConstants.RequestFieldKey.APP_ID, this.firebaseApp.getOptions().getApplicationId());
hashMap.put(RemoteConfigConstants.RequestFieldKey.SDK_VERSION, BuildConfig.VERSION_NAME);
hashMap.put(RemoteConfigConstants.RequestFieldKey.INSTANCE_ID, str);
return new JSONObject(hashMap);
}
public synchronized void enableBackoff() {
this.isRealtimeDisabled = true;
}
private static String extractProjectNumberFromAppId(String str) {
Matcher matcher = GMP_APP_ID_PATTERN.matcher(str);
if (matcher.matches()) {
return matcher.group(1);
}
return null;
}
private String getFingerprintHashForPackage() {
try {
Context context = this.context;
byte[] packageCertificateHashBytes = AndroidUtilsLight.getPackageCertificateHashBytes(context, context.getPackageName());
if (packageCertificateHashBytes != null) {
return Hex.bytesToStringUppercase(packageCertificateHashBytes, false);
}
Log.e(FirebaseRemoteConfig.TAG, "Could not get fingerprint hash for package: " + this.context.getPackageName());
return null;
} catch (PackageManager.NameNotFoundException unused) {
Log.i(FirebaseRemoteConfig.TAG, "No such package: " + this.context.getPackageName());
return null;
}
}
private long getRandomizedBackoffDurationInMillis(int i) {
int length = BACKOFF_TIME_DURATIONS_IN_MINUTES.length;
if (i >= length) {
i = length;
}
return (TimeUnit.MINUTES.toMillis(r0[i - 1]) / 2) + this.random.nextInt((int) r0);
}
private String getRealtimeURL(String str) {
return "https://firebaseremoteconfigrealtime.googleapis.com/v1/projects/" + extractProjectNumberFromAppId(this.firebaseApp.getOptions().getApplicationId()) + "/namespaces/" + str + ":streamFetchInvalidations";
}
private URL getUrl() {
try {
return new URL(getRealtimeURL(this.namespace));
} catch (MalformedURLException unused) {
Log.e(FirebaseRemoteConfig.TAG, "URL is malformed");
return null;
}
}
private boolean isStatusCodeRetryable(int i) {
return i == 408 || i == 429 || i == 502 || i == 503 || i == 504;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r10v0, types: [com.google.android.gms.tasks.Task] */
/* JADX WARN: Type inference failed for: r10v13, types: [java.net.HttpURLConnection] */
/* JADX WARN: Type inference failed for: r10v2 */
/* JADX WARN: Type inference failed for: r10v3 */
/* JADX WARN: Type inference failed for: r10v4, types: [java.net.HttpURLConnection] */
/* JADX WARN: Type inference failed for: r10v7, types: [java.net.HttpURLConnection] */
/* JADX WARN: Type inference failed for: r9v0, types: [com.google.firebase.remoteconfig.internal.ConfigRealtimeHttpClient] */
public /* synthetic */ Task lambda$beginRealtimeHttpStream$1(Task task, Task task2) throws Exception {
Integer num;
Throwable th;
Integer num2;
FirebaseRemoteConfigServerException firebaseRemoteConfigServerException;
int responseCode;
boolean isStatusCodeRetryable;
boolean z3 = true;
try {
try {
} catch (Throwable th2) {
th = th2;
}
} catch (IOException e4) {
e = e4;
task = 0;
num2 = null;
} catch (Throwable th3) {
num = null;
th = th3;
task = 0;
}
if (!task.isSuccessful()) {
throw new IOException(task.getException());
}
setIsHttpConnectionRunning(true);
task = (HttpURLConnection) task.getResult();
try {
responseCode = task.getResponseCode();
num2 = Integer.valueOf(responseCode);
if (responseCode == 200) {
try {
resetRetryCount();
this.metadataClient.resetRealtimeBackoff();
startAutoFetch(task).listenForNotifications();
} catch (IOException e5) {
e = e5;
Log.d(FirebaseRemoteConfig.TAG, "Exception connecting to real-time RC backend. Retrying the connection...", e);
closeRealtimeHttpStream(task);
setIsHttpConnectionRunning(false);
if (num2 != null && !isStatusCodeRetryable(num2.intValue())) {
z3 = false;
}
if (z3) {
updateBackoffMetadataWithLastFailedStreamConnectionTime(new Date(this.clock.currentTimeMillis()));
}
if (!z3 && num2.intValue() != 200) {
String format = String.format("Unable to connect to the server. Try again in a few minutes. HTTP status code: %d", num2);
if (num2.intValue() == 403) {
format = parseForbiddenErrorResponseMessage(task.getErrorStream());
}
firebaseRemoteConfigServerException = new FirebaseRemoteConfigServerException(num2.intValue(), format, FirebaseRemoteConfigException.Code.CONFIG_UPDATE_STREAM_ERROR);
propagateErrors(firebaseRemoteConfigServerException);
return Tasks.forResult(null);
}
retryHttpConnectionWhenBackoffEnds();
return Tasks.forResult(null);
}
}
closeRealtimeHttpStream(task);
setIsHttpConnectionRunning(false);
isStatusCodeRetryable = isStatusCodeRetryable(responseCode);
if (isStatusCodeRetryable) {
updateBackoffMetadataWithLastFailedStreamConnectionTime(new Date(this.clock.currentTimeMillis()));
}
} catch (IOException e6) {
e = e6;
num2 = null;
} catch (Throwable th4) {
num = null;
th = th4;
closeRealtimeHttpStream(task);
setIsHttpConnectionRunning(false);
if (num != null && !isStatusCodeRetryable(num.intValue())) {
z3 = false;
}
if (z3) {
updateBackoffMetadataWithLastFailedStreamConnectionTime(new Date(this.clock.currentTimeMillis()));
}
if (z3 || num.intValue() == 200) {
retryHttpConnectionWhenBackoffEnds();
} else {
String format2 = String.format("Unable to connect to the server. Try again in a few minutes. HTTP status code: %d", num);
if (num.intValue() == 403) {
format2 = parseForbiddenErrorResponseMessage(task.getErrorStream());
}
propagateErrors(new FirebaseRemoteConfigServerException(num.intValue(), format2, FirebaseRemoteConfigException.Code.CONFIG_UPDATE_STREAM_ERROR));
}
throw th;
}
if (!isStatusCodeRetryable && responseCode != 200) {
String format3 = String.format("Unable to connect to the server. Try again in a few minutes. HTTP status code: %d", num2);
if (responseCode == 403) {
format3 = parseForbiddenErrorResponseMessage(task.getErrorStream());
}
firebaseRemoteConfigServerException = new FirebaseRemoteConfigServerException(responseCode, format3, FirebaseRemoteConfigException.Code.CONFIG_UPDATE_STREAM_ERROR);
propagateErrors(firebaseRemoteConfigServerException);
return Tasks.forResult(null);
}
retryHttpConnectionWhenBackoffEnds();
return Tasks.forResult(null);
}
public /* synthetic */ Task lambda$createRealtimeConnection$0(Task task, Task task2, Task task3) throws Exception {
if (!task.isSuccessful()) {
return Tasks.forException(new FirebaseRemoteConfigClientException("Firebase Installations failed to get installation auth token for config update listener connection.", task.getException()));
}
if (!task2.isSuccessful()) {
return Tasks.forException(new FirebaseRemoteConfigClientException("Firebase Installations failed to get installation ID for config update listener connection.", task2.getException()));
}
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) getUrl().openConnection();
setRequestParams(httpURLConnection, (String) task2.getResult(), ((InstallationTokenResult) task.getResult()).getToken());
return Tasks.forResult(httpURLConnection);
} catch (IOException e4) {
return Tasks.forException(new FirebaseRemoteConfigClientException("Failed to open HTTP stream connection", e4));
}
}
private synchronized void makeRealtimeHttpConnection(long j4) {
try {
if (canMakeHttpStreamConnection()) {
int i = this.httpRetriesRemaining;
if (i > 0) {
this.httpRetriesRemaining = i - 1;
this.scheduledExecutorService.schedule(new Runnable() { // from class: com.google.firebase.remoteconfig.internal.ConfigRealtimeHttpClient.1
public AnonymousClass1() {
}
@Override // java.lang.Runnable
public void run() {
ConfigRealtimeHttpClient.this.beginRealtimeHttpStream();
}
}, j4, TimeUnit.MILLISECONDS);
} else if (!this.isInBackground) {
propagateErrors(new FirebaseRemoteConfigClientException("Unable to connect to the server. Check your connection and try again.", FirebaseRemoteConfigException.Code.CONFIG_UPDATE_STREAM_ERROR));
}
}
} catch (Throwable th) {
throw th;
}
}
private String parseForbiddenErrorResponseMessage(InputStream inputStream) {
StringBuilder sb = new StringBuilder();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
}
} catch (IOException unused) {
if (sb.length() == 0) {
return "Unable to connect to the server, access is forbidden. HTTP status code: 403";
}
}
return sb.toString();
}
public synchronized void propagateErrors(FirebaseRemoteConfigException firebaseRemoteConfigException) {
Iterator<ConfigUpdateListener> it = this.listeners.iterator();
while (it.hasNext()) {
it.next().onError(firebaseRemoteConfigException);
}
}
private synchronized void resetRetryCount() {
this.httpRetriesRemaining = 8;
}
private void setCommonRequestHeaders(HttpURLConnection httpURLConnection, String str) {
httpURLConnection.setRequestProperty(INSTALLATIONS_AUTH_TOKEN_HEADER, str);
httpURLConnection.setRequestProperty(API_KEY_HEADER, this.firebaseApp.getOptions().getApiKey());
httpURLConnection.setRequestProperty(X_ANDROID_PACKAGE_HEADER, this.context.getPackageName());
httpURLConnection.setRequestProperty(X_ANDROID_CERT_HEADER, getFingerprintHashForPackage());
httpURLConnection.setRequestProperty(X_GOOGLE_GFE_CAN_RETRY, "yes");
httpURLConnection.setRequestProperty(X_ACCEPT_RESPONSE_STREAMING, "true");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.setRequestProperty("Accept", "application/json");
}
private synchronized void setIsHttpConnectionRunning(boolean z3) {
this.isHttpConnectionRunning = z3;
}
private void updateBackoffMetadataWithLastFailedStreamConnectionTime(Date date) {
int numFailedStreams = this.metadataClient.getRealtimeBackoffMetadata().getNumFailedStreams() + 1;
this.metadataClient.setRealtimeBackoffMetadata(numFailedStreams, new Date(date.getTime() + getRandomizedBackoffDurationInMillis(numFailedStreams)));
}
@SuppressLint({"VisibleForTests", "DefaultLocale"})
public void beginRealtimeHttpStream() {
if (canMakeHttpStreamConnection()) {
if (new Date(this.clock.currentTimeMillis()).before(this.metadataClient.getRealtimeBackoffMetadata().getBackoffEndTime())) {
retryHttpConnectionWhenBackoffEnds();
} else {
Task<HttpURLConnection> createRealtimeConnection = createRealtimeConnection();
Tasks.whenAllComplete((Task<?>[]) new Task[]{createRealtimeConnection}).continueWith(this.scheduledExecutorService, new i(4, this, createRealtimeConnection));
}
}
}
public void closeRealtimeHttpStream(HttpURLConnection httpURLConnection) {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
try {
httpURLConnection.getInputStream().close();
if (httpURLConnection.getErrorStream() != null) {
httpURLConnection.getErrorStream().close();
}
} catch (IOException unused) {
}
}
}
@SuppressLint({"VisibleForTests"})
public Task<HttpURLConnection> createRealtimeConnection() {
Task<InstallationTokenResult> token = this.firebaseInstallations.getToken(false);
Task<String> id = this.firebaseInstallations.getId();
return Tasks.whenAllComplete((Task<?>[]) new Task[]{token, id}).continueWithTask(this.scheduledExecutorService, new C0031i(this, token, id, 3));
}
@SuppressLint({"VisibleForTests"})
public Date getBackoffEndTime() {
return this.metadataClient.getRealtimeBackoffMetadata().getBackoffEndTime();
}
@SuppressLint({"VisibleForTests"})
public int getNumberOfFailedStreams() {
return this.metadataClient.getRealtimeBackoffMetadata().getNumFailedStreams();
}
@SuppressLint({"VisibleForTests"})
public synchronized void retryHttpConnectionWhenBackoffEnds() {
makeRealtimeHttpConnection(Math.max(0L, this.metadataClient.getRealtimeBackoffMetadata().getBackoffEndTime().getTime() - new Date(this.clock.currentTimeMillis()).getTime()));
}
public void setRealtimeBackgroundState(boolean z3) {
this.isInBackground = z3;
}
@SuppressLint({"VisibleForTests"})
public void setRequestParams(HttpURLConnection httpURLConnection, String str, String str2) throws IOException {
httpURLConnection.setRequestMethod("POST");
setCommonRequestHeaders(httpURLConnection, str2);
byte[] bytes = createRequestBody(str).toString().getBytes("utf-8");
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(httpURLConnection.getOutputStream());
bufferedOutputStream.write(bytes);
bufferedOutputStream.flush();
bufferedOutputStream.close();
}
@SuppressLint({"VisibleForTests"})
public synchronized ConfigAutoFetch startAutoFetch(HttpURLConnection httpURLConnection) {
return new ConfigAutoFetch(httpURLConnection, this.configFetchHandler, this.activatedCache, this.listeners, new ConfigUpdateListener() { // from class: com.google.firebase.remoteconfig.internal.ConfigRealtimeHttpClient.2
public AnonymousClass2() {
}
@Override // com.google.firebase.remoteconfig.ConfigUpdateListener
public void onError(FirebaseRemoteConfigException firebaseRemoteConfigException) {
ConfigRealtimeHttpClient.this.enableBackoff();
ConfigRealtimeHttpClient.this.propagateErrors(firebaseRemoteConfigException);
}
@Override // com.google.firebase.remoteconfig.ConfigUpdateListener
public void onUpdate(ConfigUpdate configUpdate) {
}
}, this.scheduledExecutorService);
}
public void startHttpConnection() {
makeRealtimeHttpConnection(0L);
}
}

View File

@@ -0,0 +1,97 @@
package com.google.firebase.remoteconfig.internal;
import android.content.Context;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class ConfigStorageClient {
private static final String JSON_STRING_ENCODING = "UTF-8";
private static final Map<String, ConfigStorageClient> clientInstances = new HashMap();
private final Context context;
private final String fileName;
private ConfigStorageClient(Context context, String str) {
this.context = context;
this.fileName = str;
}
public static synchronized void clearInstancesForTest() {
synchronized (ConfigStorageClient.class) {
clientInstances.clear();
}
}
public static synchronized ConfigStorageClient getInstance(Context context, String str) {
ConfigStorageClient configStorageClient;
synchronized (ConfigStorageClient.class) {
try {
Map<String, ConfigStorageClient> map = clientInstances;
if (!map.containsKey(str)) {
map.put(str, new ConfigStorageClient(context, str));
}
configStorageClient = map.get(str);
} catch (Throwable th) {
throw th;
}
}
return configStorageClient;
}
public synchronized Void clear() {
this.context.deleteFile(this.fileName);
return null;
}
public String getFileName() {
return this.fileName;
}
public synchronized ConfigContainer read() throws IOException {
FileInputStream fileInputStream;
Throwable th;
try {
fileInputStream = this.context.openFileInput(this.fileName);
} catch (FileNotFoundException | JSONException unused) {
fileInputStream = null;
} catch (Throwable th2) {
fileInputStream = null;
th = th2;
}
try {
int available = fileInputStream.available();
byte[] bArr = new byte[available];
fileInputStream.read(bArr, 0, available);
ConfigContainer copyOf = ConfigContainer.copyOf(new JSONObject(new String(bArr, JSON_STRING_ENCODING)));
fileInputStream.close();
return copyOf;
} catch (FileNotFoundException | JSONException unused2) {
if (fileInputStream != null) {
fileInputStream.close();
}
return null;
} catch (Throwable th3) {
th = th3;
if (fileInputStream != null) {
fileInputStream.close();
}
throw th;
}
}
public synchronized Void write(ConfigContainer configContainer) throws IOException {
FileOutputStream openFileOutput = this.context.openFileOutput(this.fileName, 0);
try {
openFileOutput.write(configContainer.toString().getBytes(JSON_STRING_ENCODING));
} finally {
openFileOutput.close();
}
return null;
}
}

View File

@@ -0,0 +1,108 @@
package com.google.firebase.remoteconfig.internal;
/* loaded from: classes3.dex */
public class DefaultsXmlParser {
private static final String XML_TAG_ENTRY = "entry";
private static final String XML_TAG_KEY = "key";
private static final String XML_TAG_VALUE = "value";
/* JADX WARN: Removed duplicated region for block: B:37:0x0079 */
/* JADX WARN: Removed duplicated region for block: B:42:0x0086 A[Catch: IOException | XmlPullParserException -> 0x0013, TryCatch #0 {IOException | XmlPullParserException -> 0x0013, blocks: (B:3:0x0007, B:5:0x000d, B:8:0x0016, B:13:0x0028, B:15:0x008a, B:18:0x0031, B:22:0x0041, B:24:0x0045, B:30:0x0053, B:38:0x007b, B:40:0x0081, B:42:0x0086, B:44:0x0062, B:47:0x006c), top: B:2:0x0007 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.util.Map<java.lang.String, java.lang.String> getDefaultsFromXml(android.content.Context r8, int r9) {
/*
java.lang.String r0 = "FirebaseRemoteConfig"
java.util.HashMap r1 = new java.util.HashMap
r1.<init>()
android.content.res.Resources r8 = r8.getResources() // Catch: java.lang.Throwable -> L13
if (r8 != 0) goto L16
java.lang.String r8 = "Could not find the resources of the current context while trying to set defaults from an XML."
android.util.Log.e(r0, r8) // Catch: java.lang.Throwable -> L13
return r1
L13:
r8 = move-exception
goto L8f
L16:
android.content.res.XmlResourceParser r8 = r8.getXml(r9) // Catch: java.lang.Throwable -> L13
int r9 = r8.getEventType() // Catch: java.lang.Throwable -> L13
r2 = 0
r3 = r2
r4 = r3
r5 = r4
L22:
r6 = 1
if (r9 == r6) goto L94
r7 = 2
if (r9 != r7) goto L2e
java.lang.String r3 = r8.getName() // Catch: java.lang.Throwable -> L13
goto L8a
L2e:
r7 = 3
if (r9 != r7) goto L4e
java.lang.String r9 = r8.getName() // Catch: java.lang.Throwable -> L13
java.lang.String r3 = "entry"
boolean r9 = r9.equals(r3) // Catch: java.lang.Throwable -> L13
if (r9 == 0) goto L4c
if (r4 == 0) goto L45
if (r5 == 0) goto L45
r1.put(r4, r5) // Catch: java.lang.Throwable -> L13
goto L4a
L45:
java.lang.String r9 = "An entry in the defaults XML has an invalid key and/or value tag."
android.util.Log.w(r0, r9) // Catch: java.lang.Throwable -> L13
L4a:
r4 = r2
r5 = r4
L4c:
r3 = r2
goto L8a
L4e:
r7 = 4
if (r9 != r7) goto L8a
if (r3 == 0) goto L8a
int r9 = r3.hashCode() // Catch: java.lang.Throwable -> L13
r7 = 106079(0x19e5f, float:1.48648E-40)
if (r9 == r7) goto L6c
r7 = 111972721(0x6ac9171, float:6.4912916E-35)
if (r9 == r7) goto L62
goto L76
L62:
java.lang.String r9 = "value"
boolean r9 = r3.equals(r9) // Catch: java.lang.Throwable -> L13
if (r9 == 0) goto L76
r9 = r6
goto L77
L6c:
java.lang.String r9 = "key"
boolean r9 = r3.equals(r9) // Catch: java.lang.Throwable -> L13
if (r9 == 0) goto L76
r9 = 0
goto L77
L76:
r9 = -1
L77:
if (r9 == 0) goto L86
if (r9 == r6) goto L81
java.lang.String r9 = "Encountered an unexpected tag while parsing the defaults XML."
android.util.Log.w(r0, r9) // Catch: java.lang.Throwable -> L13
goto L8a
L81:
java.lang.String r5 = r8.getText() // Catch: java.lang.Throwable -> L13
goto L8a
L86:
java.lang.String r4 = r8.getText() // Catch: java.lang.Throwable -> L13
L8a:
int r9 = r8.next() // Catch: java.lang.Throwable -> L13
goto L22
L8f:
java.lang.String r9 = "Encountered an error while parsing the defaults XML file."
android.util.Log.e(r0, r9, r8)
L94:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.remoteconfig.internal.DefaultsXmlParser.getDefaultsFromXml(android.content.Context, int):java.util.Map");
}
}

View File

@@ -0,0 +1,65 @@
package com.google.firebase.remoteconfig.internal;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigInfo;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
/* loaded from: classes3.dex */
public class FirebaseRemoteConfigInfoImpl implements FirebaseRemoteConfigInfo {
private final FirebaseRemoteConfigSettings configSettings;
private final int lastFetchStatus;
private final long lastSuccessfulFetchTimeInMillis;
/* loaded from: classes3.dex */
public static class Builder {
private FirebaseRemoteConfigSettings builderConfigSettings;
private int builderLastFetchStatus;
private long builderLastSuccessfulFetchTimeInMillis;
public FirebaseRemoteConfigInfoImpl build() {
return new FirebaseRemoteConfigInfoImpl(this.builderLastSuccessfulFetchTimeInMillis, this.builderLastFetchStatus, this.builderConfigSettings);
}
public Builder withConfigSettings(FirebaseRemoteConfigSettings firebaseRemoteConfigSettings) {
this.builderConfigSettings = firebaseRemoteConfigSettings;
return this;
}
public Builder withLastFetchStatus(int i) {
this.builderLastFetchStatus = i;
return this;
}
public Builder withLastSuccessfulFetchTimeInMillis(long j4) {
this.builderLastSuccessfulFetchTimeInMillis = j4;
return this;
}
private Builder() {
}
}
public static Builder newBuilder() {
return new Builder();
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigInfo
public FirebaseRemoteConfigSettings getConfigSettings() {
return this.configSettings;
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigInfo
public long getFetchTimeMillis() {
return this.lastSuccessfulFetchTimeInMillis;
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigInfo
public int getLastFetchStatus() {
return this.lastFetchStatus;
}
private FirebaseRemoteConfigInfoImpl(long j4, int i, FirebaseRemoteConfigSettings firebaseRemoteConfigSettings) {
this.lastSuccessfulFetchTimeInMillis = j4;
this.lastFetchStatus = i;
this.configSettings = firebaseRemoteConfigSettings;
}
}

View File

@@ -0,0 +1,87 @@
package com.google.firebase.remoteconfig.internal;
import C.w;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue;
/* loaded from: classes3.dex */
public class FirebaseRemoteConfigValueImpl implements FirebaseRemoteConfigValue {
private static final String ILLEGAL_ARGUMENT_STRING_FORMAT = "[Value: %s] cannot be converted to a %s.";
private final int source;
private final String value;
public FirebaseRemoteConfigValueImpl(String str, int i) {
this.value = str;
this.source = i;
}
private String asTrimmedString() {
return asString().trim();
}
private void throwIfNullValue() {
if (this.value == null) {
throw new IllegalArgumentException("Value is null, and cannot be converted to the desired type.");
}
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigValue
public boolean asBoolean() throws IllegalArgumentException {
if (this.source == 0) {
return false;
}
String asTrimmedString = asTrimmedString();
if (ConfigGetParameterHandler.TRUE_REGEX.matcher(asTrimmedString).matches()) {
return true;
}
if (ConfigGetParameterHandler.FALSE_REGEX.matcher(asTrimmedString).matches()) {
return false;
}
throw new IllegalArgumentException(w.o("[Value: ", asTrimmedString, "] cannot be converted to a boolean."));
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigValue
public byte[] asByteArray() {
return this.source == 0 ? FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BYTE_ARRAY : this.value.getBytes(ConfigGetParameterHandler.FRC_BYTE_ARRAY_ENCODING);
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigValue
public double asDouble() {
if (this.source == 0) {
return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE;
}
String asTrimmedString = asTrimmedString();
try {
return Double.valueOf(asTrimmedString).doubleValue();
} catch (NumberFormatException e4) {
throw new IllegalArgumentException(w.o("[Value: ", asTrimmedString, "] cannot be converted to a double."), e4);
}
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigValue
public long asLong() {
if (this.source == 0) {
return 0L;
}
String asTrimmedString = asTrimmedString();
try {
return Long.valueOf(asTrimmedString).longValue();
} catch (NumberFormatException e4) {
throw new IllegalArgumentException(w.o("[Value: ", asTrimmedString, "] cannot be converted to a long."), e4);
}
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigValue
public String asString() {
if (this.source == 0) {
return "";
}
throwIfNullValue();
return this.value;
}
@Override // com.google.firebase.remoteconfig.FirebaseRemoteConfigValue
public int getSource() {
return this.source;
}
}

View File

@@ -0,0 +1,71 @@
package com.google.firebase.remoteconfig.internal;
import android.os.Bundle;
import com.google.firebase.analytics.connector.AnalyticsConnector;
import com.google.firebase.inject.Provider;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class Personalization {
public static final String ANALYTICS_ORIGIN_PERSONALIZATION = "fp";
public static final String ARM_INDEX = "armIndex";
public static final String CHOICE_ID = "choiceId";
public static final String EXTERNAL_ARM_INDEX_PARAM = "arm_index";
public static final String EXTERNAL_ARM_VALUE_PARAM = "arm_value";
public static final String EXTERNAL_EVENT = "personalization_assignment";
public static final String EXTERNAL_GROUP_PARAM = "group";
public static final String EXTERNAL_PERSONALIZATION_ID_PARAM = "personalization_id";
public static final String EXTERNAL_RC_PARAMETER_PARAM = "arm_key";
public static final String GROUP = "group";
public static final String INTERNAL_CHOICE_ID_PARAM = "_fpid";
public static final String INTERNAL_EVENT = "_fpc";
public static final String PERSONALIZATION_ID = "personalizationId";
private final Provider<AnalyticsConnector> analyticsConnector;
private final Map<String, String> loggedChoiceIds = Collections.synchronizedMap(new HashMap());
public Personalization(Provider<AnalyticsConnector> provider) {
this.analyticsConnector = provider;
}
public void logArmActive(String str, ConfigContainer configContainer) {
JSONObject optJSONObject;
AnalyticsConnector analyticsConnector = this.analyticsConnector.get();
if (analyticsConnector == null) {
return;
}
JSONObject personalizationMetadata = configContainer.getPersonalizationMetadata();
if (personalizationMetadata.length() < 1) {
return;
}
JSONObject configs = configContainer.getConfigs();
if (configs.length() >= 1 && (optJSONObject = personalizationMetadata.optJSONObject(str)) != null) {
String optString = optJSONObject.optString(CHOICE_ID);
if (optString.isEmpty()) {
return;
}
synchronized (this.loggedChoiceIds) {
try {
if (optString.equals(this.loggedChoiceIds.get(str))) {
return;
}
this.loggedChoiceIds.put(str, optString);
Bundle bundle = new Bundle();
bundle.putString(EXTERNAL_RC_PARAMETER_PARAM, str);
bundle.putString(EXTERNAL_ARM_VALUE_PARAM, configs.optString(str));
bundle.putString(EXTERNAL_PERSONALIZATION_ID_PARAM, optJSONObject.optString(PERSONALIZATION_ID));
bundle.putInt(EXTERNAL_ARM_INDEX_PARAM, optJSONObject.optInt(ARM_INDEX, -1));
bundle.putString("group", optJSONObject.optString("group"));
analyticsConnector.logEvent(ANALYTICS_ORIGIN_PERSONALIZATION, EXTERNAL_EVENT, bundle);
Bundle bundle2 = new Bundle();
bundle2.putString(INTERNAL_CHOICE_ID_PARAM, optString);
analyticsConnector.logEvent(ANALYTICS_ORIGIN_PERSONALIZATION, INTERNAL_EVENT, bundle2);
} catch (Throwable th) {
throw th;
}
}
}
}
}

View File

@@ -0,0 +1,47 @@
package com.google.firebase.remoteconfig.internal.rollouts;
import android.util.Log;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException;
import com.google.firebase.remoteconfig.internal.ConfigContainer;
import com.google.firebase.remoteconfig.internal.ConfigGetParameterHandler;
import com.google.firebase.remoteconfig.interop.rollouts.RolloutAssignment;
import com.google.firebase.remoteconfig.interop.rollouts.RolloutsState;
import java.util.HashSet;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class RolloutsStateFactory {
ConfigGetParameterHandler getParameterHandler;
public RolloutsStateFactory(ConfigGetParameterHandler configGetParameterHandler) {
this.getParameterHandler = configGetParameterHandler;
}
public static RolloutsStateFactory create(ConfigGetParameterHandler configGetParameterHandler) {
return new RolloutsStateFactory(configGetParameterHandler);
}
public RolloutsState getActiveRolloutsState(ConfigContainer configContainer) throws FirebaseRemoteConfigClientException {
JSONArray rolloutMetadata = configContainer.getRolloutMetadata();
long templateVersionNumber = configContainer.getTemplateVersionNumber();
HashSet hashSet = new HashSet();
for (int i = 0; i < rolloutMetadata.length(); i++) {
try {
JSONObject jSONObject = rolloutMetadata.getJSONObject(i);
String string = jSONObject.getString(ConfigContainer.ROLLOUT_METADATA_ID);
JSONArray jSONArray = jSONObject.getJSONArray(ConfigContainer.ROLLOUT_METADATA_AFFECTED_KEYS);
if (jSONArray.length() > 1) {
Log.w(FirebaseRemoteConfig.TAG, String.format("Rollout has multiple affected parameter keys.Only the first key will be included in RolloutsState. rolloutId: %s, affectedParameterKeys: %s", string, jSONArray));
}
String optString = jSONArray.optString(0, "");
hashSet.add(RolloutAssignment.builder().setRolloutId(string).setVariantId(jSONObject.getString("variantId")).setParameterKey(optString).setParameterValue(this.getParameterHandler.getString(optString)).setTemplateVersion(templateVersionNumber).build());
} catch (JSONException e4) {
throw new FirebaseRemoteConfigClientException("Exception parsing rollouts metadata to create RolloutsState.", e4);
}
}
return RolloutsState.create(hashSet);
}
}

View File

@@ -0,0 +1,64 @@
package com.google.firebase.remoteconfig.internal.rollouts;
import android.util.Log;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
import com.google.firebase.remoteconfig.internal.ConfigCacheClient;
import com.google.firebase.remoteconfig.internal.ConfigContainer;
import com.google.firebase.remoteconfig.interop.rollouts.RolloutsState;
import com.google.firebase.remoteconfig.interop.rollouts.RolloutsStateSubscriber;
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
/* loaded from: classes3.dex */
public class RolloutsStateSubscriptionsHandler {
private ConfigCacheClient activatedConfigsCache;
private Executor executor;
private RolloutsStateFactory rolloutsStateFactory;
private Set<RolloutsStateSubscriber> subscribers = Collections.newSetFromMap(new ConcurrentHashMap());
public RolloutsStateSubscriptionsHandler(ConfigCacheClient configCacheClient, RolloutsStateFactory rolloutsStateFactory, Executor executor) {
this.activatedConfigsCache = configCacheClient;
this.rolloutsStateFactory = rolloutsStateFactory;
this.executor = executor;
}
public /* synthetic */ void lambda$registerRolloutsStateSubscriber$1(Task task, RolloutsStateSubscriber rolloutsStateSubscriber, ConfigContainer configContainer) {
try {
ConfigContainer configContainer2 = (ConfigContainer) task.getResult();
if (configContainer2 != null) {
this.executor.execute(new b(rolloutsStateSubscriber, this.rolloutsStateFactory.getActiveRolloutsState(configContainer2), 0));
}
} catch (FirebaseRemoteConfigException e4) {
Log.w(FirebaseRemoteConfig.TAG, "Exception publishing RolloutsState to subscriber. Continuing to listen for changes.", e4);
}
}
public void publishActiveRolloutsState(ConfigContainer configContainer) {
try {
RolloutsState activeRolloutsState = this.rolloutsStateFactory.getActiveRolloutsState(configContainer);
Iterator<RolloutsStateSubscriber> it = this.subscribers.iterator();
while (it.hasNext()) {
this.executor.execute(new b(it.next(), activeRolloutsState, 1));
}
} catch (FirebaseRemoteConfigException e4) {
Log.w(FirebaseRemoteConfig.TAG, "Exception publishing RolloutsState to subscribers. Continuing to listen for changes.", e4);
}
}
public void registerRolloutsStateSubscriber(final RolloutsStateSubscriber rolloutsStateSubscriber) {
this.subscribers.add(rolloutsStateSubscriber);
final Task<ConfigContainer> task = this.activatedConfigsCache.get();
task.addOnSuccessListener(this.executor, new OnSuccessListener() { // from class: com.google.firebase.remoteconfig.internal.rollouts.a
@Override // com.google.android.gms.tasks.OnSuccessListener
public final void onSuccess(Object obj) {
RolloutsStateSubscriptionsHandler.this.lambda$registerRolloutsStateSubscriber$1(task, rolloutsStateSubscriber, (ConfigContainer) obj);
}
});
}
}

View File

@@ -0,0 +1,35 @@
package com.google.firebase.remoteconfig.internal.rollouts;
import com.google.firebase.remoteconfig.interop.rollouts.RolloutsState;
import com.google.firebase.remoteconfig.interop.rollouts.RolloutsStateSubscriber;
/* loaded from: classes3.dex */
public final /* synthetic */ class b implements Runnable {
/* renamed from: a, reason: collision with root package name */
public final /* synthetic */ int f6055a;
/* renamed from: b, reason: collision with root package name */
public final /* synthetic */ RolloutsStateSubscriber f6056b;
/* renamed from: c, reason: collision with root package name */
public final /* synthetic */ RolloutsState f6057c;
public /* synthetic */ b(RolloutsStateSubscriber rolloutsStateSubscriber, RolloutsState rolloutsState, int i) {
this.f6055a = i;
this.f6056b = rolloutsStateSubscriber;
this.f6057c = rolloutsState;
}
@Override // java.lang.Runnable
public final void run() {
switch (this.f6055a) {
case 0:
RolloutsStateSubscriptionsHandler.b(this.f6056b, this.f6057c);
return;
default:
RolloutsStateSubscriptionsHandler.c(this.f6056b, this.f6057c);
return;
}
}
}