3077 lines
124 KiB
Java
3077 lines
124 KiB
Java
package com.google.firebase.crashlytics.internal.common;
|
|
|
|
import android.app.ActivityManager;
|
|
import android.content.Context;
|
|
import android.graphics.Color;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Environment;
|
|
import android.os.StatFs;
|
|
import android.text.TextUtils;
|
|
import android.view.View;
|
|
import android.view.ViewConfiguration;
|
|
import android.widget.ExpandableListView;
|
|
import com.google.android.gms.tasks.SuccessContinuation;
|
|
import com.google.android.gms.tasks.Task;
|
|
import com.google.android.gms.tasks.TaskCompletionSource;
|
|
import com.google.android.gms.tasks.Tasks;
|
|
import com.google.common.base.Ascii;
|
|
import com.google.firebase.analytics.connector.AnalyticsConnector;
|
|
import com.google.firebase.crashlytics.internal.CrashlyticsNativeComponent;
|
|
import com.google.firebase.crashlytics.internal.Logger;
|
|
import com.google.firebase.crashlytics.internal.NativeSessionFileProvider;
|
|
import com.google.firebase.crashlytics.internal.analytics.AnalyticsReceiver;
|
|
import com.google.firebase.crashlytics.internal.common.CrashlyticsUncaughtExceptionHandler;
|
|
import com.google.firebase.crashlytics.internal.log.LogFileManager;
|
|
import com.google.firebase.crashlytics.internal.ndk.NativeFileUtils;
|
|
import com.google.firebase.crashlytics.internal.network.HttpRequestFactory;
|
|
import com.google.firebase.crashlytics.internal.persistence.FileStore;
|
|
import com.google.firebase.crashlytics.internal.proto.ClsFileOutputStream;
|
|
import com.google.firebase.crashlytics.internal.proto.CodedOutputStream;
|
|
import com.google.firebase.crashlytics.internal.proto.SessionProtobufHelper;
|
|
import com.google.firebase.crashlytics.internal.report.ReportManager;
|
|
import com.google.firebase.crashlytics.internal.report.ReportUploader;
|
|
import com.google.firebase.crashlytics.internal.report.model.Report;
|
|
import com.google.firebase.crashlytics.internal.report.model.SessionReport;
|
|
import com.google.firebase.crashlytics.internal.report.network.CompositeCreateReportSpiCall;
|
|
import com.google.firebase.crashlytics.internal.report.network.CreateReportSpiCall;
|
|
import com.google.firebase.crashlytics.internal.report.network.DefaultCreateReportSpiCall;
|
|
import com.google.firebase.crashlytics.internal.report.network.NativeCreateReportSpiCall;
|
|
import com.google.firebase.crashlytics.internal.settings.SettingsDataProvider;
|
|
import com.google.firebase.crashlytics.internal.settings.model.AppSettingsData;
|
|
import com.google.firebase.crashlytics.internal.settings.model.Settings;
|
|
import com.google.firebase.crashlytics.internal.stacktrace.MiddleOutFallbackStrategy;
|
|
import com.google.firebase.crashlytics.internal.stacktrace.RemoveRepeatsStrategy;
|
|
import com.google.firebase.crashlytics.internal.stacktrace.StackTraceTrimmingStrategy;
|
|
import com.google.firebase.crashlytics.internal.stacktrace.TrimmedThrowableData;
|
|
import com.google.firebase.crashlytics.internal.unity.UnityVersionProvider;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.io.FilenameFilter;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.lang.Thread;
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.Date;
|
|
import java.util.HashSet;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.TreeMap;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import o.GuL;
|
|
import o.xzZ;
|
|
import org.bouncycastle.crypto.tls.CipherSuite;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class CrashlyticsController {
|
|
private static final int ANALYZER_VERSION = 1;
|
|
private static final String COLLECT_CUSTOM_KEYS = "com.crashlytics.CollectCustomKeys";
|
|
private static final String CRASHLYTICS_API_ENDPOINT = "com.crashlytics.ApiEndpoint";
|
|
private static final String EVENT_TYPE_CRASH = "crash";
|
|
private static final String EVENT_TYPE_LOGGED = "error";
|
|
static final String FATAL_SESSION_DIR = "fatal-sessions";
|
|
static final String FIREBASE_ANALYTICS_ORIGIN_CRASHLYTICS = "clx";
|
|
static final String FIREBASE_APPLICATION_EXCEPTION = "_ae";
|
|
static final String FIREBASE_CRASH_TYPE = "fatal";
|
|
static final int FIREBASE_CRASH_TYPE_FATAL = 1;
|
|
static final String FIREBASE_TIMESTAMP = "timestamp";
|
|
private static final String GENERATOR_FORMAT = "Crashlytics Android SDK/%s";
|
|
private static final String[] INITIAL_SESSION_PART_TAGS;
|
|
static final Comparator<File> LARGEST_FILE_NAME_FIRST;
|
|
private static final int MAX_CHAINED_EXCEPTION_DEPTH = 8;
|
|
private static final int MAX_LOCAL_LOGGED_EXCEPTIONS = 64;
|
|
static final int MAX_OPEN_SESSIONS = 8;
|
|
static final int MAX_STACK_SIZE = 1024;
|
|
static final String NATIVE_SESSION_DIR = "native-sessions";
|
|
static final String NONFATAL_SESSION_DIR = "nonfatal-sessions";
|
|
static final int NUM_STACK_REPETITIONS_ALLOWED = 10;
|
|
private static final Map<String, String> SEND_AT_CRASHTIME_HEADER;
|
|
static final String SESSION_APP_TAG = "SessionApp";
|
|
static final FilenameFilter SESSION_BEGIN_FILE_FILTER;
|
|
static final String SESSION_BEGIN_TAG = "BeginSession";
|
|
static final String SESSION_DEVICE_TAG = "SessionDevice";
|
|
static final String SESSION_EVENT_MISSING_BINARY_IMGS_TAG = "SessionMissingBinaryImages";
|
|
static final String SESSION_FATAL_TAG = "SessionCrash";
|
|
static final FilenameFilter SESSION_FILE_FILTER;
|
|
private static final Pattern SESSION_FILE_PATTERN;
|
|
private static final int SESSION_ID_LENGTH = 35;
|
|
static final String SESSION_NON_FATAL_TAG = "SessionEvent";
|
|
static final String SESSION_OS_TAG = "SessionOS";
|
|
static final String SESSION_USER_TAG = "SessionUser";
|
|
static final Comparator<File> SMALLEST_FILE_NAME_FIRST;
|
|
private static long b;
|
|
private static int e;
|
|
private final AnalyticsConnector analyticsConnector;
|
|
private final AnalyticsReceiver analyticsReceiver;
|
|
private final AppData appData;
|
|
private final CrashlyticsBackgroundWorker backgroundWorker;
|
|
private final Context context;
|
|
private CrashlyticsUncaughtExceptionHandler crashHandler;
|
|
private final CrashlyticsFileMarker crashMarker;
|
|
private final DataCollectionArbiter dataCollectionArbiter;
|
|
private final FileStore fileStore;
|
|
private final ReportUploader.HandlingExceptionCheck handlingExceptionCheck;
|
|
private final HttpRequestFactory httpRequestFactory;
|
|
private final IdManager idManager;
|
|
private final LogFileDirectoryProvider logFileDirectoryProvider;
|
|
private final LogFileManager logFileManager;
|
|
private final CrashlyticsNativeComponent nativeComponent;
|
|
private final ReportManager reportManager;
|
|
private final ReportUploader.Provider reportUploaderProvider;
|
|
private final SessionReportingCoordinator reportingCoordinator;
|
|
private final StackTraceTrimmingStrategy stackTraceTrimmingStrategy;
|
|
private final String unityVersion;
|
|
private final UserMetadata userMetadata;
|
|
private static final byte[] $$a = {Ascii.US, -107, 35, 49};
|
|
private static final int $$b = CipherSuite.TLS_DH_DSS_WITH_AES_256_GCM_SHA384;
|
|
private static int $10 = 0;
|
|
private static int $11 = 1;
|
|
private static int a = 0;
|
|
private final AtomicInteger eventCounter = new AtomicInteger(0);
|
|
TaskCompletionSource<Boolean> unsentReportsAvailable = new TaskCompletionSource<>();
|
|
TaskCompletionSource<Boolean> reportActionProvided = new TaskCompletionSource<>();
|
|
TaskCompletionSource<Void> unsentReportsHandled = new TaskCompletionSource<>();
|
|
AtomicBoolean checkForUnsentReportsCalled = new AtomicBoolean(false);
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public interface CodedOutputStreamWriteAction {
|
|
void writeTo(CodedOutputStream codedOutputStream) throws Exception;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:10:0x0027 */
|
|
/* JADX WARN: Removed duplicated region for block: B:7:0x001f */
|
|
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0027 -> B:4:0x0030). Please report as a decompilation issue!!! */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static void f(int r6, short r7, int r8, java.lang.Object[] r9) {
|
|
/*
|
|
int r7 = r7 * 4
|
|
int r0 = 1 - r7
|
|
byte[] r1 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.$$a
|
|
int r6 = r6 + 4
|
|
int r8 = r8 * 2
|
|
int r8 = 121 - r8
|
|
byte[] r0 = new byte[r0]
|
|
r2 = 0
|
|
int r7 = 0 - r7
|
|
if (r1 != 0) goto L17
|
|
r8 = r6
|
|
r3 = r7
|
|
r4 = r2
|
|
goto L30
|
|
L17:
|
|
r3 = r2
|
|
L18:
|
|
int r6 = r6 + 1
|
|
byte r4 = (byte) r8
|
|
r0[r3] = r4
|
|
if (r3 != r7) goto L27
|
|
java.lang.String r6 = new java.lang.String
|
|
r6.<init>(r0, r2)
|
|
r9[r2] = r6
|
|
return
|
|
L27:
|
|
int r3 = r3 + 1
|
|
r4 = r1[r6]
|
|
r5 = r8
|
|
r8 = r6
|
|
r6 = r4
|
|
r4 = r3
|
|
r3 = r5
|
|
L30:
|
|
int r6 = -r6
|
|
int r6 = r6 + r3
|
|
r3 = r4
|
|
r5 = r8
|
|
r8 = r6
|
|
r6 = r5
|
|
goto L18
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.crashlytics.internal.common.CrashlyticsController.f(int, short, int, java.lang.Object[]):void");
|
|
}
|
|
|
|
private static void c(char[] cArr, int i, Object[] objArr) {
|
|
int i2 = 2 % 2;
|
|
GuL guL = new GuL();
|
|
char[] a2 = GuL.a(b ^ (-7538262848231253921L), cArr, i);
|
|
int i3 = 4;
|
|
guL.a = 4;
|
|
while (guL.a < a2.length) {
|
|
int i4 = $11 + 117;
|
|
$10 = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
guL.c = guL.a - i3;
|
|
int i6 = guL.a;
|
|
try {
|
|
Object[] objArr2 = {Long.valueOf(a2[guL.a] ^ a2[guL.a % i3]), Long.valueOf(guL.c), Long.valueOf(b)};
|
|
Object obj = xzZ.y.get(428080616);
|
|
if (obj == null) {
|
|
Class cls = (Class) xzZ.c(208 - TextUtils.indexOf("", "", 0, 0), 5 - Color.blue(0), (char) (1706 - (ViewConfiguration.getKeyRepeatTimeout() >> 16)));
|
|
byte b2 = (byte) (-1);
|
|
byte b3 = (byte) (b2 + 1);
|
|
Object[] objArr3 = new Object[1];
|
|
f(b2, b3, (byte) (b3 + 1), objArr3);
|
|
obj = cls.getMethod((String) objArr3[0], Long.TYPE, Long.TYPE, Long.TYPE);
|
|
xzZ.y.put(428080616, obj);
|
|
}
|
|
a2[i6] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue();
|
|
try {
|
|
Object[] objArr4 = {guL, guL};
|
|
Object obj2 = xzZ.y.get(-1875914398);
|
|
if (obj2 == null) {
|
|
Class cls2 = (Class) xzZ.c(ExpandableListView.getPackedPositionType(0L) + 392, View.MeasureSpec.getMode(0) + 5, (char) TextUtils.getTrimmedLength(""));
|
|
byte b4 = (byte) (-1);
|
|
byte b5 = (byte) (b4 + 1);
|
|
Object[] objArr5 = new Object[1];
|
|
f(b4, b5, b5, objArr5);
|
|
obj2 = cls2.getMethod((String) objArr5[0], Object.class, Object.class);
|
|
xzZ.y.put(-1875914398, obj2);
|
|
}
|
|
((Method) obj2).invoke(null, objArr4);
|
|
int i7 = $11 + 65;
|
|
$10 = i7 % 128;
|
|
int i8 = i7 % 2;
|
|
i3 = 4;
|
|
} catch (Throwable th) {
|
|
Throwable cause = th.getCause();
|
|
if (cause == null) {
|
|
throw th;
|
|
}
|
|
throw cause;
|
|
}
|
|
} catch (Throwable th2) {
|
|
Throwable cause2 = th2.getCause();
|
|
if (cause2 == null) {
|
|
throw th2;
|
|
}
|
|
throw cause2;
|
|
}
|
|
}
|
|
objArr[0] = new String(a2, 4, a2.length - 4);
|
|
}
|
|
|
|
static /* synthetic */ void access$1000(CrashlyticsController crashlyticsController, AppSettingsData appSettingsData, boolean z) throws Exception {
|
|
int i = 2 % 2;
|
|
int i2 = e + 11;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
crashlyticsController.sendSessionReports(appSettingsData, z);
|
|
int i4 = a + 7;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
}
|
|
|
|
static /* synthetic */ ReportManager access$1100(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 65;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
ReportManager reportManager = crashlyticsController.reportManager;
|
|
if (i3 != 0) {
|
|
return reportManager;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ void access$1200(String str, File file) throws Exception {
|
|
int i = 2 % 2;
|
|
int i2 = a + 33;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
appendOrganizationIdToSessionFile(str, file);
|
|
int i4 = e + 29;
|
|
a = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
int i5 = 97 / 0;
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ ReportUploader.Provider access$1300(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = e;
|
|
int i3 = i2 + 13;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
ReportUploader.Provider provider = crashlyticsController.reportUploaderProvider;
|
|
int i5 = i2 + 71;
|
|
a = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return provider;
|
|
}
|
|
|
|
static /* synthetic */ CreateReportSpiCall access$1400(CrashlyticsController crashlyticsController, String str, String str2) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 85;
|
|
e = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
return crashlyticsController.getCreateReportSpiCall(str, str2);
|
|
}
|
|
crashlyticsController.getCreateReportSpiCall(str, str2);
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ AppData access$1500(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 87;
|
|
int i3 = i2 % 128;
|
|
e = i3;
|
|
int i4 = i2 % 2;
|
|
AppData appData = crashlyticsController.appData;
|
|
if (i4 == 0) {
|
|
int i5 = 24 / 0;
|
|
}
|
|
int i6 = i3 + 117;
|
|
a = i6 % 128;
|
|
if (i6 % 2 == 0) {
|
|
return appData;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ ReportUploader.HandlingExceptionCheck access$1600(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 19;
|
|
int i3 = i2 % 128;
|
|
a = i3;
|
|
int i4 = i2 % 2;
|
|
ReportUploader.HandlingExceptionCheck handlingExceptionCheck = crashlyticsController.handlingExceptionCheck;
|
|
if (i4 != 0) {
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
int i5 = i3 + 35;
|
|
e = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return handlingExceptionCheck;
|
|
}
|
|
|
|
static /* synthetic */ LogFileManager access$1700(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a;
|
|
int i3 = i2 + 107;
|
|
e = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
Object obj = null;
|
|
LogFileManager logFileManager = crashlyticsController.logFileManager;
|
|
if (i4 == 0) {
|
|
throw null;
|
|
}
|
|
int i5 = i2 + 87;
|
|
e = i5 % 128;
|
|
if (i5 % 2 != 0) {
|
|
return logFileManager;
|
|
}
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ void access$1800(CrashlyticsController crashlyticsController, Thread thread, Throwable th, long j) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 71;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
crashlyticsController.doWriteNonFatal(thread, th, j);
|
|
int i4 = e + 77;
|
|
a = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
int i5 = 51 / 0;
|
|
}
|
|
}
|
|
|
|
static /* synthetic */ String access$1900(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 37;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
String currentSessionId = crashlyticsController.getCurrentSessionId();
|
|
int i4 = a + 77;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return currentSessionId;
|
|
}
|
|
|
|
static /* synthetic */ File[] access$2100(CrashlyticsController crashlyticsController, FilenameFilter filenameFilter) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 101;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] listFilesMatching = crashlyticsController.listFilesMatching(filenameFilter);
|
|
int i4 = a + 91;
|
|
e = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
int i5 = 44 / 0;
|
|
}
|
|
return listFilesMatching;
|
|
}
|
|
|
|
static /* synthetic */ String access$2200(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 77;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
String str = crashlyticsController.unityVersion;
|
|
if (i3 == 0) {
|
|
return str;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ boolean access$2300(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 65;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
boolean firebaseCrashExists = crashlyticsController.firebaseCrashExists();
|
|
if (i3 == 0) {
|
|
int i4 = 2 / 0;
|
|
}
|
|
return firebaseCrashExists;
|
|
}
|
|
|
|
static /* synthetic */ AnalyticsConnector access$2400(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 123;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
AnalyticsConnector analyticsConnector = crashlyticsController.analyticsConnector;
|
|
if (i3 == 0) {
|
|
return analyticsConnector;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ AnalyticsReceiver access$2600(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 105;
|
|
int i3 = i2 % 128;
|
|
a = i3;
|
|
int i4 = i2 % 2;
|
|
AnalyticsReceiver analyticsReceiver = crashlyticsController.analyticsReceiver;
|
|
int i5 = i3 + 103;
|
|
e = i5 % 128;
|
|
if (i5 % 2 == 0) {
|
|
int i6 = 10 / 0;
|
|
}
|
|
return analyticsReceiver;
|
|
}
|
|
|
|
static /* synthetic */ CrashlyticsFileMarker access$300(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 53;
|
|
int i3 = i2 % 128;
|
|
e = i3;
|
|
int i4 = i2 % 2;
|
|
CrashlyticsFileMarker crashlyticsFileMarker = crashlyticsController.crashMarker;
|
|
int i5 = i3 + 27;
|
|
a = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return crashlyticsFileMarker;
|
|
}
|
|
|
|
static /* synthetic */ long access$400(Date date) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 119;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
long timestampSeconds = getTimestampSeconds(date);
|
|
int i4 = e + 35;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return timestampSeconds;
|
|
}
|
|
|
|
static /* synthetic */ SessionReportingCoordinator access$500(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a;
|
|
int i3 = i2 + 25;
|
|
e = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
SessionReportingCoordinator sessionReportingCoordinator = crashlyticsController.reportingCoordinator;
|
|
int i5 = i2 + 23;
|
|
e = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return sessionReportingCoordinator;
|
|
}
|
|
|
|
static /* synthetic */ void access$600(CrashlyticsController crashlyticsController, Thread thread, Throwable th, long j) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 85;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
crashlyticsController.writeFatal(thread, th, j);
|
|
if (i3 == 0) {
|
|
return;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ void access$700(CrashlyticsController crashlyticsController) throws Exception {
|
|
int i = 2 % 2;
|
|
int i2 = e + 101;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
crashlyticsController.doOpenSession();
|
|
if (i3 != 0) {
|
|
throw null;
|
|
}
|
|
int i4 = a + 19;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
}
|
|
|
|
static /* synthetic */ DataCollectionArbiter access$800(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 51;
|
|
int i3 = i2 % 128;
|
|
e = i3;
|
|
int i4 = i2 % 2;
|
|
Object obj = null;
|
|
DataCollectionArbiter dataCollectionArbiter = crashlyticsController.dataCollectionArbiter;
|
|
if (i4 == 0) {
|
|
throw null;
|
|
}
|
|
int i5 = i3 + 43;
|
|
a = i5 % 128;
|
|
if (i5 % 2 == 0) {
|
|
return dataCollectionArbiter;
|
|
}
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
static /* synthetic */ CrashlyticsBackgroundWorker access$900(CrashlyticsController crashlyticsController) {
|
|
int i = 2 % 2;
|
|
int i2 = e;
|
|
int i3 = i2 + 43;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
CrashlyticsBackgroundWorker crashlyticsBackgroundWorker = crashlyticsController.backgroundWorker;
|
|
int i5 = i2 + 35;
|
|
a = i5 % 128;
|
|
if (i5 % 2 == 0) {
|
|
return crashlyticsBackgroundWorker;
|
|
}
|
|
throw null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static class FileNameContainsFilter implements FilenameFilter {
|
|
private final String string;
|
|
|
|
public FileNameContainsFilter(String str) {
|
|
this.string = str;
|
|
}
|
|
|
|
@Override // java.io.FilenameFilter
|
|
public boolean accept(File file, String str) {
|
|
return str.contains(this.string) && !str.endsWith(ClsFileOutputStream.IN_PROGRESS_SESSION_FILE_EXTENSION);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static class SessionPartFileFilter implements FilenameFilter {
|
|
private final String sessionId;
|
|
|
|
public SessionPartFileFilter(String str) {
|
|
this.sessionId = str;
|
|
}
|
|
|
|
@Override // java.io.FilenameFilter
|
|
public boolean accept(File file, String str) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.sessionId);
|
|
sb.append(ClsFileOutputStream.SESSION_FILE_EXTENSION);
|
|
return (str.equals(sb.toString()) || !str.contains(this.sessionId) || str.endsWith(ClsFileOutputStream.IN_PROGRESS_SESSION_FILE_EXTENSION)) ? false : true;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static class AnySessionPartFileFilter implements FilenameFilter {
|
|
private AnySessionPartFileFilter() {
|
|
}
|
|
|
|
@Override // java.io.FilenameFilter
|
|
public boolean accept(File file, String str) {
|
|
return !CrashlyticsController.SESSION_FILE_FILTER.accept(file, str) && CrashlyticsController.access$000().matcher(str).matches();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static class InvalidPartFileFilter implements FilenameFilter {
|
|
InvalidPartFileFilter() {
|
|
}
|
|
|
|
@Override // java.io.FilenameFilter
|
|
public boolean accept(File file, String str) {
|
|
return ClsFileOutputStream.TEMP_FILENAME_FILTER.accept(file, str) || str.contains(CrashlyticsController.SESSION_EVENT_MISSING_BINARY_IMGS_TAG);
|
|
}
|
|
}
|
|
|
|
static {
|
|
e = 1;
|
|
d();
|
|
SESSION_BEGIN_FILE_FILTER = new FileNameContainsFilter(SESSION_BEGIN_TAG) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.1
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsController.FileNameContainsFilter, java.io.FilenameFilter
|
|
public boolean accept(File file, String str) {
|
|
return super.accept(file, str) && str.endsWith(ClsFileOutputStream.SESSION_FILE_EXTENSION);
|
|
}
|
|
};
|
|
SESSION_FILE_FILTER = new FilenameFilter() { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.2
|
|
@Override // java.io.FilenameFilter
|
|
public boolean accept(File file, String str) {
|
|
return str.length() == 39 && str.endsWith(ClsFileOutputStream.SESSION_FILE_EXTENSION);
|
|
}
|
|
};
|
|
LARGEST_FILE_NAME_FIRST = new Comparator<File>() { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.3
|
|
@Override // java.util.Comparator
|
|
public int compare(File file, File file2) {
|
|
return file2.getName().compareTo(file.getName());
|
|
}
|
|
};
|
|
SMALLEST_FILE_NAME_FIRST = new Comparator<File>() { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.4
|
|
@Override // java.util.Comparator
|
|
public int compare(File file, File file2) {
|
|
return file.getName().compareTo(file2.getName());
|
|
}
|
|
};
|
|
SESSION_FILE_PATTERN = Pattern.compile("([\\d|A-Z|a-z]{12}\\-[\\d|A-Z|a-z]{4}\\-[\\d|A-Z|a-z]{4}\\-[\\d|A-Z|a-z]{12}).+");
|
|
Object[] objArr = new Object[1];
|
|
c(new char[]{27003, 26954, 60252, 22351, 17502}, Drawable.resolveOpacity(0, 0), objArr);
|
|
SEND_AT_CRASHTIME_HEADER = Collections.singletonMap("X-CRASHLYTICS-SEND-FLAGS", ((String) objArr[0]).intern());
|
|
INITIAL_SESSION_PART_TAGS = new String[]{SESSION_USER_TAG, SESSION_APP_TAG, SESSION_OS_TAG, SESSION_DEVICE_TAG};
|
|
int i = a + 39;
|
|
e = i % 128;
|
|
if (i % 2 == 0) {
|
|
int i2 = 89 / 0;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public CrashlyticsController(Context context, CrashlyticsBackgroundWorker crashlyticsBackgroundWorker, HttpRequestFactory httpRequestFactory, IdManager idManager, DataCollectionArbiter dataCollectionArbiter, FileStore fileStore, CrashlyticsFileMarker crashlyticsFileMarker, AppData appData, ReportManager reportManager, ReportUploader.Provider provider, CrashlyticsNativeComponent crashlyticsNativeComponent, UnityVersionProvider unityVersionProvider, AnalyticsReceiver analyticsReceiver, AnalyticsConnector analyticsConnector, SettingsDataProvider settingsDataProvider) {
|
|
int i;
|
|
this.context = context;
|
|
this.backgroundWorker = crashlyticsBackgroundWorker;
|
|
this.httpRequestFactory = httpRequestFactory;
|
|
this.idManager = idManager;
|
|
this.dataCollectionArbiter = dataCollectionArbiter;
|
|
this.fileStore = fileStore;
|
|
this.crashMarker = crashlyticsFileMarker;
|
|
this.appData = appData;
|
|
if (provider == null) {
|
|
this.reportUploaderProvider = defaultReportUploader();
|
|
i = e + 53;
|
|
} else {
|
|
this.reportUploaderProvider = provider;
|
|
i = e + 17;
|
|
}
|
|
a = i % 128;
|
|
int i2 = i % 2;
|
|
int i3 = 2 % 2;
|
|
this.nativeComponent = crashlyticsNativeComponent;
|
|
this.unityVersion = unityVersionProvider.getUnityVersion();
|
|
this.analyticsReceiver = analyticsReceiver;
|
|
this.analyticsConnector = analyticsConnector;
|
|
UserMetadata userMetadata = new UserMetadata();
|
|
this.userMetadata = userMetadata;
|
|
LogFileDirectoryProvider logFileDirectoryProvider = new LogFileDirectoryProvider(fileStore);
|
|
this.logFileDirectoryProvider = logFileDirectoryProvider;
|
|
LogFileManager logFileManager = new LogFileManager(context, logFileDirectoryProvider);
|
|
this.logFileManager = logFileManager;
|
|
this.reportManager = reportManager == null ? new ReportManager(new ReportUploaderFilesProvider()) : reportManager;
|
|
this.handlingExceptionCheck = new ReportUploaderHandlingExceptionCheck();
|
|
MiddleOutFallbackStrategy middleOutFallbackStrategy = new MiddleOutFallbackStrategy(1024, new RemoveRepeatsStrategy(10));
|
|
this.stackTraceTrimmingStrategy = middleOutFallbackStrategy;
|
|
this.reportingCoordinator = SessionReportingCoordinator.create(context, idManager, fileStore, appData, logFileManager, userMetadata, middleOutFallbackStrategy, settingsDataProvider);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void enableExceptionHandling(Thread.UncaughtExceptionHandler uncaughtExceptionHandler, SettingsDataProvider settingsDataProvider) {
|
|
int i = 2 % 2;
|
|
openSession();
|
|
CrashlyticsUncaughtExceptionHandler crashlyticsUncaughtExceptionHandler = new CrashlyticsUncaughtExceptionHandler(new CrashlyticsUncaughtExceptionHandler.CrashListener(this) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.5
|
|
final CrashlyticsController this$0;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsUncaughtExceptionHandler.CrashListener
|
|
public void onUncaughtException(SettingsDataProvider settingsDataProvider2, Thread thread, Throwable th) {
|
|
this.this$0.handleUncaughtException(settingsDataProvider2, thread, th);
|
|
}
|
|
}, settingsDataProvider, uncaughtExceptionHandler);
|
|
this.crashHandler = crashlyticsUncaughtExceptionHandler;
|
|
Thread.setDefaultUncaughtExceptionHandler(crashlyticsUncaughtExceptionHandler);
|
|
int i2 = a + 7;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
}
|
|
|
|
void handleUncaughtException(SettingsDataProvider settingsDataProvider, Thread thread, Throwable th) {
|
|
synchronized (this) {
|
|
Logger logger = Logger.getLogger();
|
|
StringBuilder sb = new StringBuilder("Crashlytics is handling uncaught exception \"");
|
|
sb.append(th);
|
|
sb.append("\" from thread ");
|
|
sb.append(thread.getName());
|
|
logger.d(sb.toString());
|
|
Date date = new Date();
|
|
try {
|
|
Utils.awaitEvenIfOnMainThread(this.backgroundWorker.submitTask(new AnonymousClass6(this, date, th, thread, settingsDataProvider, recordFatalFirebaseEvent(date.getTime()))));
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: com.google.firebase.crashlytics.internal.common.CrashlyticsController$6, reason: invalid class name */
|
|
/* loaded from: classes2.dex */
|
|
public class AnonymousClass6 implements Callable<Task<Void>> {
|
|
final CrashlyticsController this$0;
|
|
final Throwable val$ex;
|
|
final Task val$recordFatalFirebaseEventTask;
|
|
final SettingsDataProvider val$settingsDataProvider;
|
|
final Thread val$thread;
|
|
final Date val$time;
|
|
|
|
AnonymousClass6(CrashlyticsController crashlyticsController, Date date, Throwable th, Thread thread, SettingsDataProvider settingsDataProvider, Task task) {
|
|
this.this$0 = crashlyticsController;
|
|
this.val$time = date;
|
|
this.val$ex = th;
|
|
this.val$thread = thread;
|
|
this.val$settingsDataProvider = settingsDataProvider;
|
|
this.val$recordFatalFirebaseEventTask = task;
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // java.util.concurrent.Callable
|
|
public Task<Void> call() throws Exception {
|
|
CrashlyticsController.access$300(this.this$0).create();
|
|
long access$400 = CrashlyticsController.access$400(this.val$time);
|
|
CrashlyticsController.access$500(this.this$0).persistFatalEvent(this.val$ex, this.val$thread, access$400);
|
|
CrashlyticsController.access$600(this.this$0, this.val$thread, this.val$ex, access$400);
|
|
Settings settings = this.val$settingsDataProvider.getSettings();
|
|
int i = settings.getSessionData().maxCustomExceptionEvents;
|
|
int i2 = settings.getSessionData().maxCompleteSessionsCount;
|
|
this.this$0.doCloseSessions(i);
|
|
CrashlyticsController.access$700(this.this$0);
|
|
this.this$0.trimSessionFiles(i2);
|
|
if (!CrashlyticsController.access$800(this.this$0).isAutomaticDataCollectionEnabled()) {
|
|
return Tasks.forResult(null);
|
|
}
|
|
Executor executor = CrashlyticsController.access$900(this.this$0).getExecutor();
|
|
return this.val$settingsDataProvider.getAppSettings().onSuccessTask(executor, new SuccessContinuation<AppSettingsData, Void>(this, executor) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.6.1
|
|
final AnonymousClass6 this$1;
|
|
final Executor val$executor;
|
|
|
|
{
|
|
this.this$1 = this;
|
|
this.val$executor = executor;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.SuccessContinuation
|
|
public Task<Void> then(AppSettingsData appSettingsData) throws Exception {
|
|
if (appSettingsData == null) {
|
|
Logger.getLogger().w("Received null app settings, cannot send reports at crash time.");
|
|
return Tasks.forResult(null);
|
|
}
|
|
CrashlyticsController.access$1000(this.this$1.this$0, appSettingsData, true);
|
|
return Tasks.whenAll((Task<?>[]) new Task[]{CrashlyticsController.access$500(this.this$1.this$0).sendReports(this.val$executor, DataTransportState.getState(appSettingsData)), this.this$1.val$recordFatalFirebaseEventTask});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
private Task<Boolean> waitForReportAction() {
|
|
int i = 2 % 2;
|
|
int i2 = e + 63;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
boolean isAutomaticDataCollectionEnabled = this.dataCollectionArbiter.isAutomaticDataCollectionEnabled();
|
|
Boolean bool = Boolean.TRUE;
|
|
if (!isAutomaticDataCollectionEnabled) {
|
|
Logger.getLogger().d("Automatic data collection is disabled.");
|
|
Logger.getLogger().d("Notifying that unsent reports are available.");
|
|
this.unsentReportsAvailable.trySetResult(bool);
|
|
Task<TContinuationResult> onSuccessTask = this.dataCollectionArbiter.waitForAutomaticDataCollectionEnabled().onSuccessTask(new SuccessContinuation<Void, Boolean>(this) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.7
|
|
final CrashlyticsController this$0;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.SuccessContinuation
|
|
public Task<Boolean> then(Void r1) throws Exception {
|
|
return Tasks.forResult(Boolean.TRUE);
|
|
}
|
|
});
|
|
Logger.getLogger().d("Waiting for send/deleteUnsentReports to be called.");
|
|
return Utils.race(onSuccessTask, this.reportActionProvided.getTask());
|
|
}
|
|
int i4 = e + 29;
|
|
a = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
Logger.getLogger().d("Automatic data collection is enabled. Allowing upload.");
|
|
this.unsentReportsAvailable.trySetResult(Boolean.FALSE);
|
|
return Tasks.forResult(bool);
|
|
}
|
|
Logger.getLogger().d("Automatic data collection is enabled. Allowing upload.");
|
|
this.unsentReportsAvailable.trySetResult(Boolean.FALSE);
|
|
Tasks.forResult(bool);
|
|
throw null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public boolean didCrashOnPreviousExecution() {
|
|
int i = 2 % 2;
|
|
boolean z = true;
|
|
if (this.crashMarker.isPresent()) {
|
|
Logger.getLogger().d("Found previous crash marker.");
|
|
this.crashMarker.remove();
|
|
return true;
|
|
}
|
|
int i2 = e + 97;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
if (getCurrentSessionId() == null || (!this.nativeComponent.hasCrashDataForSession(r1))) {
|
|
z = false;
|
|
} else {
|
|
int i4 = e + 119;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
}
|
|
int i6 = e + 117;
|
|
a = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
return z;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public Task<Boolean> checkForUnsentReports() {
|
|
int i = 2 % 2;
|
|
int i2 = a + 69;
|
|
e = i2 % 128;
|
|
if (i2 % 2 != 0 ? this.checkForUnsentReportsCalled.compareAndSet(false, true) : this.checkForUnsentReportsCalled.compareAndSet(false, true)) {
|
|
return this.unsentReportsAvailable.getTask();
|
|
}
|
|
int i3 = e + 81;
|
|
a = i3 % 128;
|
|
if (i3 % 2 == 0) {
|
|
Logger.getLogger().d("checkForUnsentReports should only be called once per execution.");
|
|
return Tasks.forResult(Boolean.FALSE);
|
|
}
|
|
Logger.getLogger().d("checkForUnsentReports should only be called once per execution.");
|
|
Tasks.forResult(Boolean.FALSE);
|
|
throw null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public Task<Void> sendUnsentReports() {
|
|
int i = 2 % 2;
|
|
int i2 = e + 23;
|
|
a = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
this.reportActionProvided.trySetResult(Boolean.TRUE);
|
|
return this.unsentReportsHandled.getTask();
|
|
}
|
|
this.reportActionProvided.trySetResult(Boolean.TRUE);
|
|
this.unsentReportsHandled.getTask();
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public Task<Void> deleteUnsentReports() {
|
|
Task<Void> task;
|
|
int i = 2 % 2;
|
|
int i2 = a + 59;
|
|
e = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
this.reportActionProvided.trySetResult(Boolean.FALSE);
|
|
task = this.unsentReportsHandled.getTask();
|
|
int i3 = 23 / 0;
|
|
} else {
|
|
this.reportActionProvided.trySetResult(Boolean.FALSE);
|
|
task = this.unsentReportsHandled.getTask();
|
|
}
|
|
int i4 = e + 89;
|
|
a = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
return task;
|
|
}
|
|
throw null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: com.google.firebase.crashlytics.internal.common.CrashlyticsController$8, reason: invalid class name */
|
|
/* loaded from: classes2.dex */
|
|
public class AnonymousClass8 implements SuccessContinuation<Boolean, Void> {
|
|
final CrashlyticsController this$0;
|
|
final Task val$appSettingsDataTask;
|
|
final float val$delay;
|
|
|
|
AnonymousClass8(CrashlyticsController crashlyticsController, Task task, float f) {
|
|
this.this$0 = crashlyticsController;
|
|
this.val$appSettingsDataTask = task;
|
|
this.val$delay = f;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: com.google.firebase.crashlytics.internal.common.CrashlyticsController$8$1, reason: invalid class name */
|
|
/* loaded from: classes2.dex */
|
|
public class AnonymousClass1 implements Callable<Task<Void>> {
|
|
final AnonymousClass8 this$1;
|
|
final Boolean val$send;
|
|
|
|
AnonymousClass1(AnonymousClass8 anonymousClass8, Boolean bool) {
|
|
this.this$1 = anonymousClass8;
|
|
this.val$send = bool;
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // java.util.concurrent.Callable
|
|
public Task<Void> call() throws Exception {
|
|
List<Report> findReports = CrashlyticsController.access$1100(this.this$1.this$0).findReports();
|
|
if (!this.val$send.booleanValue()) {
|
|
Logger.getLogger().d("Reports are being deleted.");
|
|
CrashlyticsController.access$1100(this.this$1.this$0).deleteReports(findReports);
|
|
CrashlyticsController.access$500(this.this$1.this$0).removeAllReports();
|
|
this.this$1.this$0.unsentReportsHandled.trySetResult(null);
|
|
return Tasks.forResult(null);
|
|
}
|
|
Logger.getLogger().d("Reports are being sent.");
|
|
boolean booleanValue = this.val$send.booleanValue();
|
|
CrashlyticsController.access$800(this.this$1.this$0).grantDataCollectionPermission(booleanValue);
|
|
Executor executor = CrashlyticsController.access$900(this.this$1.this$0).getExecutor();
|
|
return this.this$1.val$appSettingsDataTask.onSuccessTask(executor, new SuccessContinuation<AppSettingsData, Void>(this, findReports, booleanValue, executor) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.8.1.1
|
|
final AnonymousClass1 this$2;
|
|
final boolean val$dataCollectionToken;
|
|
final Executor val$executor;
|
|
final List val$reports;
|
|
|
|
{
|
|
this.this$2 = this;
|
|
this.val$reports = findReports;
|
|
this.val$dataCollectionToken = booleanValue;
|
|
this.val$executor = executor;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.SuccessContinuation
|
|
public Task<Void> then(AppSettingsData appSettingsData) throws Exception {
|
|
if (appSettingsData == null) {
|
|
Logger.getLogger().w("Received null app settings, cannot send reports during app startup.");
|
|
return Tasks.forResult(null);
|
|
}
|
|
for (Report report : this.val$reports) {
|
|
if (report.getType() == Report.Type.JAVA) {
|
|
CrashlyticsController.access$1200(appSettingsData.organizationId, report.getFile());
|
|
}
|
|
}
|
|
CrashlyticsController.access$1300(this.this$2.this$1.this$0).createReportUploader(appSettingsData).uploadReportsAsync(this.val$reports, this.val$dataCollectionToken, this.this$2.this$1.val$delay);
|
|
CrashlyticsController.access$500(this.this$2.this$1.this$0).sendReports(this.val$executor, DataTransportState.getState(appSettingsData));
|
|
this.this$2.this$1.this$0.unsentReportsHandled.trySetResult(null);
|
|
return Tasks.forResult(null);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.SuccessContinuation
|
|
public Task<Void> then(Boolean bool) throws Exception {
|
|
return CrashlyticsController.access$900(this.this$0).submitTask(new AnonymousClass1(this, bool));
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public Task<Void> submitAllReports(float f, Task<AppSettingsData> task) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 53;
|
|
a = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
if (!this.reportManager.areReportsAvailable()) {
|
|
Logger.getLogger().d("No reports are available.");
|
|
this.unsentReportsAvailable.trySetResult(Boolean.FALSE);
|
|
return Tasks.forResult(null);
|
|
}
|
|
Logger.getLogger().d("Unsent reports are available.");
|
|
Task onSuccessTask = waitForReportAction().onSuccessTask(new AnonymousClass8(this, task, f));
|
|
int i3 = e + 91;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
return onSuccessTask;
|
|
}
|
|
this.reportManager.areReportsAvailable();
|
|
throw null;
|
|
}
|
|
|
|
private ReportUploader.Provider defaultReportUploader() {
|
|
int i = 2 % 2;
|
|
ReportUploader.Provider provider = new ReportUploader.Provider(this) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.9
|
|
final CrashlyticsController this$0;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.report.ReportUploader.Provider
|
|
public ReportUploader createReportUploader(AppSettingsData appSettingsData) {
|
|
String str = appSettingsData.reportsUrl;
|
|
String str2 = appSettingsData.ndkReportsUrl;
|
|
return new ReportUploader(appSettingsData.organizationId, CrashlyticsController.access$1500(this.this$0).googleAppId, DataTransportState.getState(appSettingsData), CrashlyticsController.access$1100(this.this$0), CrashlyticsController.access$1400(this.this$0, str, str2), CrashlyticsController.access$1600(this.this$0));
|
|
}
|
|
};
|
|
int i2 = a + 59;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return provider;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void writeToLog(long j, String str) {
|
|
int i = 2 % 2;
|
|
this.backgroundWorker.submit(new Callable<Void>(this, j, str) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.10
|
|
final CrashlyticsController this$0;
|
|
final String val$msg;
|
|
final long val$timestamp;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$timestamp = j;
|
|
this.val$msg = str;
|
|
}
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public Void call() throws Exception {
|
|
if (this.this$0.isHandlingException()) {
|
|
return null;
|
|
}
|
|
CrashlyticsController.access$1700(this.this$0).writeToLog(this.val$timestamp, this.val$msg);
|
|
return null;
|
|
}
|
|
});
|
|
int i2 = e + 105;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
int i3 = 67 / 0;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void writeNonFatalException(Thread thread, Throwable th) {
|
|
int i = 2 % 2;
|
|
this.backgroundWorker.submit(new Runnable(this, new Date(), th, thread) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.11
|
|
final CrashlyticsController this$0;
|
|
final Throwable val$ex;
|
|
final Thread val$thread;
|
|
final Date val$time;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$time = r2;
|
|
this.val$ex = th;
|
|
this.val$thread = thread;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (this.this$0.isHandlingException()) {
|
|
return;
|
|
}
|
|
long access$400 = CrashlyticsController.access$400(this.val$time);
|
|
CrashlyticsController.access$500(this.this$0).persistNonFatalEvent(this.val$ex, this.val$thread, access$400);
|
|
CrashlyticsController.access$1800(this.this$0, this.val$thread, this.val$ex, access$400);
|
|
}
|
|
});
|
|
int i2 = e + 37;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void setUserId(String str) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 65;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
this.userMetadata.setUserId(str);
|
|
cacheUserData(this.userMetadata);
|
|
int i3 = 28 / 0;
|
|
} else {
|
|
this.userMetadata.setUserId(str);
|
|
cacheUserData(this.userMetadata);
|
|
}
|
|
int i4 = e + 123;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void setCustomKey(String str, String str2) {
|
|
int i = 2 % 2;
|
|
try {
|
|
this.userMetadata.setCustomKey(str, str2);
|
|
cacheKeyData(this.userMetadata.getCustomKeys());
|
|
} catch (IllegalArgumentException e2) {
|
|
if (this.context == null || (!CommonUtils.isAppDebuggable(r4))) {
|
|
Logger.getLogger().e("Attempting to set custom attribute with null key, ignoring.");
|
|
int i2 = e + 25;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
int i3 = 33 / 0;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
int i4 = e + 25;
|
|
a = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
throw e2;
|
|
}
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
private void cacheUserData(UserMetadata userMetadata) {
|
|
int i = 2 % 2;
|
|
this.backgroundWorker.submit(new Callable<Void>(this, userMetadata) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.12
|
|
final CrashlyticsController this$0;
|
|
final UserMetadata val$userMetaData;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$userMetaData = userMetadata;
|
|
}
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public Void call() throws Exception {
|
|
CrashlyticsController.access$500(this.this$0).persistUserId();
|
|
new MetaDataStore(this.this$0.getFilesDir()).writeUserData(CrashlyticsController.access$1900(this.this$0), this.val$userMetaData);
|
|
return null;
|
|
}
|
|
});
|
|
int i2 = a + 85;
|
|
e = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
int i3 = 3 / 0;
|
|
}
|
|
}
|
|
|
|
private void cacheKeyData(Map<String, String> map) {
|
|
int i = 2 % 2;
|
|
this.backgroundWorker.submit(new Callable<Void>(this, map) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.13
|
|
final CrashlyticsController this$0;
|
|
final Map val$keyData;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$keyData = map;
|
|
}
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public Void call() throws Exception {
|
|
new MetaDataStore(this.this$0.getFilesDir()).writeKeyData(CrashlyticsController.access$1900(this.this$0), this.val$keyData);
|
|
return null;
|
|
}
|
|
});
|
|
int i2 = a + 81;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
}
|
|
|
|
void openSession() {
|
|
int i = 2 % 2;
|
|
this.backgroundWorker.submit(new Callable<Void>(this) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.14
|
|
final CrashlyticsController this$0;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public Void call() throws Exception {
|
|
CrashlyticsController.access$700(this.this$0);
|
|
return null;
|
|
}
|
|
});
|
|
int i2 = e + 3;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
}
|
|
|
|
private String getCurrentSessionId() {
|
|
int i = 2 % 2;
|
|
int i2 = e + 71;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] listSortedSessionBeginFiles = listSortedSessionBeginFiles();
|
|
if (listSortedSessionBeginFiles.length <= 0) {
|
|
return null;
|
|
}
|
|
String sessionIdFromSessionFile = getSessionIdFromSessionFile(listSortedSessionBeginFiles[0]);
|
|
int i4 = e + 99;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return sessionIdFromSessionFile;
|
|
}
|
|
|
|
private String getPreviousSessionId() {
|
|
String str;
|
|
int i = 2 % 2;
|
|
int i2 = e + 49;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] listSortedSessionBeginFiles = listSortedSessionBeginFiles();
|
|
if (listSortedSessionBeginFiles.length > 1) {
|
|
int i4 = e + 51;
|
|
a = i4 % 128;
|
|
str = getSessionIdFromSessionFile(i4 % 2 != 0 ? listSortedSessionBeginFiles[1] : listSortedSessionBeginFiles[1]);
|
|
} else {
|
|
str = null;
|
|
}
|
|
int i5 = a + 105;
|
|
e = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return str;
|
|
}
|
|
|
|
static String getSessionIdFromSessionFile(File file) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 31;
|
|
a = i2 % 128;
|
|
return file.getName().substring(0, i2 % 2 != 0 ? 36 : 35);
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:11:0x001e, code lost:
|
|
|
|
if (listSessionBeginFiles().length > 0) goto L9;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:4:0x0016, code lost:
|
|
|
|
if (listSessionBeginFiles().length > 0) goto L9;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:5:0x002b, code lost:
|
|
|
|
r1 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.a + 81;
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController.e = r1 % 128;
|
|
r1 = r1 % 2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:6:0x0034, code lost:
|
|
|
|
return false;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:8:0x0020, code lost:
|
|
|
|
r1 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.a + 33;
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController.e = r1 % 128;
|
|
r1 = r1 % 2;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:9:?, code lost:
|
|
|
|
return true;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
boolean hasOpenSession() {
|
|
/*
|
|
r4 = this;
|
|
r0 = 2
|
|
int r1 = r0 % r0
|
|
int r1 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.a
|
|
int r1 = r1 + 33
|
|
int r2 = r1 % 128
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController.e = r2
|
|
int r1 = r1 % r0
|
|
r2 = 0
|
|
if (r1 != 0) goto L19
|
|
java.io.File[] r1 = r4.listSessionBeginFiles()
|
|
int r1 = r1.length
|
|
r3 = 7
|
|
int r3 = r3 / r2
|
|
if (r1 <= 0) goto L2b
|
|
goto L20
|
|
L19:
|
|
java.io.File[] r1 = r4.listSessionBeginFiles()
|
|
int r1 = r1.length
|
|
if (r1 <= 0) goto L2b
|
|
L20:
|
|
int r1 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.a
|
|
int r1 = r1 + 33
|
|
int r2 = r1 % 128
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController.e = r2
|
|
int r1 = r1 % r0
|
|
r2 = 1
|
|
goto L34
|
|
L2b:
|
|
int r1 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.a
|
|
int r1 = r1 + 81
|
|
int r3 = r1 % 128
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController.e = r3
|
|
int r1 = r1 % r0
|
|
L34:
|
|
return r2
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.crashlytics.internal.common.CrashlyticsController.hasOpenSession():boolean");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public boolean finalizeSessions(int i) {
|
|
int i2 = 2 % 2;
|
|
int i3 = e + 77;
|
|
a = i3 % 128;
|
|
if (i3 % 2 == 0) {
|
|
this.backgroundWorker.checkRunningOnThread();
|
|
if (!(!isHandlingException())) {
|
|
Logger.getLogger().d("Skipping session finalization because a crash has already occurred.");
|
|
return false;
|
|
}
|
|
Logger.getLogger().d("Finalizing previously open sessions.");
|
|
try {
|
|
doCloseSessions(i, false);
|
|
Logger.getLogger().d("Closed all previously open sessions");
|
|
int i4 = e + 63;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return true;
|
|
} catch (Exception e2) {
|
|
Logger.getLogger().e("Unable to finalize previously open sessions.", e2);
|
|
return false;
|
|
}
|
|
}
|
|
this.backgroundWorker.checkRunningOnThread();
|
|
isHandlingException();
|
|
throw null;
|
|
}
|
|
|
|
private void doOpenSession() throws Exception {
|
|
int i = 2 % 2;
|
|
long currentTimestampSeconds = getCurrentTimestampSeconds();
|
|
String obj = new CLSUUID(this.idManager).toString();
|
|
Logger.getLogger().d("Opening a new session with ID ".concat(String.valueOf(obj)));
|
|
this.nativeComponent.openSession(obj);
|
|
writeBeginSession(obj, currentTimestampSeconds);
|
|
writeSessionApp(obj);
|
|
writeSessionOS(obj);
|
|
writeSessionDevice(obj);
|
|
this.logFileManager.setCurrentSession(obj);
|
|
this.reportingCoordinator.onBeginSession(makeFirebaseSessionIdentifier(obj), currentTimestampSeconds);
|
|
int i2 = e + 67;
|
|
a = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
return;
|
|
}
|
|
Object obj2 = null;
|
|
obj2.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
void doCloseSessions(int i) throws Exception {
|
|
int i2 = 2 % 2;
|
|
int i3 = e + 117;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
doCloseSessions(i, true);
|
|
}
|
|
|
|
private void doCloseSessions(int i, boolean z) throws Exception {
|
|
int i2 = 2 % 2;
|
|
int i3 = e + 99;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
int i5 = !z ? 1 : 0;
|
|
trimOpenSessions(i5 + 8);
|
|
File[] listSortedSessionBeginFiles = listSortedSessionBeginFiles();
|
|
if (listSortedSessionBeginFiles.length > i5) {
|
|
String sessionIdFromSessionFile = getSessionIdFromSessionFile(listSortedSessionBeginFiles[i5]);
|
|
writeSessionUser(sessionIdFromSessionFile);
|
|
if (z) {
|
|
this.reportingCoordinator.onEndSession();
|
|
} else if (this.nativeComponent.hasCrashDataForSession(sessionIdFromSessionFile)) {
|
|
finalizePreviousNativeSession(sessionIdFromSessionFile);
|
|
if (!this.nativeComponent.finalizeSession(sessionIdFromSessionFile)) {
|
|
int i6 = e + 17;
|
|
a = i6 % 128;
|
|
if (i6 % 2 != 0) {
|
|
Logger.getLogger().d("Could not finalize native session: ".concat(String.valueOf(sessionIdFromSessionFile)));
|
|
int i7 = 27 / 0;
|
|
} else {
|
|
Logger.getLogger().d("Could not finalize native session: ".concat(String.valueOf(sessionIdFromSessionFile)));
|
|
}
|
|
}
|
|
}
|
|
closeOpenSessions(listSortedSessionBeginFiles, i5, i);
|
|
this.reportingCoordinator.finalizeSessions(getCurrentTimestampSeconds());
|
|
return;
|
|
}
|
|
int i8 = e + 9;
|
|
a = i8 % 128;
|
|
if (i8 % 2 == 0) {
|
|
Logger.getLogger().d("No open sessions to be closed.");
|
|
} else {
|
|
Logger.getLogger().d("No open sessions to be closed.");
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
private void closeOpenSessions(File[] fileArr, int i, int i2) {
|
|
int i3 = 2 % 2;
|
|
int i4 = a + 7;
|
|
e = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
Logger.getLogger().d("Closing open sessions.");
|
|
while (i < fileArr.length) {
|
|
int i5 = e + 109;
|
|
a = i5 % 128;
|
|
if (i5 % 2 != 0) {
|
|
File file = fileArr[i];
|
|
String sessionIdFromSessionFile = getSessionIdFromSessionFile(file);
|
|
Logger.getLogger().d("Closing session: ".concat(String.valueOf(sessionIdFromSessionFile)));
|
|
writeSessionPartsToSessionFile(file, sessionIdFromSessionFile, i2);
|
|
i += 44;
|
|
} else {
|
|
File file2 = fileArr[i];
|
|
String sessionIdFromSessionFile2 = getSessionIdFromSessionFile(file2);
|
|
Logger.getLogger().d("Closing session: ".concat(String.valueOf(sessionIdFromSessionFile2)));
|
|
writeSessionPartsToSessionFile(file2, sessionIdFromSessionFile2, i2);
|
|
i++;
|
|
}
|
|
}
|
|
int i6 = a + 91;
|
|
e = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
return;
|
|
}
|
|
Logger.getLogger().d("Closing open sessions.");
|
|
throw null;
|
|
}
|
|
|
|
private void closeWithoutRenamingOrLog(ClsFileOutputStream clsFileOutputStream) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 59;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
int i3 = 7 / 0;
|
|
if (clsFileOutputStream == null) {
|
|
return;
|
|
}
|
|
} else if (clsFileOutputStream == null) {
|
|
return;
|
|
}
|
|
try {
|
|
clsFileOutputStream.closeInProgressStream();
|
|
int i4 = a + 83;
|
|
e = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
return;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
} catch (IOException e2) {
|
|
Logger.getLogger().e("Error closing session file stream in the presence of an exception", e2);
|
|
}
|
|
}
|
|
|
|
private void deleteSessionPartFilesFor(String str) {
|
|
int i = 2 % 2;
|
|
int i2 = a + 49;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] listSessionPartFilesFor = listSessionPartFilesFor(str);
|
|
int i4 = a + 91;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
for (File file : listSessionPartFilesFor) {
|
|
file.delete();
|
|
}
|
|
}
|
|
|
|
private File[] listSessionPartFilesFor(String str) {
|
|
int i = 2 % 2;
|
|
File[] listFilesMatching = listFilesMatching(new SessionPartFileFilter(str));
|
|
int i2 = a + 85;
|
|
e = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
int i3 = 46 / 0;
|
|
}
|
|
return listFilesMatching;
|
|
}
|
|
|
|
File[] listCompleteSessionFiles() {
|
|
int i = 2 % 2;
|
|
LinkedList linkedList = new LinkedList();
|
|
File fatalSessionFilesDir = getFatalSessionFilesDir();
|
|
FilenameFilter filenameFilter = SESSION_FILE_FILTER;
|
|
Collections.addAll(linkedList, listFilesMatching(fatalSessionFilesDir, filenameFilter));
|
|
Collections.addAll(linkedList, listFilesMatching(getNonFatalSessionFilesDir(), filenameFilter));
|
|
Collections.addAll(linkedList, listFilesMatching(getFilesDir(), filenameFilter));
|
|
File[] fileArr = (File[]) linkedList.toArray(new File[linkedList.size()]);
|
|
int i2 = e + 115;
|
|
a = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
return fileArr;
|
|
}
|
|
throw null;
|
|
}
|
|
|
|
File[] listNativeSessionFileDirectories() {
|
|
int i = 2 % 2;
|
|
int i2 = e + 47;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] ensureFileArrayNotNull = ensureFileArrayNotNull(getNativeSessionFilesDir().listFiles());
|
|
int i4 = a + 41;
|
|
e = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
int i5 = 54 / 0;
|
|
}
|
|
return ensureFileArrayNotNull;
|
|
}
|
|
|
|
File[] listSessionBeginFiles() {
|
|
int i = 2 % 2;
|
|
int i2 = a + 73;
|
|
e = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
return listFilesMatching(SESSION_BEGIN_FILE_FILTER);
|
|
}
|
|
listFilesMatching(SESSION_BEGIN_FILE_FILTER);
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
private File[] listSortedSessionBeginFiles() {
|
|
int i = 2 % 2;
|
|
int i2 = a + 71;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] listSessionBeginFiles = listSessionBeginFiles();
|
|
Arrays.sort(listSessionBeginFiles, LARGEST_FILE_NAME_FIRST);
|
|
int i4 = a + 89;
|
|
e = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
return listSessionBeginFiles;
|
|
}
|
|
throw null;
|
|
}
|
|
|
|
private File[] listFilesMatching(FilenameFilter filenameFilter) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 63;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] listFilesMatching = listFilesMatching(getFilesDir(), filenameFilter);
|
|
int i4 = a + 123;
|
|
e = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
return listFilesMatching;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
private File[] listFilesMatching(File file, FilenameFilter filenameFilter) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 117;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] listFiles = file.listFiles(filenameFilter);
|
|
if (i3 == 0) {
|
|
return ensureFileArrayNotNull(listFiles);
|
|
}
|
|
ensureFileArrayNotNull(listFiles);
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
private File[] listFiles(File file) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 55;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File[] ensureFileArrayNotNull = ensureFileArrayNotNull(file.listFiles());
|
|
int i4 = a + 45;
|
|
e = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
return ensureFileArrayNotNull;
|
|
}
|
|
throw null;
|
|
}
|
|
|
|
private void trimSessionEventFiles(String str, int i) {
|
|
int i2 = 2 % 2;
|
|
File filesDir = getFilesDir();
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(str);
|
|
sb.append(SESSION_NON_FATAL_TAG);
|
|
Utils.capFileCount(filesDir, new FileNameContainsFilter(sb.toString()), i, SMALLEST_FILE_NAME_FIRST);
|
|
int i3 = e + 43;
|
|
a = i3 % 128;
|
|
if (i3 % 2 != 0) {
|
|
int i4 = 15 / 0;
|
|
}
|
|
}
|
|
|
|
void trimSessionFiles(int i) {
|
|
int i2 = 2 % 2;
|
|
int i3 = a + 39;
|
|
e = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
File nativeSessionFilesDir = getNativeSessionFilesDir();
|
|
File fatalSessionFilesDir = getFatalSessionFilesDir();
|
|
Comparator<File> comparator = SMALLEST_FILE_NAME_FIRST;
|
|
int capSessionCount = i - Utils.capSessionCount(nativeSessionFilesDir, fatalSessionFilesDir, i, comparator);
|
|
Utils.capFileCount(getFilesDir(), SESSION_FILE_FILTER, capSessionCount - Utils.capFileCount(getNonFatalSessionFilesDir(), capSessionCount, comparator), comparator);
|
|
int i5 = a + 81;
|
|
e = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
}
|
|
|
|
private void trimOpenSessions(int i) {
|
|
int i2 = 2 % 2;
|
|
HashSet hashSet = new HashSet();
|
|
File[] listSortedSessionBeginFiles = listSortedSessionBeginFiles();
|
|
int min = Math.min(i, listSortedSessionBeginFiles.length);
|
|
int i3 = e + 55;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
int i5 = 0;
|
|
while (i5 < min) {
|
|
int i6 = a + 9;
|
|
e = i6 % 128;
|
|
if (i6 % 2 == 0) {
|
|
hashSet.add(getSessionIdFromSessionFile(listSortedSessionBeginFiles[i5]));
|
|
i5 += 24;
|
|
} else {
|
|
hashSet.add(getSessionIdFromSessionFile(listSortedSessionBeginFiles[i5]));
|
|
i5++;
|
|
}
|
|
}
|
|
this.logFileManager.discardOldLogFiles(hashSet);
|
|
retainSessions(listFilesMatching(new AnySessionPartFileFilter()), hashSet);
|
|
}
|
|
|
|
private void retainSessions(File[] fileArr, Set<String> set) {
|
|
int length;
|
|
int i;
|
|
int i2 = 2 % 2;
|
|
int i3 = e + 111;
|
|
a = i3 % 128;
|
|
if (i3 % 2 != 0) {
|
|
length = fileArr.length;
|
|
i = 1;
|
|
} else {
|
|
length = fileArr.length;
|
|
i = 0;
|
|
}
|
|
while (i < length) {
|
|
int i4 = e + 51;
|
|
a = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
File file = fileArr[i];
|
|
String name = file.getName();
|
|
Matcher matcher = SESSION_FILE_PATTERN.matcher(name);
|
|
if (!matcher.matches()) {
|
|
Logger.getLogger().d("Deleting unknown file: ".concat(String.valueOf(name)));
|
|
file.delete();
|
|
} else if (!set.contains(matcher.group(1))) {
|
|
int i5 = e + 15;
|
|
a = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
Logger.getLogger().d("Trimming session file: ".concat(String.valueOf(name)));
|
|
file.delete();
|
|
int i7 = e + 57;
|
|
a = i7 % 128;
|
|
int i8 = i7 % 2;
|
|
}
|
|
i++;
|
|
} else {
|
|
SESSION_FILE_PATTERN.matcher(fileArr[i].getName()).matches();
|
|
throw null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:10:0x0019, code lost:
|
|
|
|
com.google.firebase.crashlytics.internal.Logger.getLogger().d(java.lang.String.format(java.util.Locale.US, "Trimming down to %d logged exceptions.", java.lang.Integer.valueOf(r7)));
|
|
trimSessionEventFiles(r5, r7);
|
|
r7 = new java.lang.StringBuilder();
|
|
r7.append(r5);
|
|
r7.append(com.google.firebase.crashlytics.internal.common.CrashlyticsController.SESSION_NON_FATAL_TAG);
|
|
r6 = listFilesMatching(new com.google.firebase.crashlytics.internal.common.CrashlyticsController.FileNameContainsFilter(r7.toString()));
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:12:0x0017, code lost:
|
|
|
|
if (r6.length > r7) goto L9;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:4:0x0013, code lost:
|
|
|
|
if (r6.length > r7) goto L9;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private java.io.File[] getTrimmedNonFatalFiles(java.lang.String r5, java.io.File[] r6, int r7) {
|
|
/*
|
|
r4 = this;
|
|
r0 = 2
|
|
int r1 = r0 % r0
|
|
int r1 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.e
|
|
int r1 = r1 + 67
|
|
int r2 = r1 % 128
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController.a = r2
|
|
int r1 = r1 % r0
|
|
if (r1 == 0) goto L16
|
|
int r1 = r6.length
|
|
r2 = 85
|
|
int r2 = r2 / 0
|
|
if (r1 <= r7) goto L4d
|
|
goto L19
|
|
L16:
|
|
int r1 = r6.length
|
|
if (r1 <= r7) goto L4d
|
|
L19:
|
|
com.google.firebase.crashlytics.internal.Logger r6 = com.google.firebase.crashlytics.internal.Logger.getLogger()
|
|
java.util.Locale r1 = java.util.Locale.US
|
|
java.lang.Integer r2 = java.lang.Integer.valueOf(r7)
|
|
java.lang.Object[] r2 = new java.lang.Object[]{r2}
|
|
java.lang.String r3 = "Trimming down to %d logged exceptions."
|
|
java.lang.String r1 = java.lang.String.format(r1, r3, r2)
|
|
r6.d(r1)
|
|
r4.trimSessionEventFiles(r5, r7)
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController$FileNameContainsFilter r6 = new com.google.firebase.crashlytics.internal.common.CrashlyticsController$FileNameContainsFilter
|
|
java.lang.StringBuilder r7 = new java.lang.StringBuilder
|
|
r7.<init>()
|
|
r7.append(r5)
|
|
java.lang.String r5 = "SessionEvent"
|
|
r7.append(r5)
|
|
java.lang.String r5 = r7.toString()
|
|
r6.<init>(r5)
|
|
java.io.File[] r6 = r4.listFilesMatching(r6)
|
|
L4d:
|
|
int r5 = com.google.firebase.crashlytics.internal.common.CrashlyticsController.e
|
|
int r5 = r5 + 105
|
|
int r7 = r5 % 128
|
|
com.google.firebase.crashlytics.internal.common.CrashlyticsController.a = r7
|
|
int r5 = r5 % r0
|
|
if (r5 == 0) goto L5c
|
|
r5 = 18
|
|
int r5 = r5 / 0
|
|
L5c:
|
|
return r6
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.crashlytics.internal.common.CrashlyticsController.getTrimmedNonFatalFiles(java.lang.String, java.io.File[], int):java.io.File[]");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void cleanInvalidTempFiles() {
|
|
int i = 2 % 2;
|
|
this.backgroundWorker.submit(new Runnable(this) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.15
|
|
final CrashlyticsController this$0;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
CrashlyticsController crashlyticsController = this.this$0;
|
|
crashlyticsController.doCleanInvalidTempFiles(CrashlyticsController.access$2100(crashlyticsController, new InvalidPartFileFilter()));
|
|
}
|
|
});
|
|
int i2 = a + 85;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
}
|
|
|
|
void doCleanInvalidTempFiles(File[] fileArr) {
|
|
int i = 2 % 2;
|
|
HashSet hashSet = new HashSet();
|
|
int length = fileArr.length;
|
|
int i2 = 0;
|
|
int i3 = 0;
|
|
while (i3 < length) {
|
|
File file = fileArr[i3];
|
|
Logger.getLogger().d("Found invalid session part file: ".concat(String.valueOf(file)));
|
|
hashSet.add(getSessionIdFromSessionFile(file));
|
|
i3++;
|
|
int i4 = e + 91;
|
|
a = i4 % 128;
|
|
if (i4 % 2 != 0) {
|
|
int i5 = 3 % 3;
|
|
}
|
|
}
|
|
if (hashSet.isEmpty()) {
|
|
return;
|
|
}
|
|
File[] listFilesMatching = listFilesMatching(new FilenameFilter(this, hashSet) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.16
|
|
final CrashlyticsController this$0;
|
|
final Set val$invalidSessionIds;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$invalidSessionIds = hashSet;
|
|
}
|
|
|
|
@Override // java.io.FilenameFilter
|
|
public boolean accept(File file2, String str) {
|
|
if (str.length() < 35) {
|
|
return false;
|
|
}
|
|
return this.val$invalidSessionIds.contains(str.substring(0, 35));
|
|
}
|
|
});
|
|
int length2 = listFilesMatching.length;
|
|
int i6 = e + 117;
|
|
a = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
while (i2 < length2) {
|
|
int i8 = e + 21;
|
|
a = i8 % 128;
|
|
if (i8 % 2 != 0) {
|
|
File file2 = listFilesMatching[i2];
|
|
Logger.getLogger().d("Deleting invalid session file: ".concat(String.valueOf(file2)));
|
|
file2.delete();
|
|
i2 += 90;
|
|
} else {
|
|
File file3 = listFilesMatching[i2];
|
|
Logger.getLogger().d("Deleting invalid session file: ".concat(String.valueOf(file3)));
|
|
file3.delete();
|
|
i2++;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void finalizePreviousNativeSession(String str) {
|
|
int i = 2 % 2;
|
|
Logger.getLogger().d("Finalizing native report for session ".concat(String.valueOf(str)));
|
|
NativeSessionFileProvider sessionFileProvider = this.nativeComponent.getSessionFileProvider(str);
|
|
File minidumpFile = sessionFileProvider.getMinidumpFile();
|
|
Object obj = null;
|
|
if (minidumpFile != null) {
|
|
int i2 = e + 101;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
minidumpFile.exists();
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
if (minidumpFile.exists()) {
|
|
LogFileManager logFileManager = new LogFileManager(this.context, this.logFileDirectoryProvider, str);
|
|
File file = new File(getNativeSessionFilesDir(), str);
|
|
if (file.mkdirs()) {
|
|
List<NativeSessionFile> nativeSessionFiles = getNativeSessionFiles(sessionFileProvider, str, getContext(), getFilesDir(), logFileManager.getBytesForLog());
|
|
NativeSessionFileGzipper.processNativeSessions(file, nativeSessionFiles);
|
|
this.reportingCoordinator.finalizeSessionWithNativeEvent(makeFirebaseSessionIdentifier(str), nativeSessionFiles);
|
|
logFileManager.clearLog();
|
|
return;
|
|
}
|
|
int i3 = e + 53;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
Logger.getLogger().d("Couldn't create native sessions directory");
|
|
int i5 = e + 41;
|
|
a = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return;
|
|
}
|
|
}
|
|
Logger.getLogger().w("No minidump data found for session ".concat(String.valueOf(str)));
|
|
int i7 = a + 71;
|
|
e = i7 % 128;
|
|
if (i7 % 2 != 0) {
|
|
return;
|
|
}
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
private static long getCurrentTimestampSeconds() {
|
|
int i = 2 % 2;
|
|
long timestampSeconds = getTimestampSeconds(new Date());
|
|
int i2 = e + 21;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
int i3 = 99 / 0;
|
|
}
|
|
return timestampSeconds;
|
|
}
|
|
|
|
private static long getTimestampSeconds(Date date) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 41;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
long time = date.getTime();
|
|
long j = i3 != 0 ? time | 1000 : time / 1000;
|
|
int i4 = a + 13;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return j;
|
|
}
|
|
|
|
private static String makeFirebaseSessionIdentifier(String str) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 23;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
String replaceAll = str.replaceAll("-", "");
|
|
int i4 = a + 99;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return replaceAll;
|
|
}
|
|
|
|
private void writeFatal(Thread thread, Throwable th, long j) {
|
|
ClsFileOutputStream clsFileOutputStream;
|
|
String currentSessionId;
|
|
int i = 2 % 2;
|
|
int i2 = e + 11;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
CodedOutputStream codedOutputStream = null;
|
|
try {
|
|
currentSessionId = getCurrentSessionId();
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
clsFileOutputStream = null;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
clsFileOutputStream = null;
|
|
CommonUtils.flushOrLog(codedOutputStream, "Failed to flush to session begin file.");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close fatal exception file output stream.");
|
|
throw th;
|
|
}
|
|
if (currentSessionId == null) {
|
|
Logger.getLogger().e("Tried to write a fatal exception while no session was open.");
|
|
CommonUtils.flushOrLog(null, "Failed to flush to session begin file.");
|
|
CommonUtils.closeOrLog(null, "Failed to close fatal exception file output stream.");
|
|
return;
|
|
}
|
|
File filesDir = getFilesDir();
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(currentSessionId);
|
|
sb.append(SESSION_FATAL_TAG);
|
|
clsFileOutputStream = new ClsFileOutputStream(filesDir, sb.toString());
|
|
try {
|
|
try {
|
|
codedOutputStream = CodedOutputStream.newInstance(clsFileOutputStream);
|
|
writeSessionEvent(codedOutputStream, thread, th, j, "crash", true);
|
|
int i4 = a + 71;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
} catch (Exception e3) {
|
|
e = e3;
|
|
Logger.getLogger().e("An error occurred in the fatal exception logger", e);
|
|
CommonUtils.flushOrLog(codedOutputStream, "Failed to flush to session begin file.");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close fatal exception file output stream.");
|
|
}
|
|
CommonUtils.flushOrLog(codedOutputStream, "Failed to flush to session begin file.");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close fatal exception file output stream.");
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
CommonUtils.flushOrLog(codedOutputStream, "Failed to flush to session begin file.");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close fatal exception file output stream.");
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
private void doWriteNonFatal(Thread thread, Throwable th, long j) {
|
|
ClsFileOutputStream clsFileOutputStream;
|
|
CodedOutputStream newInstance;
|
|
int i = 2 % 2;
|
|
int i2 = e + 71;
|
|
a = i2 % 128;
|
|
CodedOutputStream codedOutputStream = null;
|
|
r2 = null;
|
|
CodedOutputStream codedOutputStream2 = null;
|
|
CodedOutputStream codedOutputStream3 = null;
|
|
if (i2 % 2 == 0) {
|
|
String currentSessionId = getCurrentSessionId();
|
|
try {
|
|
if (currentSessionId != null) {
|
|
try {
|
|
Logger logger = Logger.getLogger();
|
|
StringBuilder sb = new StringBuilder("Crashlytics is logging non-fatal exception \"");
|
|
sb.append(th);
|
|
sb.append("\" from thread ");
|
|
sb.append(thread.getName());
|
|
logger.d(sb.toString());
|
|
String padWithZerosToMaxIntWidth = CommonUtils.padWithZerosToMaxIntWidth(this.eventCounter.getAndIncrement());
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append(currentSessionId);
|
|
sb2.append(SESSION_NON_FATAL_TAG);
|
|
sb2.append(padWithZerosToMaxIntWidth);
|
|
clsFileOutputStream = new ClsFileOutputStream(getFilesDir(), sb2.toString());
|
|
try {
|
|
newInstance = CodedOutputStream.newInstance(clsFileOutputStream);
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
}
|
|
try {
|
|
writeSessionEvent(newInstance, thread, th, j, EVENT_TYPE_LOGGED, false);
|
|
CommonUtils.flushOrLog(newInstance, "Failed to flush to non-fatal file.");
|
|
int i3 = e + 107;
|
|
int i4 = i3 % 128;
|
|
a = i4;
|
|
int i5 = i3 % 2;
|
|
codedOutputStream = i4;
|
|
} catch (Exception e3) {
|
|
e = e3;
|
|
codedOutputStream2 = newInstance;
|
|
Logger.getLogger().e("An error occurred in the non-fatal exception logger", e);
|
|
CommonUtils.flushOrLog(codedOutputStream2, "Failed to flush to non-fatal file.");
|
|
codedOutputStream = codedOutputStream2;
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close non-fatal file output stream.");
|
|
trimSessionEventFiles(currentSessionId, 64);
|
|
return;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
codedOutputStream3 = newInstance;
|
|
CommonUtils.flushOrLog(codedOutputStream3, "Failed to flush to non-fatal file.");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close non-fatal file output stream.");
|
|
throw th;
|
|
}
|
|
} catch (Exception e4) {
|
|
e = e4;
|
|
clsFileOutputStream = null;
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
clsFileOutputStream = null;
|
|
}
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close non-fatal file output stream.");
|
|
try {
|
|
trimSessionEventFiles(currentSessionId, 64);
|
|
return;
|
|
} catch (Exception e5) {
|
|
Logger.getLogger().e("An error occurred when trimming non-fatal files.", e5);
|
|
return;
|
|
}
|
|
}
|
|
int i6 = a + 17;
|
|
e = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
Logger.getLogger().d("Tried to write a non-fatal exception while no session was open.");
|
|
} catch (Throwable th4) {
|
|
th = th4;
|
|
clsFileOutputStream = clsFileOutputStream;
|
|
codedOutputStream3 = codedOutputStream;
|
|
}
|
|
} else {
|
|
getCurrentSessionId();
|
|
codedOutputStream.hashCode();
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
private void writeSessionPartFile(String str, String str2, CodedOutputStreamWriteAction codedOutputStreamWriteAction) throws Exception {
|
|
Throwable th;
|
|
ClsFileOutputStream clsFileOutputStream;
|
|
int i = 2 % 2;
|
|
CodedOutputStream codedOutputStream = null;
|
|
try {
|
|
File filesDir = getFilesDir();
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(str);
|
|
sb.append(str2);
|
|
clsFileOutputStream = new ClsFileOutputStream(filesDir, sb.toString());
|
|
try {
|
|
CodedOutputStream newInstance = CodedOutputStream.newInstance(clsFileOutputStream);
|
|
try {
|
|
codedOutputStreamWriteAction.writeTo(newInstance);
|
|
StringBuilder sb2 = new StringBuilder("Failed to flush to session ");
|
|
sb2.append(str2);
|
|
sb2.append(" file.");
|
|
CommonUtils.flushOrLog(newInstance, sb2.toString());
|
|
StringBuilder sb3 = new StringBuilder("Failed to close session ");
|
|
sb3.append(str2);
|
|
sb3.append(" file.");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, sb3.toString());
|
|
int i2 = e + 25;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
codedOutputStream = newInstance;
|
|
StringBuilder sb4 = new StringBuilder("Failed to flush to session ");
|
|
sb4.append(str2);
|
|
sb4.append(" file.");
|
|
CommonUtils.flushOrLog(codedOutputStream, sb4.toString());
|
|
StringBuilder sb5 = new StringBuilder("Failed to close session ");
|
|
sb5.append(str2);
|
|
sb5.append(" file.");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, sb5.toString());
|
|
throw th;
|
|
}
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
}
|
|
} catch (Throwable th4) {
|
|
th = th4;
|
|
clsFileOutputStream = null;
|
|
}
|
|
}
|
|
|
|
private static void appendToProtoFile(File file, CodedOutputStreamWriteAction codedOutputStreamWriteAction) throws Exception {
|
|
FileOutputStream fileOutputStream;
|
|
int i = 2 % 2;
|
|
CodedOutputStream codedOutputStream = null;
|
|
try {
|
|
fileOutputStream = new FileOutputStream(file, true);
|
|
try {
|
|
CodedOutputStream newInstance = CodedOutputStream.newInstance(fileOutputStream);
|
|
try {
|
|
codedOutputStreamWriteAction.writeTo(newInstance);
|
|
StringBuilder sb = new StringBuilder("Failed to flush to append to ");
|
|
sb.append(file.getPath());
|
|
CommonUtils.flushOrLog(newInstance, sb.toString());
|
|
StringBuilder sb2 = new StringBuilder("Failed to close ");
|
|
sb2.append(file.getPath());
|
|
CommonUtils.closeOrLog(fileOutputStream, sb2.toString());
|
|
int i2 = e + 91;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
throw null;
|
|
}
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
codedOutputStream = newInstance;
|
|
StringBuilder sb3 = new StringBuilder("Failed to flush to append to ");
|
|
sb3.append(file.getPath());
|
|
CommonUtils.flushOrLog(codedOutputStream, sb3.toString());
|
|
StringBuilder sb4 = new StringBuilder("Failed to close ");
|
|
sb4.append(file.getPath());
|
|
CommonUtils.closeOrLog(fileOutputStream, sb4.toString());
|
|
throw th;
|
|
}
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
}
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
fileOutputStream = null;
|
|
}
|
|
}
|
|
|
|
private void writeBeginSession(String str, long j) throws Exception {
|
|
int i = 2 % 2;
|
|
String format = String.format(Locale.US, GENERATOR_FORMAT, CrashlyticsCore.getVersion());
|
|
writeSessionPartFile(str, SESSION_BEGIN_TAG, new CodedOutputStreamWriteAction(this, str, format, j) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.17
|
|
final CrashlyticsController this$0;
|
|
final String val$generator;
|
|
final String val$sessionId;
|
|
final long val$startedAtSeconds;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$sessionId = str;
|
|
this.val$generator = format;
|
|
this.val$startedAtSeconds = j;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsController.CodedOutputStreamWriteAction
|
|
public void writeTo(CodedOutputStream codedOutputStream) throws Exception {
|
|
SessionProtobufHelper.writeBeginSession(codedOutputStream, this.val$sessionId, this.val$generator, this.val$startedAtSeconds);
|
|
}
|
|
});
|
|
this.nativeComponent.writeBeginSession(str, format, j);
|
|
int i2 = e + 99;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
int i3 = 38 / 0;
|
|
}
|
|
}
|
|
|
|
private void writeSessionApp(String str) throws Exception {
|
|
int i = 2 % 2;
|
|
String appIdentifier = this.idManager.getAppIdentifier();
|
|
String str2 = this.appData.versionCode;
|
|
String str3 = this.appData.versionName;
|
|
String crashlyticsInstallId = this.idManager.getCrashlyticsInstallId();
|
|
int id = DeliveryMechanism.determineFrom(this.appData.installerPackageName).getId();
|
|
writeSessionPartFile(str, SESSION_APP_TAG, new CodedOutputStreamWriteAction(this, appIdentifier, str2, str3, crashlyticsInstallId, id) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.18
|
|
final CrashlyticsController this$0;
|
|
final String val$appIdentifier;
|
|
final int val$deliveryMechanism;
|
|
final String val$installUuid;
|
|
final String val$versionCode;
|
|
final String val$versionName;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$appIdentifier = appIdentifier;
|
|
this.val$versionCode = str2;
|
|
this.val$versionName = str3;
|
|
this.val$installUuid = crashlyticsInstallId;
|
|
this.val$deliveryMechanism = id;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsController.CodedOutputStreamWriteAction
|
|
public void writeTo(CodedOutputStream codedOutputStream) throws Exception {
|
|
SessionProtobufHelper.writeSessionApp(codedOutputStream, this.val$appIdentifier, this.val$versionCode, this.val$versionName, this.val$installUuid, this.val$deliveryMechanism, CrashlyticsController.access$2200(this.this$0));
|
|
}
|
|
});
|
|
this.nativeComponent.writeSessionApp(str, appIdentifier, str2, str3, crashlyticsInstallId, id, this.unityVersion);
|
|
int i2 = a + 105;
|
|
e = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
private void writeSessionOS(String str) throws Exception {
|
|
int i = 2 % 2;
|
|
String str2 = Build.VERSION.RELEASE;
|
|
String str3 = Build.VERSION.CODENAME;
|
|
boolean isRooted = CommonUtils.isRooted(getContext());
|
|
writeSessionPartFile(str, SESSION_OS_TAG, new CodedOutputStreamWriteAction(this, str2, str3, isRooted) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.19
|
|
final CrashlyticsController this$0;
|
|
final boolean val$isRooted;
|
|
final String val$osCodeName;
|
|
final String val$osRelease;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$osRelease = str2;
|
|
this.val$osCodeName = str3;
|
|
this.val$isRooted = isRooted;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsController.CodedOutputStreamWriteAction
|
|
public void writeTo(CodedOutputStream codedOutputStream) throws Exception {
|
|
SessionProtobufHelper.writeSessionOS(codedOutputStream, this.val$osRelease, this.val$osCodeName, this.val$isRooted);
|
|
}
|
|
});
|
|
this.nativeComponent.writeSessionOs(str, str2, str3, isRooted);
|
|
int i2 = e + 21;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
}
|
|
|
|
private void writeSessionDevice(String str) throws Exception {
|
|
int i = 2 % 2;
|
|
Context context = getContext();
|
|
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
|
|
int cpuArchitectureInt = CommonUtils.getCpuArchitectureInt();
|
|
String str2 = Build.MODEL;
|
|
int availableProcessors = Runtime.getRuntime().availableProcessors();
|
|
long totalRamInBytes = CommonUtils.getTotalRamInBytes();
|
|
long blockCount = statFs.getBlockCount() * statFs.getBlockSize();
|
|
boolean isEmulator = CommonUtils.isEmulator(context);
|
|
int deviceState = CommonUtils.getDeviceState(context);
|
|
String str3 = Build.MANUFACTURER;
|
|
String str4 = Build.PRODUCT;
|
|
writeSessionPartFile(str, SESSION_DEVICE_TAG, new CodedOutputStreamWriteAction(this, cpuArchitectureInt, str2, availableProcessors, totalRamInBytes, blockCount, isEmulator, deviceState, str3, str4) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.20
|
|
final CrashlyticsController this$0;
|
|
final int val$arch;
|
|
final int val$availableProcessors;
|
|
final long val$diskSpace;
|
|
final boolean val$isEmulator;
|
|
final String val$manufacturer;
|
|
final String val$model;
|
|
final String val$modelClass;
|
|
final int val$state;
|
|
final long val$totalRam;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$arch = cpuArchitectureInt;
|
|
this.val$model = str2;
|
|
this.val$availableProcessors = availableProcessors;
|
|
this.val$totalRam = totalRamInBytes;
|
|
this.val$diskSpace = blockCount;
|
|
this.val$isEmulator = isEmulator;
|
|
this.val$state = deviceState;
|
|
this.val$manufacturer = str3;
|
|
this.val$modelClass = str4;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsController.CodedOutputStreamWriteAction
|
|
public void writeTo(CodedOutputStream codedOutputStream) throws Exception {
|
|
SessionProtobufHelper.writeSessionDevice(codedOutputStream, this.val$arch, this.val$model, this.val$availableProcessors, this.val$totalRam, this.val$diskSpace, this.val$isEmulator, this.val$state, this.val$manufacturer, this.val$modelClass);
|
|
}
|
|
});
|
|
this.nativeComponent.writeSessionDevice(str, cpuArchitectureInt, str2, availableProcessors, totalRamInBytes, blockCount, isEmulator, deviceState, str3, str4);
|
|
int i2 = e + 73;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
}
|
|
|
|
private void writeSessionUser(String str) throws Exception {
|
|
int i = 2 % 2;
|
|
writeSessionPartFile(str, SESSION_USER_TAG, new CodedOutputStreamWriteAction(this, getUserMetadata(str)) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.21
|
|
final CrashlyticsController this$0;
|
|
final UserMetadata val$metadata;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$metadata = r2;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsController.CodedOutputStreamWriteAction
|
|
public void writeTo(CodedOutputStream codedOutputStream) throws Exception {
|
|
SessionProtobufHelper.writeSessionUser(codedOutputStream, this.val$metadata.getUserId(), null, null);
|
|
}
|
|
});
|
|
int i2 = e + 17;
|
|
a = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
return;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
private void writeSessionEvent(CodedOutputStream codedOutputStream, Thread thread, Throwable th, long j, String str, boolean z) throws Exception {
|
|
boolean z2;
|
|
Thread[] threadArr;
|
|
Map<String, String> customKeys;
|
|
int i = 2 % 2;
|
|
TrimmedThrowableData trimmedThrowableData = new TrimmedThrowableData(th, this.stackTraceTrimmingStrategy);
|
|
Context context = getContext();
|
|
BatteryState batteryState = BatteryState.get(context);
|
|
Float batteryLevel = batteryState.getBatteryLevel();
|
|
int batteryVelocity = batteryState.getBatteryVelocity();
|
|
boolean proximitySensorEnabled = CommonUtils.getProximitySensorEnabled(context);
|
|
int i2 = context.getResources().getConfiguration().orientation;
|
|
long totalRamInBytes = CommonUtils.getTotalRamInBytes();
|
|
long calculateFreeRamInBytes = CommonUtils.calculateFreeRamInBytes(context);
|
|
long calculateUsedDiskSpaceInBytes = CommonUtils.calculateUsedDiskSpaceInBytes(Environment.getDataDirectory().getPath());
|
|
ActivityManager.RunningAppProcessInfo appProcessInfo = CommonUtils.getAppProcessInfo(context.getPackageName(), context);
|
|
LinkedList linkedList = new LinkedList();
|
|
StackTraceElement[] stackTraceElementArr = trimmedThrowableData.stacktrace;
|
|
String str2 = this.appData.buildId;
|
|
String appIdentifier = this.idManager.getAppIdentifier();
|
|
int i3 = 0;
|
|
if (z) {
|
|
int i4 = a + 33;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
Map<Thread, StackTraceElement[]> allStackTraces = Thread.getAllStackTraces();
|
|
Thread[] threadArr2 = new Thread[allStackTraces.size()];
|
|
for (Map.Entry<Thread, StackTraceElement[]> entry : allStackTraces.entrySet()) {
|
|
threadArr2[i3] = entry.getKey();
|
|
linkedList.add(this.stackTraceTrimmingStrategy.getTrimmedStackTrace(entry.getValue()));
|
|
i3++;
|
|
}
|
|
z2 = true;
|
|
threadArr = threadArr2;
|
|
} else {
|
|
z2 = true;
|
|
threadArr = new Thread[0];
|
|
}
|
|
if (CommonUtils.getBooleanResourceValue(context, COLLECT_CUSTOM_KEYS, z2)) {
|
|
customKeys = this.userMetadata.getCustomKeys();
|
|
if (customKeys != null) {
|
|
int i6 = a + 39;
|
|
e = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
if (customKeys.size() > 1) {
|
|
customKeys = new TreeMap(customKeys);
|
|
}
|
|
}
|
|
} else {
|
|
customKeys = new TreeMap<>();
|
|
}
|
|
SessionProtobufHelper.writeSessionEvent(codedOutputStream, j, str, trimmedThrowableData, thread, stackTraceElementArr, threadArr, linkedList, 8, customKeys, this.logFileManager.getBytesForLog(), appProcessInfo, i2, appIdentifier, str2, batteryLevel, batteryVelocity, proximitySensorEnabled, totalRamInBytes - calculateFreeRamInBytes, calculateUsedDiskSpaceInBytes);
|
|
this.logFileManager.clearLog();
|
|
}
|
|
|
|
private void writeSessionPartsToSessionFile(File file, String str, int i) {
|
|
File file2;
|
|
int i2 = 2 % 2;
|
|
Logger.getLogger().d("Collecting session parts for ID ".concat(String.valueOf(str)));
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(str);
|
|
sb.append(SESSION_FATAL_TAG);
|
|
File[] listFilesMatching = listFilesMatching(new FileNameContainsFilter(sb.toString()));
|
|
boolean z = listFilesMatching != null && listFilesMatching.length > 0;
|
|
Logger.getLogger().d(String.format(Locale.US, "Session %s has fatal exception: %s", str, Boolean.valueOf(z)));
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append(str);
|
|
sb2.append(SESSION_NON_FATAL_TAG);
|
|
File[] listFilesMatching2 = listFilesMatching(new FileNameContainsFilter(sb2.toString()));
|
|
boolean z2 = listFilesMatching2 != null && listFilesMatching2.length > 0;
|
|
Logger.getLogger().d(String.format(Locale.US, "Session %s has non-fatal exceptions: %s", str, Boolean.valueOf(z2)));
|
|
if (z || z2) {
|
|
File[] trimmedNonFatalFiles = getTrimmedNonFatalFiles(str, listFilesMatching2, i);
|
|
if (z) {
|
|
int i3 = e + 1;
|
|
a = i3 % 128;
|
|
file2 = i3 % 2 != 0 ? listFilesMatching[1] : listFilesMatching[0];
|
|
} else {
|
|
file2 = null;
|
|
}
|
|
synthesizeSessionFile(file, str, trimmedNonFatalFiles, file2);
|
|
} else {
|
|
int i4 = e + 67;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
Logger.getLogger().d("No events present for session ID ".concat(String.valueOf(str)));
|
|
}
|
|
Logger.getLogger().d("Removing session part files for ID ".concat(String.valueOf(str)));
|
|
deleteSessionPartFilesFor(str);
|
|
int i6 = a + 75;
|
|
e = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
}
|
|
|
|
private void synthesizeSessionFile(File file, String str, File[] fileArr, File file2) {
|
|
ClsFileOutputStream clsFileOutputStream;
|
|
CodedOutputStream newInstance;
|
|
int i = 2 % 2;
|
|
int i2 = a + 21;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
boolean z = file2 != null;
|
|
File nonFatalSessionFilesDir = !z ? getNonFatalSessionFilesDir() : getFatalSessionFilesDir();
|
|
CodedOutputStream codedOutputStream = null;
|
|
if (!nonFatalSessionFilesDir.exists()) {
|
|
int i4 = a + 49;
|
|
e = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
nonFatalSessionFilesDir.mkdirs();
|
|
codedOutputStream.hashCode();
|
|
throw null;
|
|
}
|
|
nonFatalSessionFilesDir.mkdirs();
|
|
int i5 = e + 47;
|
|
a = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
}
|
|
try {
|
|
clsFileOutputStream = new ClsFileOutputStream(nonFatalSessionFilesDir, str);
|
|
try {
|
|
try {
|
|
newInstance = CodedOutputStream.newInstance(clsFileOutputStream);
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
}
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
}
|
|
} catch (Exception e3) {
|
|
e = e3;
|
|
clsFileOutputStream = null;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
clsFileOutputStream = null;
|
|
}
|
|
try {
|
|
Logger logger = Logger.getLogger();
|
|
StringBuilder sb = new StringBuilder("Collecting SessionStart data for session ID ");
|
|
sb.append(str);
|
|
logger.d(sb.toString());
|
|
writeToCosFromFile(newInstance, file);
|
|
newInstance.writeUInt64(4, getCurrentTimestampSeconds());
|
|
newInstance.writeBool(5, z);
|
|
newInstance.writeUInt32(11, 1);
|
|
newInstance.writeEnum(12, 3);
|
|
writeInitialPartsTo(newInstance, str);
|
|
writeNonFatalEventsTo(newInstance, fileArr, str);
|
|
if (z) {
|
|
writeToCosFromFile(newInstance, file2);
|
|
}
|
|
CommonUtils.flushOrLog(newInstance, "Error flushing session file stream");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close CLS file");
|
|
} catch (Exception e4) {
|
|
e = e4;
|
|
codedOutputStream = newInstance;
|
|
Logger logger2 = Logger.getLogger();
|
|
StringBuilder sb2 = new StringBuilder("Failed to write session file for session ID: ");
|
|
sb2.append(str);
|
|
logger2.e(sb2.toString(), e);
|
|
CommonUtils.flushOrLog(codedOutputStream, "Error flushing session file stream");
|
|
closeWithoutRenamingOrLog(clsFileOutputStream);
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
codedOutputStream = newInstance;
|
|
CommonUtils.flushOrLog(codedOutputStream, "Error flushing session file stream");
|
|
CommonUtils.closeOrLog(clsFileOutputStream, "Failed to close CLS file");
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
private static void writeNonFatalEventsTo(CodedOutputStream codedOutputStream, File[] fileArr, String str) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 101;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
Arrays.sort(fileArr, CommonUtils.FILE_MODIFIED_COMPARATOR);
|
|
for (File file : fileArr) {
|
|
int i4 = e + 93;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
try {
|
|
Logger.getLogger().d(String.format(Locale.US, "Found Non Fatal for session ID %s in %s ", str, file.getName()));
|
|
writeToCosFromFile(codedOutputStream, file);
|
|
} catch (Exception e2) {
|
|
Logger.getLogger().e("Error writting non-fatal to session.", e2);
|
|
}
|
|
}
|
|
int i6 = a + 89;
|
|
e = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
}
|
|
|
|
private void writeInitialPartsTo(CodedOutputStream codedOutputStream, String str) throws IOException {
|
|
String[] strArr;
|
|
int length;
|
|
int i;
|
|
int i2 = 2 % 2;
|
|
int i3 = e + 23;
|
|
a = i3 % 128;
|
|
if (i3 % 2 != 0) {
|
|
strArr = INITIAL_SESSION_PART_TAGS;
|
|
length = strArr.length;
|
|
i = 1;
|
|
} else {
|
|
strArr = INITIAL_SESSION_PART_TAGS;
|
|
length = strArr.length;
|
|
i = 0;
|
|
}
|
|
while (i < length) {
|
|
String str2 = strArr[i];
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(str);
|
|
sb.append(str2);
|
|
sb.append(ClsFileOutputStream.SESSION_FILE_EXTENSION);
|
|
File[] listFilesMatching = listFilesMatching(new FileNameContainsFilter(sb.toString()));
|
|
if (listFilesMatching.length == 0) {
|
|
Logger logger = Logger.getLogger();
|
|
StringBuilder sb2 = new StringBuilder("Can't find ");
|
|
sb2.append(str2);
|
|
sb2.append(" data for session ID ");
|
|
sb2.append(str);
|
|
logger.d(sb2.toString());
|
|
int i4 = e + 49;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
} else {
|
|
Logger logger2 = Logger.getLogger();
|
|
StringBuilder sb3 = new StringBuilder("Collecting ");
|
|
sb3.append(str2);
|
|
sb3.append(" data for session ID ");
|
|
sb3.append(str);
|
|
logger2.d(sb3.toString());
|
|
writeToCosFromFile(codedOutputStream, listFilesMatching[0]);
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
|
|
private static void appendOrganizationIdToSessionFile(String str, File file) throws Exception {
|
|
int i = 2 % 2;
|
|
int i2 = a + 13;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
if (str == null) {
|
|
return;
|
|
}
|
|
appendToProtoFile(file, new CodedOutputStreamWriteAction(str) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.22
|
|
final String val$organizationId;
|
|
|
|
{
|
|
this.val$organizationId = str;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.common.CrashlyticsController.CodedOutputStreamWriteAction
|
|
public void writeTo(CodedOutputStream codedOutputStream) throws Exception {
|
|
SessionProtobufHelper.writeSessionAppClsId(codedOutputStream, this.val$organizationId);
|
|
}
|
|
});
|
|
int i4 = e + 55;
|
|
a = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
return;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
private static void writeToCosFromFile(CodedOutputStream codedOutputStream, File file) throws IOException {
|
|
int i = 2 % 2;
|
|
int i2 = e + 33;
|
|
a = i2 % 128;
|
|
FileInputStream fileInputStream = null;
|
|
if (i2 % 2 == 0) {
|
|
if (!file.exists()) {
|
|
Logger logger = Logger.getLogger();
|
|
StringBuilder sb = new StringBuilder("Tried to include a file that doesn't exist: ");
|
|
sb.append(file.getName());
|
|
logger.e(sb.toString());
|
|
int i3 = a + 1;
|
|
e = i3 % 128;
|
|
if (i3 % 2 == 0) {
|
|
int i4 = 49 / 0;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
try {
|
|
FileInputStream fileInputStream2 = new FileInputStream(file);
|
|
try {
|
|
copyToCodedOutputStream(fileInputStream2, codedOutputStream, (int) file.length());
|
|
CommonUtils.closeOrLog(fileInputStream2, "Failed to close file input stream.");
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
fileInputStream = fileInputStream2;
|
|
CommonUtils.closeOrLog(fileInputStream, "Failed to close file input stream.");
|
|
throw th;
|
|
}
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
}
|
|
} else {
|
|
file.exists();
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
private static void copyToCodedOutputStream(InputStream inputStream, CodedOutputStream codedOutputStream, int i) throws IOException {
|
|
int i2 = 2 % 2;
|
|
int i3 = e + 27;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
byte[] bArr = new byte[i];
|
|
int i5 = 0;
|
|
while (i5 < i) {
|
|
int read = inputStream.read(bArr, i5, i - i5);
|
|
if (read < 0) {
|
|
break;
|
|
}
|
|
int i6 = a + 37;
|
|
e = i6 % 128;
|
|
i5 = i6 % 2 == 0 ? i5 >>> read : i5 + read;
|
|
}
|
|
codedOutputStream.writeRawBytes(bArr);
|
|
}
|
|
|
|
private UserMetadata getUserMetadata(String str) {
|
|
int i = 2 % 2;
|
|
int i2 = e + 101;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
if (isHandlingException()) {
|
|
UserMetadata userMetadata = this.userMetadata;
|
|
int i4 = a + 63;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return userMetadata;
|
|
}
|
|
return new MetaDataStore(getFilesDir()).readUserData(str);
|
|
}
|
|
|
|
boolean isHandlingException() {
|
|
int i = 2 % 2;
|
|
CrashlyticsUncaughtExceptionHandler crashlyticsUncaughtExceptionHandler = this.crashHandler;
|
|
if (crashlyticsUncaughtExceptionHandler != null) {
|
|
int i2 = e + 103;
|
|
a = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
crashlyticsUncaughtExceptionHandler.isHandlingException();
|
|
throw null;
|
|
}
|
|
if (crashlyticsUncaughtExceptionHandler.isHandlingException()) {
|
|
return true;
|
|
}
|
|
}
|
|
int i3 = e + 111;
|
|
a = i3 % 128;
|
|
if (i3 % 2 != 0) {
|
|
int i4 = 5 % 5;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
File getFilesDir() {
|
|
int i = 2 % 2;
|
|
int i2 = a + 51;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
File filesDir = this.fileStore.getFilesDir();
|
|
int i4 = a + 47;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return filesDir;
|
|
}
|
|
|
|
File getNativeSessionFilesDir() {
|
|
int i = 2 % 2;
|
|
File file = new File(getFilesDir(), NATIVE_SESSION_DIR);
|
|
int i2 = e + 23;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return file;
|
|
}
|
|
|
|
File getFatalSessionFilesDir() {
|
|
int i = 2 % 2;
|
|
File file = new File(getFilesDir(), FATAL_SESSION_DIR);
|
|
int i2 = e + 119;
|
|
a = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
return file;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
File getNonFatalSessionFilesDir() {
|
|
int i = 2 % 2;
|
|
File file = new File(getFilesDir(), NONFATAL_SESSION_DIR);
|
|
int i2 = a + 35;
|
|
e = i2 % 128;
|
|
if (i2 % 2 != 0) {
|
|
return file;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void registerAnalyticsListener() {
|
|
int i = 2 % 2;
|
|
int i2 = e + 69;
|
|
a = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
Logger.getLogger().d("Registered Firebase Analytics event listener for breadcrumbs: ".concat(String.valueOf(this.analyticsReceiver.register())));
|
|
} else {
|
|
Logger.getLogger().d("Registered Firebase Analytics event listener for breadcrumbs: ".concat(String.valueOf(this.analyticsReceiver.register())));
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
private CreateReportSpiCall getCreateReportSpiCall(String str, String str2) {
|
|
int i = 2 % 2;
|
|
String stringsFileValue = CommonUtils.getStringsFileValue(getContext(), CRASHLYTICS_API_ENDPOINT);
|
|
CompositeCreateReportSpiCall compositeCreateReportSpiCall = new CompositeCreateReportSpiCall(new DefaultCreateReportSpiCall(stringsFileValue, str, this.httpRequestFactory, CrashlyticsCore.getVersion()), new NativeCreateReportSpiCall(stringsFileValue, str2, this.httpRequestFactory, CrashlyticsCore.getVersion()));
|
|
int i2 = a + 77;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return compositeCreateReportSpiCall;
|
|
}
|
|
|
|
private void sendSessionReports(AppSettingsData appSettingsData, boolean z) throws Exception {
|
|
int i = 2 % 2;
|
|
int i2 = a + 47;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
Context context = getContext();
|
|
ReportUploader createReportUploader = this.reportUploaderProvider.createReportUploader(appSettingsData);
|
|
File[] listCompleteSessionFiles = listCompleteSessionFiles();
|
|
int length = listCompleteSessionFiles.length;
|
|
int i4 = 0;
|
|
while (i4 < length) {
|
|
File file = listCompleteSessionFiles[i4];
|
|
appendOrganizationIdToSessionFile(appSettingsData.organizationId, file);
|
|
this.backgroundWorker.submit(new SendReportRunnable(context, new SessionReport(file, SEND_AT_CRASHTIME_HEADER), createReportUploader, z));
|
|
i4++;
|
|
int i5 = e + 23;
|
|
a = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static class BlockingCrashEventListener implements AnalyticsReceiver.CrashlyticsOriginEventListener {
|
|
private static final int APP_EXCEPTION_CALLBACK_TIMEOUT_MS = 2000;
|
|
private final CountDownLatch eventLatch;
|
|
|
|
private BlockingCrashEventListener() {
|
|
this.eventLatch = new CountDownLatch(1);
|
|
}
|
|
|
|
public void awaitEvent() throws InterruptedException {
|
|
Logger.getLogger().d("Background thread awaiting app exception callback from FA...");
|
|
if (this.eventLatch.await(2000L, TimeUnit.MILLISECONDS)) {
|
|
Logger.getLogger().d("App exception callback received from FA listener.");
|
|
} else {
|
|
Logger.getLogger().d("Timeout exceeded while awaiting app exception callback from FA listener.");
|
|
}
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.analytics.AnalyticsReceiver.CrashlyticsOriginEventListener
|
|
public void onCrashlyticsOriginEvent(int i, Bundle bundle) {
|
|
if ("_ae".equals(bundle.getString("name"))) {
|
|
this.eventLatch.countDown();
|
|
}
|
|
}
|
|
}
|
|
|
|
private Task<Void> recordFatalFirebaseEvent(long j) {
|
|
int i = 2 % 2;
|
|
Task<Void> call = Tasks.call(new ScheduledThreadPoolExecutor(1), new Callable<Void>(this, j) { // from class: com.google.firebase.crashlytics.internal.common.CrashlyticsController.23
|
|
final CrashlyticsController this$0;
|
|
final long val$timestamp;
|
|
|
|
{
|
|
this.this$0 = this;
|
|
this.val$timestamp = j;
|
|
}
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public Void call() throws Exception {
|
|
if (CrashlyticsController.access$2300(this.this$0)) {
|
|
Logger.getLogger().d("Skipping logging Crashlytics event to Firebase, FirebaseCrash exists");
|
|
return null;
|
|
}
|
|
if (CrashlyticsController.access$2400(this.this$0) == null) {
|
|
Logger.getLogger().d("Skipping logging Crashlytics event to Firebase, no Firebase Analytics");
|
|
return null;
|
|
}
|
|
BlockingCrashEventListener blockingCrashEventListener = new BlockingCrashEventListener();
|
|
CrashlyticsController.access$2600(this.this$0).setCrashlyticsOriginEventListener(blockingCrashEventListener);
|
|
Logger.getLogger().d("Logging Crashlytics event to Firebase");
|
|
Bundle bundle = new Bundle();
|
|
bundle.putInt(CrashlyticsController.FIREBASE_CRASH_TYPE, 1);
|
|
bundle.putLong(CrashlyticsController.FIREBASE_TIMESTAMP, this.val$timestamp);
|
|
CrashlyticsController.access$2400(this.this$0).logEvent(CrashlyticsController.FIREBASE_ANALYTICS_ORIGIN_CRASHLYTICS, "_ae", bundle);
|
|
blockingCrashEventListener.awaitEvent();
|
|
CrashlyticsController.access$2600(this.this$0).setCrashlyticsOriginEventListener(null);
|
|
return null;
|
|
}
|
|
});
|
|
int i2 = a + 37;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return call;
|
|
}
|
|
|
|
private boolean firebaseCrashExists() {
|
|
int i = 2 % 2;
|
|
int i2 = a + 61;
|
|
e = i2 % 128;
|
|
boolean z = false;
|
|
try {
|
|
if (i2 % 2 == 0) {
|
|
Class.forName("com.google.firebase.crash.FirebaseCrash");
|
|
} else {
|
|
Class.forName("com.google.firebase.crash.FirebaseCrash");
|
|
z = true;
|
|
}
|
|
} catch (ClassNotFoundException unused) {
|
|
}
|
|
return z;
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
final class ReportUploaderHandlingExceptionCheck implements ReportUploader.HandlingExceptionCheck {
|
|
final CrashlyticsController this$0;
|
|
|
|
private ReportUploaderHandlingExceptionCheck(CrashlyticsController crashlyticsController) {
|
|
this.this$0 = crashlyticsController;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.report.ReportUploader.HandlingExceptionCheck
|
|
public final boolean isHandlingException() {
|
|
return this.this$0.isHandlingException();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
final class ReportUploaderFilesProvider implements ReportUploader.ReportFilesProvider {
|
|
final CrashlyticsController this$0;
|
|
|
|
private ReportUploaderFilesProvider(CrashlyticsController crashlyticsController) {
|
|
this.this$0 = crashlyticsController;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.report.ReportUploader.ReportFilesProvider
|
|
public final File[] getCompleteSessionFiles() {
|
|
return this.this$0.listCompleteSessionFiles();
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.report.ReportUploader.ReportFilesProvider
|
|
public final File[] getNativeReportFiles() {
|
|
return this.this$0.listNativeSessionFileDirectories();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static final class SendReportRunnable implements Runnable {
|
|
private final Context context;
|
|
private final boolean dataCollectionToken;
|
|
private final Report report;
|
|
private final ReportUploader reportUploader;
|
|
|
|
public SendReportRunnable(Context context, Report report, ReportUploader reportUploader, boolean z) {
|
|
this.context = context;
|
|
this.report = report;
|
|
this.reportUploader = reportUploader;
|
|
this.dataCollectionToken = z;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
if (CommonUtils.canTryConnection(this.context)) {
|
|
Logger.getLogger().d("Attempting to send crash report at time of crash...");
|
|
this.reportUploader.uploadReport(this.report, this.dataCollectionToken);
|
|
}
|
|
}
|
|
}
|
|
|
|
static List<NativeSessionFile> getNativeSessionFiles(NativeSessionFileProvider nativeSessionFileProvider, String str, Context context, File file, byte[] bArr) {
|
|
byte[] bArr2;
|
|
int i = 2 % 2;
|
|
MetaDataStore metaDataStore = new MetaDataStore(file);
|
|
File userDataFileForSession = metaDataStore.getUserDataFileForSession(str);
|
|
File keysFileForSession = metaDataStore.getKeysFileForSession(str);
|
|
try {
|
|
bArr2 = NativeFileUtils.binaryImagesJsonFromMapsFile(nativeSessionFileProvider.getBinaryImagesFile(), context);
|
|
int i2 = e + 93;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
} catch (Exception unused) {
|
|
bArr2 = null;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
arrayList.add(new BytesBackedNativeSessionFile("logs_file", "logs", bArr));
|
|
arrayList.add(new BytesBackedNativeSessionFile("binary_images_file", "binaryImages", bArr2));
|
|
arrayList.add(new FileBackedNativeSessionFile("crash_meta_file", "metadata", nativeSessionFileProvider.getMetadataFile()));
|
|
arrayList.add(new FileBackedNativeSessionFile("session_meta_file", "session", nativeSessionFileProvider.getSessionFile()));
|
|
arrayList.add(new FileBackedNativeSessionFile("app_meta_file", "app", nativeSessionFileProvider.getAppFile()));
|
|
arrayList.add(new FileBackedNativeSessionFile("device_meta_file", "device", nativeSessionFileProvider.getDeviceFile()));
|
|
arrayList.add(new FileBackedNativeSessionFile("os_meta_file", "os", nativeSessionFileProvider.getOsFile()));
|
|
arrayList.add(new FileBackedNativeSessionFile("minidump_file", "minidump", nativeSessionFileProvider.getMinidumpFile()));
|
|
arrayList.add(new FileBackedNativeSessionFile("user_meta_file", "user", userDataFileForSession));
|
|
arrayList.add(new FileBackedNativeSessionFile("keys_file", "keys", keysFileForSession));
|
|
return arrayList;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static final class LogFileDirectoryProvider implements LogFileManager.DirectoryProvider {
|
|
private static final String LOG_FILES_DIR = "log-files";
|
|
private final FileStore rootFileStore;
|
|
|
|
public LogFileDirectoryProvider(FileStore fileStore) {
|
|
this.rootFileStore = fileStore;
|
|
}
|
|
|
|
@Override // com.google.firebase.crashlytics.internal.log.LogFileManager.DirectoryProvider
|
|
public final File getLogFileDir() {
|
|
File file = new File(this.rootFileStore.getFilesDir(), LOG_FILES_DIR);
|
|
if (!file.exists()) {
|
|
file.mkdirs();
|
|
}
|
|
return file;
|
|
}
|
|
}
|
|
|
|
static void d() {
|
|
b = -9155291536311187799L;
|
|
}
|
|
|
|
UserMetadata getUserMetadata() {
|
|
UserMetadata userMetadata;
|
|
int i = 2 % 2;
|
|
int i2 = a;
|
|
int i3 = i2 + 29;
|
|
e = i3 % 128;
|
|
if (i3 % 2 == 0) {
|
|
userMetadata = this.userMetadata;
|
|
int i4 = 48 / 0;
|
|
} else {
|
|
userMetadata = this.userMetadata;
|
|
}
|
|
int i5 = i2 + 123;
|
|
e = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return userMetadata;
|
|
}
|
|
|
|
private Context getContext() {
|
|
int i = 2 % 2;
|
|
int i2 = e + 99;
|
|
int i3 = i2 % 128;
|
|
a = i3;
|
|
if (i2 % 2 != 0) {
|
|
throw null;
|
|
}
|
|
Context context = this.context;
|
|
int i4 = i3 + 63;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return context;
|
|
}
|
|
|
|
private File[] ensureFileArrayNotNull(File[] fileArr) {
|
|
int i = 2 % 2;
|
|
if (fileArr == null) {
|
|
int i2 = e + 101;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
fileArr = new File[0];
|
|
}
|
|
int i4 = e + 123;
|
|
a = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return fileArr;
|
|
}
|
|
|
|
static /* synthetic */ Pattern access$000() {
|
|
int i = 2 % 2;
|
|
int i2 = e + 91;
|
|
int i3 = i2 % 128;
|
|
a = i3;
|
|
int i4 = i2 % 2;
|
|
Pattern pattern = SESSION_FILE_PATTERN;
|
|
int i5 = i3 + 69;
|
|
e = i5 % 128;
|
|
if (i5 % 2 == 0) {
|
|
int i6 = 67 / 0;
|
|
}
|
|
return pattern;
|
|
}
|
|
}
|