Files
rr3-apk/decompiled-community/sources/com/google/firebase/crashlytics/internal/settings/DefaultSettingsSpiCall.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

111 lines
4.9 KiB
Java

package com.google.firebase.crashlytics.internal.settings;
import android.text.TextUtils;
import com.facebook.share.internal.ShareConstants;
import com.google.firebase.crashlytics.internal.Logger;
import com.google.firebase.crashlytics.internal.common.CrashlyticsCore;
import com.google.firebase.crashlytics.internal.network.HttpGetRequest;
import com.google.firebase.crashlytics.internal.network.HttpRequestFactory;
import com.google.firebase.crashlytics.internal.network.HttpResponse;
import com.ironsource.f5;
import com.ironsource.nb;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class DefaultSettingsSpiCall implements SettingsSpiCall {
public final Logger logger;
public final HttpRequestFactory requestFactory;
public final String url;
public boolean requestWasSuccessful(int i) {
return i == 200 || i == 201 || i == 202 || i == 203;
}
public DefaultSettingsSpiCall(String str, HttpRequestFactory httpRequestFactory) {
this(str, httpRequestFactory, Logger.getLogger());
}
public DefaultSettingsSpiCall(String str, HttpRequestFactory httpRequestFactory, Logger logger) {
if (str == null) {
throw new IllegalArgumentException("url must not be null.");
}
this.logger = logger;
this.requestFactory = httpRequestFactory;
this.url = str;
}
public HttpGetRequest createHttpGetRequest(Map map) {
return this.requestFactory.buildHttpGetRequest(this.url, map).header("User-Agent", "Crashlytics Android SDK/" + CrashlyticsCore.getVersion()).header("X-CRASHLYTICS-DEVELOPER-TOKEN", "470fa2b4ae81cd56ecbcda9735803434cec591fa");
}
@Override // com.google.firebase.crashlytics.internal.settings.SettingsSpiCall
public JSONObject invoke(SettingsRequest settingsRequest, boolean z) {
if (!z) {
throw new RuntimeException("An invalid data collection token was used.");
}
try {
Map queryParamsFor = getQueryParamsFor(settingsRequest);
HttpGetRequest applyHeadersTo = applyHeadersTo(createHttpGetRequest(queryParamsFor), settingsRequest);
this.logger.d("Requesting settings from " + this.url);
this.logger.v("Settings query params were: " + queryParamsFor);
return handleResponse(applyHeadersTo.execute());
} catch (IOException e) {
this.logger.e("Settings request failed.", e);
return null;
}
}
public JSONObject handleResponse(HttpResponse httpResponse) {
int code = httpResponse.code();
this.logger.v("Settings response code was: " + code);
if (requestWasSuccessful(code)) {
return getJsonObjectFrom(httpResponse.body());
}
this.logger.e("Settings request failed; (status: " + code + ") from " + this.url);
return null;
}
public final JSONObject getJsonObjectFrom(String str) {
try {
return new JSONObject(str);
} catch (Exception e) {
this.logger.w("Failed to parse settings JSON from " + this.url, e);
this.logger.w("Settings response " + str);
return null;
}
}
public final Map getQueryParamsFor(SettingsRequest settingsRequest) {
HashMap hashMap = new HashMap();
hashMap.put("build_version", settingsRequest.buildVersion);
hashMap.put("display_version", settingsRequest.displayVersion);
hashMap.put(ShareConstants.FEED_SOURCE_PARAM, Integer.toString(settingsRequest.source));
String str = settingsRequest.instanceId;
if (!TextUtils.isEmpty(str)) {
hashMap.put(f5.o, str);
}
return hashMap;
}
public final HttpGetRequest applyHeadersTo(HttpGetRequest httpGetRequest, SettingsRequest settingsRequest) {
applyNonNullHeader(httpGetRequest, "X-CRASHLYTICS-GOOGLE-APP-ID", settingsRequest.googleAppId);
applyNonNullHeader(httpGetRequest, "X-CRASHLYTICS-API-CLIENT-TYPE", "android");
applyNonNullHeader(httpGetRequest, "X-CRASHLYTICS-API-CLIENT-VERSION", CrashlyticsCore.getVersion());
applyNonNullHeader(httpGetRequest, "Accept", nb.L);
applyNonNullHeader(httpGetRequest, "X-CRASHLYTICS-DEVICE-MODEL", settingsRequest.deviceModel);
applyNonNullHeader(httpGetRequest, "X-CRASHLYTICS-OS-BUILD-VERSION", settingsRequest.osBuildVersion);
applyNonNullHeader(httpGetRequest, "X-CRASHLYTICS-OS-DISPLAY-VERSION", settingsRequest.osDisplayVersion);
applyNonNullHeader(httpGetRequest, "X-CRASHLYTICS-INSTALLATION-ID", settingsRequest.installIdProvider.getInstallIds().getCrashlyticsInstallId());
return httpGetRequest;
}
public final void applyNonNullHeader(HttpGetRequest httpGetRequest, String str, String str2) {
if (str2 != null) {
httpGetRequest.header(str, str2);
}
}
}