Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
package com.google.firebase.perf.metrics.validator;
import com.google.firebase.perf.logging.AndroidLogger;
import com.google.firebase.perf.v1.ApplicationInfo;
/* loaded from: classes3.dex */
public class FirebasePerfApplicationInfoValidator extends PerfMetricValidator {
public static final AndroidLogger logger = AndroidLogger.getInstance();
public final ApplicationInfo applicationInfo;
public FirebasePerfApplicationInfoValidator(ApplicationInfo applicationInfo) {
this.applicationInfo = applicationInfo;
}
@Override // com.google.firebase.perf.metrics.validator.PerfMetricValidator
public boolean isValidPerfMetric() {
if (isValidApplicationInfo()) {
return true;
}
logger.warn("ApplicationInfo is invalid");
return false;
}
public final boolean isValidApplicationInfo() {
ApplicationInfo applicationInfo = this.applicationInfo;
if (applicationInfo == null) {
logger.warn("ApplicationInfo is null");
return false;
}
if (!applicationInfo.hasGoogleAppId()) {
logger.warn("GoogleAppId is null");
return false;
}
if (!this.applicationInfo.hasAppInstanceId()) {
logger.warn("AppInstanceId is null");
return false;
}
if (!this.applicationInfo.hasApplicationProcessState()) {
logger.warn("ApplicationProcessState is null");
return false;
}
if (!this.applicationInfo.hasAndroidAppInfo()) {
return true;
}
if (!this.applicationInfo.getAndroidAppInfo().hasPackageName()) {
logger.warn("AndroidAppInfo.packageName is null");
return false;
}
if (this.applicationInfo.getAndroidAppInfo().hasSdkVersion()) {
return true;
}
logger.warn("AndroidAppInfo.sdkVersion is null");
return false;
}
}

View File

@@ -0,0 +1,17 @@
package com.google.firebase.perf.metrics.validator;
import com.google.firebase.perf.v1.GaugeMetric;
/* loaded from: classes3.dex */
public final class FirebasePerfGaugeMetricValidator extends PerfMetricValidator {
public final GaugeMetric gaugeMetric;
public FirebasePerfGaugeMetricValidator(GaugeMetric gaugeMetric) {
this.gaugeMetric = gaugeMetric;
}
@Override // com.google.firebase.perf.metrics.validator.PerfMetricValidator
public boolean isValidPerfMetric() {
return this.gaugeMetric.hasSessionId() && (this.gaugeMetric.getCpuMetricReadingsCount() > 0 || this.gaugeMetric.getAndroidMemoryReadingsCount() > 0 || (this.gaugeMetric.hasGaugeMetadata() && this.gaugeMetric.getGaugeMetadata().hasMaxAppJavaHeapMemoryKb()));
}
}

View File

@@ -0,0 +1,154 @@
package com.google.firebase.perf.metrics.validator;
import android.content.Context;
import com.google.firebase.perf.logging.AndroidLogger;
import com.google.firebase.perf.util.URLAllowlist;
import com.google.firebase.perf.v1.NetworkRequestMetric;
import java.net.URI;
/* loaded from: classes3.dex */
public final class FirebasePerfNetworkValidator extends PerfMetricValidator {
public static final AndroidLogger logger = AndroidLogger.getInstance();
public final Context appContext;
public final NetworkRequestMetric networkMetric;
public final boolean isValidHttpResponseCode(int i) {
return i > 0;
}
public final boolean isValidPayload(long j) {
return j >= 0;
}
public final boolean isValidPort(int i) {
return i == -1 || i > 0;
}
public final boolean isValidTime(long j) {
return j >= 0;
}
public final boolean isValidUserInfo(String str) {
return str == null;
}
public FirebasePerfNetworkValidator(NetworkRequestMetric networkRequestMetric, Context context) {
this.appContext = context;
this.networkMetric = networkRequestMetric;
}
@Override // com.google.firebase.perf.metrics.validator.PerfMetricValidator
public boolean isValidPerfMetric() {
if (isEmptyUrl(this.networkMetric.getUrl())) {
logger.warn("URL is missing:" + this.networkMetric.getUrl());
return false;
}
URI resultUrl = getResultUrl(this.networkMetric.getUrl());
if (resultUrl == null) {
logger.warn("URL cannot be parsed");
return false;
}
if (!isAllowlisted(resultUrl, this.appContext)) {
logger.warn("URL fails allowlist rule: " + resultUrl);
return false;
}
if (!isValidHost(resultUrl.getHost())) {
logger.warn("URL host is null or invalid");
return false;
}
if (!isValidScheme(resultUrl.getScheme())) {
logger.warn("URL scheme is null or invalid");
return false;
}
if (!isValidUserInfo(resultUrl.getUserInfo())) {
logger.warn("URL user info is null");
return false;
}
if (!isValidPort(resultUrl.getPort())) {
logger.warn("URL port is less than or equal to 0");
return false;
}
if (!isValidHttpMethod(this.networkMetric.hasHttpMethod() ? this.networkMetric.getHttpMethod() : null)) {
logger.warn("HTTP Method is null or invalid: " + this.networkMetric.getHttpMethod());
return false;
}
if (this.networkMetric.hasHttpResponseCode() && !isValidHttpResponseCode(this.networkMetric.getHttpResponseCode())) {
logger.warn("HTTP ResponseCode is a negative value:" + this.networkMetric.getHttpResponseCode());
return false;
}
if (this.networkMetric.hasRequestPayloadBytes() && !isValidPayload(this.networkMetric.getRequestPayloadBytes())) {
logger.warn("Request Payload is a negative value:" + this.networkMetric.getRequestPayloadBytes());
return false;
}
if (this.networkMetric.hasResponsePayloadBytes() && !isValidPayload(this.networkMetric.getResponsePayloadBytes())) {
logger.warn("Response Payload is a negative value:" + this.networkMetric.getResponsePayloadBytes());
return false;
}
if (!this.networkMetric.hasClientStartTimeUs() || this.networkMetric.getClientStartTimeUs() <= 0) {
logger.warn("Start time of the request is null, or zero, or a negative value:" + this.networkMetric.getClientStartTimeUs());
return false;
}
if (this.networkMetric.hasTimeToRequestCompletedUs() && !isValidTime(this.networkMetric.getTimeToRequestCompletedUs())) {
logger.warn("Time to complete the request is a negative value:" + this.networkMetric.getTimeToRequestCompletedUs());
return false;
}
if (this.networkMetric.hasTimeToResponseInitiatedUs() && !isValidTime(this.networkMetric.getTimeToResponseInitiatedUs())) {
logger.warn("Time from the start of the request to the start of the response is null or a negative value:" + this.networkMetric.getTimeToResponseInitiatedUs());
return false;
}
if (!this.networkMetric.hasTimeToResponseCompletedUs() || this.networkMetric.getTimeToResponseCompletedUs() <= 0) {
logger.warn("Time from the start of the request to the end of the response is null, negative or zero:" + this.networkMetric.getTimeToResponseCompletedUs());
return false;
}
if (this.networkMetric.hasHttpResponseCode()) {
return true;
}
logger.warn("Did not receive a HTTP Response Code");
return false;
}
public final boolean isEmptyUrl(String str) {
return isBlank(str);
}
public final URI getResultUrl(String str) {
if (str == null) {
return null;
}
try {
return URI.create(str);
} catch (IllegalArgumentException | IllegalStateException e) {
logger.warn("getResultUrl throws exception %s", e.getMessage());
return null;
}
}
public final boolean isAllowlisted(URI uri, Context context) {
if (uri == null) {
return false;
}
return URLAllowlist.isURLAllowlisted(uri, context);
}
public final boolean isValidHost(String str) {
return (str == null || isBlank(str) || str.length() > 255) ? false : true;
}
public final boolean isValidScheme(String str) {
if (str == null) {
return false;
}
return "http".equalsIgnoreCase(str) || "https".equalsIgnoreCase(str);
}
public boolean isValidHttpMethod(NetworkRequestMetric.HttpMethod httpMethod) {
return (httpMethod == null || httpMethod == NetworkRequestMetric.HttpMethod.HTTP_METHOD_UNKNOWN) ? false : true;
}
public final boolean isBlank(String str) {
if (str == null) {
return true;
}
return str.trim().isEmpty();
}
}

View File

@@ -0,0 +1,161 @@
package com.google.firebase.perf.metrics.validator;
import com.google.firebase.perf.logging.AndroidLogger;
import com.google.firebase.perf.util.Constants$CounterNames;
import com.google.firebase.perf.v1.TraceMetric;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes3.dex */
public final class FirebasePerfTraceValidator extends PerfMetricValidator {
public static final AndroidLogger logger = AndroidLogger.getInstance();
public final TraceMetric traceMetric;
public final boolean isValidCounterValue(Long l) {
return l != null;
}
public FirebasePerfTraceValidator(TraceMetric traceMetric) {
this.traceMetric = traceMetric;
}
@Override // com.google.firebase.perf.metrics.validator.PerfMetricValidator
public boolean isValidPerfMetric() {
if (!isValidTrace(this.traceMetric, 0)) {
logger.warn("Invalid Trace:" + this.traceMetric.getName());
return false;
}
if (!hasCounters(this.traceMetric) || areCountersValid(this.traceMetric)) {
return true;
}
logger.warn("Invalid Counters for Trace:" + this.traceMetric.getName());
return false;
}
public final boolean hasCounters(TraceMetric traceMetric) {
if (traceMetric.getCountersCount() > 0) {
return true;
}
Iterator it = traceMetric.getSubtracesList().iterator();
while (it.hasNext()) {
if (((TraceMetric) it.next()).getCountersCount() > 0) {
return true;
}
}
return false;
}
public final boolean areCountersValid(TraceMetric traceMetric) {
return areCountersValid(traceMetric, 0);
}
public final boolean areCountersValid(TraceMetric traceMetric, int i) {
if (traceMetric == null) {
return false;
}
if (i > 1) {
logger.warn("Exceed MAX_SUBTRACE_DEEP:1");
return false;
}
for (Map.Entry entry : traceMetric.getCountersMap().entrySet()) {
if (!isValidCounterId((String) entry.getKey())) {
logger.warn("invalid CounterId:" + ((String) entry.getKey()));
return false;
}
if (!isValidCounterValue((Long) entry.getValue())) {
logger.warn("invalid CounterValue:" + entry.getValue());
return false;
}
}
Iterator it = traceMetric.getSubtracesList().iterator();
while (it.hasNext()) {
if (!areCountersValid((TraceMetric) it.next(), i + 1)) {
return false;
}
}
return true;
}
public final boolean isScreenTrace(TraceMetric traceMetric) {
return traceMetric.getName().startsWith("_st_");
}
public final boolean isValidScreenTrace(TraceMetric traceMetric) {
Long l = (Long) traceMetric.getCountersMap().get(Constants$CounterNames.FRAMES_TOTAL.toString());
return l != null && l.compareTo((Long) 0L) > 0;
}
public final boolean isValidTrace(TraceMetric traceMetric, int i) {
if (traceMetric == null) {
logger.warn("TraceMetric is null");
return false;
}
if (i > 1) {
logger.warn("Exceed MAX_SUBTRACE_DEEP:1");
return false;
}
if (!isValidTraceId(traceMetric.getName())) {
logger.warn("invalid TraceId:" + traceMetric.getName());
return false;
}
if (!isValidTraceDuration(traceMetric)) {
logger.warn("invalid TraceDuration:" + traceMetric.getDurationUs());
return false;
}
if (!traceMetric.hasClientStartTimeUs()) {
logger.warn("clientStartTimeUs is null.");
return false;
}
if (isScreenTrace(traceMetric) && !isValidScreenTrace(traceMetric)) {
logger.warn("non-positive totalFrames in screen trace " + traceMetric.getName());
return false;
}
Iterator it = traceMetric.getSubtracesList().iterator();
while (it.hasNext()) {
if (!isValidTrace((TraceMetric) it.next(), i + 1)) {
return false;
}
}
return areAllAttributesValid(traceMetric.getCustomAttributesMap());
}
public final boolean isValidTraceId(String str) {
if (str == null) {
return false;
}
String trim = str.trim();
return !trim.isEmpty() && trim.length() <= 100;
}
public final boolean isValidTraceDuration(TraceMetric traceMetric) {
return traceMetric != null && traceMetric.getDurationUs() > 0;
}
public final boolean isValidCounterId(String str) {
if (str == null) {
return false;
}
String trim = str.trim();
if (trim.isEmpty()) {
logger.warn("counterId is empty");
return false;
}
if (trim.length() <= 100) {
return true;
}
logger.warn("counterId exceeded max length 100");
return false;
}
public final boolean areAllAttributesValid(Map map) {
for (Map.Entry entry : map.entrySet()) {
try {
PerfMetricValidator.validateAttribute((String) entry.getKey(), (String) entry.getValue());
} catch (IllegalArgumentException e) {
logger.warn(e.getLocalizedMessage());
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,105 @@
package com.google.firebase.perf.metrics.validator;
import android.content.Context;
import com.google.firebase.perf.logging.AndroidLogger;
import com.google.firebase.perf.util.Constants$CounterNames;
import com.google.firebase.perf.util.Constants$TraceNames;
import com.google.firebase.perf.v1.PerfMetric;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
/* loaded from: classes3.dex */
public abstract class PerfMetricValidator {
public abstract boolean isValidPerfMetric();
public static List getValidators(PerfMetric perfMetric, Context context) {
ArrayList arrayList = new ArrayList();
if (perfMetric.hasTraceMetric()) {
arrayList.add(new FirebasePerfTraceValidator(perfMetric.getTraceMetric()));
}
if (perfMetric.hasNetworkRequestMetric()) {
arrayList.add(new FirebasePerfNetworkValidator(perfMetric.getNetworkRequestMetric(), context));
}
if (perfMetric.hasApplicationInfo()) {
arrayList.add(new FirebasePerfApplicationInfoValidator(perfMetric.getApplicationInfo()));
}
if (perfMetric.hasGaugeMetric()) {
arrayList.add(new FirebasePerfGaugeMetricValidator(perfMetric.getGaugeMetric()));
}
return arrayList;
}
public static boolean isValid(PerfMetric perfMetric, Context context) {
List validators = getValidators(perfMetric, context);
if (validators.isEmpty()) {
AndroidLogger.getInstance().debug("No validators found for PerfMetric.");
return false;
}
Iterator it = validators.iterator();
while (it.hasNext()) {
if (!((PerfMetricValidator) it.next()).isValidPerfMetric()) {
return false;
}
}
return true;
}
public static String validateTraceName(String str) {
if (str == null) {
return "Trace name must not be null";
}
if (str.length() > 100) {
return String.format(Locale.US, "Trace name must not exceed %d characters", 100);
}
if (!str.startsWith("_")) {
return null;
}
for (Constants$TraceNames constants$TraceNames : Constants$TraceNames.values()) {
if (constants$TraceNames.toString().equals(str)) {
return null;
}
}
if (str.startsWith("_st_")) {
return null;
}
return "Trace name must not start with '_'";
}
public static String validateMetricName(String str) {
if (str == null) {
return "Metric name must not be null";
}
if (str.length() > 100) {
return String.format(Locale.US, "Metric name must not exceed %d characters", 100);
}
if (!str.startsWith("_")) {
return null;
}
for (Constants$CounterNames constants$CounterNames : Constants$CounterNames.values()) {
if (constants$CounterNames.toString().equals(str)) {
return null;
}
}
return "Metric name must not start with '_'";
}
public static void validateAttribute(String str, String str2) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("Attribute key must not be null or empty");
}
if (str2 == null || str2.length() == 0) {
throw new IllegalArgumentException("Attribute value must not be null or empty");
}
if (str.length() > 40) {
throw new IllegalArgumentException(String.format(Locale.US, "Attribute key length must not exceed %d characters", 40));
}
if (str2.length() > 100) {
throw new IllegalArgumentException(String.format(Locale.US, "Attribute value length must not exceed %d characters", 100));
}
if (!str.matches("^(?!(firebase_|google_|ga_))[A-Za-z][A-Za-z_0-9]*")) {
throw new IllegalArgumentException("Attribute key must start with letter, must only contain alphanumeric characters and underscore and must not start with \"firebase_\", \"google_\" and \"ga_");
}
}
}