what-the-bank/sources/com/google/firebase/crashlytics/internal/log/QueueFileLogStore.java

447 lines
17 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.crashlytics.internal.log;
import android.graphics.Color;
import android.media.AudioTrack;
import android.os.Process;
import android.text.AndroidCharacter;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.ExpandableListView;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.firebase.crashlytics.internal.Logger;
import com.google.firebase.crashlytics.internal.common.CommonUtils;
import com.google.firebase.crashlytics.internal.log.QueueFile;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.util.Locale;
import o.C4593bdB;
import o.xzZ;
import okhttp3.internal.http2.Http2Connection;
/* loaded from: classes2.dex */
class QueueFileLogStore implements FileLogStore {
private static final Charset UTF_8;
private static long b;
private static int d;
private QueueFile logFile;
private final int maxLogSize;
private final File workingFile;
private static final byte[] $$a = {119, 73, 35, -58};
private static final int $$b = 158;
private static int $10 = 0;
private static int $11 = 1;
private static int c = 0;
/* JADX WARN: Removed duplicated region for block: B:10:0x0024 */
/* JADX WARN: Removed duplicated region for block: B:7:0x001c */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0024 -> B:4:0x0028). 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(byte r5, byte r6, int r7, java.lang.Object[] r8) {
/*
int r5 = r5 * 4
int r5 = r5 + 4
byte[] r0 = com.google.firebase.crashlytics.internal.log.QueueFileLogStore.$$a
int r7 = r7 + 77
int r6 = r6 * 4
int r1 = 1 - r6
byte[] r1 = new byte[r1]
r2 = 0
int r6 = 0 - r6
if (r0 != 0) goto L16
r4 = r5
r3 = r2
goto L28
L16:
r3 = r2
L17:
byte r4 = (byte) r7
r1[r3] = r4
if (r3 != r6) goto L24
java.lang.String r5 = new java.lang.String
r5.<init>(r1, r2)
r8[r2] = r5
return
L24:
r4 = r0[r5]
int r3 = r3 + 1
L28:
int r5 = r5 + 1
int r7 = r7 + r4
goto L17
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.crashlytics.internal.log.QueueFileLogStore.f(byte, byte, int, java.lang.Object[]):void");
}
static {
d = 1;
b();
UTF_8 = Charset.forName("UTF-8");
int i = c + 65;
d = i % 128;
int i2 = i % 2;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class LogBytes {
public final byte[] bytes;
public final int offset;
final QueueFileLogStore this$0;
LogBytes(QueueFileLogStore queueFileLogStore, byte[] bArr, int i) {
this.this$0 = queueFileLogStore;
this.bytes = bArr;
this.offset = i;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public QueueFileLogStore(File file, int i) {
this.workingFile = file;
this.maxLogSize = i;
}
@Override // com.google.firebase.crashlytics.internal.log.FileLogStore
public void writeToLog(long j, String str) {
int i = 2 % 2;
int i2 = d + 117;
c = i2 % 128;
int i3 = i2 % 2;
openLogFile();
doWriteToLog(j, str);
int i4 = d + 37;
c = i4 % 128;
int i5 = i4 % 2;
}
@Override // com.google.firebase.crashlytics.internal.log.FileLogStore
public byte[] getLogAsBytes() {
int i = 2 % 2;
LogBytes logBytes = getLogBytes();
if (logBytes != null) {
byte[] bArr = new byte[logBytes.offset];
System.arraycopy(logBytes.bytes, 0, bArr, 0, logBytes.offset);
int i2 = d + 3;
c = i2 % 128;
int i3 = i2 % 2;
return bArr;
}
int i4 = c + 71;
d = i4 % 128;
if (i4 % 2 == 0) {
int i5 = 26 / 0;
}
return null;
}
@Override // com.google.firebase.crashlytics.internal.log.FileLogStore
public String getLogAsString() {
int i = 2 % 2;
int i2 = c + 79;
d = i2 % 128;
int i3 = i2 % 2;
byte[] logAsBytes = getLogAsBytes();
String str = logAsBytes != null ? new String(logAsBytes, UTF_8) : null;
int i4 = c + 87;
d = i4 % 128;
if (i4 % 2 == 0) {
int i5 = 36 / 0;
}
return str;
}
private static void a(char[] cArr, int i, Object[] objArr) {
int i2 = 2 % 2;
C4593bdB c4593bdB = new C4593bdB();
c4593bdB.a = i;
int length = cArr.length;
long[] jArr = new long[length];
c4593bdB.e = 0;
while (c4593bdB.e < cArr.length) {
int i3 = $10 + 27;
$11 = i3 % 128;
if (i3 % 2 == 0) {
int i4 = c4593bdB.e;
try {
Object[] objArr2 = {Integer.valueOf(cArr[c4593bdB.e]), c4593bdB, c4593bdB};
Object obj = xzZ.y.get(-1229953068);
if (obj == null) {
Class cls = (Class) xzZ.c(401 - Process.getGidForName(""), 5 - View.MeasureSpec.getMode(0), (char) (21608 - Color.blue(0)));
byte b2 = (byte) 0;
byte b3 = b2;
Object[] objArr3 = new Object[1];
f(b2, b3, b3, objArr3);
obj = cls.getMethod((String) objArr3[0], Integer.TYPE, Object.class, Object.class);
xzZ.y.put(-1229953068, obj);
}
jArr[i4] = ((Long) ((Method) obj).invoke(null, objArr2)).longValue() ^ (b ^ (-6958928035870403642L));
Object[] objArr4 = {c4593bdB, c4593bdB};
Object obj2 = xzZ.y.get(-1143917229);
if (obj2 == null) {
Class cls2 = (Class) xzZ.c(238 - View.resolveSizeAndState(0, 0, 0), 6 - (ViewConfiguration.getZoomControlsTimeout() > 0L ? 1 : (ViewConfiguration.getZoomControlsTimeout() == 0L ? 0 : -1)), (char) (ExpandableListView.getPackedPositionChild(0L) + 1));
byte b4 = (byte) 0;
byte b5 = b4;
Object[] objArr5 = new Object[1];
f(b4, b5, (byte) (b5 + 1), objArr5);
obj2 = cls2.getMethod((String) objArr5[0], Object.class, Object.class);
xzZ.y.put(-1143917229, obj2);
}
((Method) obj2).invoke(null, objArr4);
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
} else {
int i5 = c4593bdB.e;
Object[] objArr6 = {Integer.valueOf(cArr[c4593bdB.e]), c4593bdB, c4593bdB};
Object obj3 = xzZ.y.get(-1229953068);
if (obj3 == null) {
Class cls3 = (Class) xzZ.c(402 - (ViewConfiguration.getMinimumFlingVelocity() >> 16), View.MeasureSpec.getSize(0) + 5, (char) (AndroidCharacter.getMirror('0') + 21560));
byte b6 = (byte) 0;
byte b7 = b6;
Object[] objArr7 = new Object[1];
f(b6, b7, b7, objArr7);
obj3 = cls3.getMethod((String) objArr7[0], Integer.TYPE, Object.class, Object.class);
xzZ.y.put(-1229953068, obj3);
}
jArr[i5] = ((Long) ((Method) obj3).invoke(null, objArr6)).longValue() ^ (b ^ (-6958928035870403642L));
Object[] objArr8 = {c4593bdB, c4593bdB};
Object obj4 = xzZ.y.get(-1143917229);
if (obj4 == null) {
Class cls4 = (Class) xzZ.c(ExpandableListView.getPackedPositionGroup(0L) + 238, TextUtils.getTrimmedLength("") + 5, (char) (Color.rgb(0, 0, 0) + Http2Connection.OKHTTP_CLIENT_WINDOW_SIZE));
byte b8 = (byte) 0;
byte b9 = b8;
Object[] objArr9 = new Object[1];
f(b8, b9, (byte) (b9 + 1), objArr9);
obj4 = cls4.getMethod((String) objArr9[0], Object.class, Object.class);
xzZ.y.put(-1143917229, obj4);
}
((Method) obj4).invoke(null, objArr8);
}
}
char[] cArr2 = new char[length];
c4593bdB.e = 0;
while (c4593bdB.e < cArr.length) {
int i6 = $10 + 23;
$11 = i6 % 128;
if (i6 % 2 == 0) {
cArr2[c4593bdB.e] = (char) jArr[c4593bdB.e];
try {
Object[] objArr10 = {c4593bdB, c4593bdB};
Object obj5 = xzZ.y.get(-1143917229);
if (obj5 == null) {
Class cls5 = (Class) xzZ.c((Process.myPid() >> 22) + 238, 6 - (ViewConfiguration.getGlobalActionKeyTimeout() > 0L ? 1 : (ViewConfiguration.getGlobalActionKeyTimeout() == 0L ? 0 : -1)), (char) ((-1) - TextUtils.lastIndexOf("", '0', 0)));
byte b10 = (byte) 0;
byte b11 = b10;
Object[] objArr11 = new Object[1];
f(b10, b11, (byte) (b11 + 1), objArr11);
obj5 = cls5.getMethod((String) objArr11[0], Object.class, Object.class);
xzZ.y.put(-1143917229, obj5);
}
((Method) obj5).invoke(null, objArr10);
throw null;
} catch (Throwable th2) {
Throwable cause2 = th2.getCause();
if (cause2 == null) {
throw th2;
}
throw cause2;
}
}
cArr2[c4593bdB.e] = (char) jArr[c4593bdB.e];
Object[] objArr12 = {c4593bdB, c4593bdB};
Object obj6 = xzZ.y.get(-1143917229);
if (obj6 == null) {
Class cls6 = (Class) xzZ.c(KeyEvent.normalizeMetaState(0) + 238, 5 - (ViewConfiguration.getKeyRepeatTimeout() >> 16), (char) ((AudioTrack.getMaxVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMaxVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) - 1));
byte b12 = (byte) 0;
byte b13 = b12;
Object[] objArr13 = new Object[1];
f(b12, b13, (byte) (b13 + 1), objArr13);
obj6 = cls6.getMethod((String) objArr13[0], Object.class, Object.class);
xzZ.y.put(-1143917229, obj6);
}
((Method) obj6).invoke(null, objArr12);
}
objArr[0] = new String(cArr2);
}
private LogBytes getLogBytes() {
int i = 2 % 2;
int i2 = c + 103;
d = i2 % 128;
Object obj = null;
if (i2 % 2 != 0) {
if (!this.workingFile.exists()) {
return null;
}
openLogFile();
QueueFile queueFile = this.logFile;
if (queueFile == null) {
return null;
}
int[] iArr = {0};
byte[] bArr = new byte[queueFile.usedBytes()];
try {
this.logFile.forEach(new QueueFile.ElementReader(this, bArr, iArr) { // from class: com.google.firebase.crashlytics.internal.log.QueueFileLogStore.1
final QueueFileLogStore this$0;
final byte[] val$logBytes;
final int[] val$offsetHolder;
{
this.this$0 = this;
this.val$logBytes = bArr;
this.val$offsetHolder = iArr;
}
@Override // com.google.firebase.crashlytics.internal.log.QueueFile.ElementReader
public void read(InputStream inputStream, int i3) throws IOException {
try {
inputStream.read(this.val$logBytes, this.val$offsetHolder[0], i3);
int[] iArr2 = this.val$offsetHolder;
iArr2[0] = iArr2[0] + i3;
} finally {
inputStream.close();
}
}
});
int i3 = d + 73;
c = i3 % 128;
int i4 = i3 % 2;
} catch (IOException e) {
Logger.getLogger().e("A problem occurred while reading the Crashlytics log file.", e);
} catch (Exception e2) {
throw e2;
}
LogBytes logBytes = new LogBytes(this, bArr, iArr[0]);
int i5 = c + 95;
d = i5 % 128;
if (i5 % 2 != 0) {
return logBytes;
}
obj.hashCode();
throw null;
}
this.workingFile.exists();
obj.hashCode();
throw null;
}
@Override // com.google.firebase.crashlytics.internal.log.FileLogStore
public void closeLogFile() {
int i = 2 % 2;
int i2 = c + 125;
d = i2 % 128;
int i3 = i2 % 2;
CommonUtils.closeOrLog(this.logFile, "There was a problem closing the Crashlytics log file.");
this.logFile = null;
int i4 = c + 13;
d = i4 % 128;
if (i4 % 2 == 0) {
int i5 = 98 / 0;
}
}
@Override // com.google.firebase.crashlytics.internal.log.FileLogStore
public void deleteLogFile() {
int i = 2 % 2;
int i2 = d + 59;
c = i2 % 128;
if (i2 % 2 != 0) {
closeLogFile();
this.workingFile.delete();
int i3 = 86 / 0;
} else {
closeLogFile();
this.workingFile.delete();
}
int i4 = d + 47;
c = i4 % 128;
if (i4 % 2 == 0) {
return;
}
Object obj = null;
obj.hashCode();
throw null;
}
private void openLogFile() {
int i = 2 % 2;
int i2 = c + 99;
d = i2 % 128;
int i3 = i2 % 2;
if (this.logFile == null) {
try {
this.logFile = new QueueFile(this.workingFile);
int i4 = d + 7;
c = i4 % 128;
if (i4 % 2 != 0) {
int i5 = 7 / 0;
return;
}
return;
} catch (IOException e) {
Logger logger = Logger.getLogger();
StringBuilder sb = new StringBuilder("Could not open log file: ");
sb.append(this.workingFile);
logger.e(sb.toString(), e);
}
}
int i6 = d + 5;
c = i6 % 128;
int i7 = i6 % 2;
}
private void doWriteToLog(long j, String str) {
int i = 2 % 2;
if (this.logFile == null) {
return;
}
if (str == null) {
Object[] objArr = new Object[1];
a(new char[]{41071, 3169, 63559, 42066}, 44052 - (ExpandableListView.getPackedPositionForChild(0, 0) > 0L ? 1 : (ExpandableListView.getPackedPositionForChild(0, 0) == 0L ? 0 : -1)), objArr);
str = ((String) objArr[0]).intern();
}
try {
int i2 = this.maxLogSize / 4;
if (str.length() > i2) {
StringBuilder sb = new StringBuilder("...");
sb.append(str.substring(str.length() - i2));
str = sb.toString();
}
this.logFile.add(String.format(Locale.US, "%d %s%n", Long.valueOf(j), str.replaceAll("\r", " ").replaceAll("\n", " ")).getBytes(UTF_8));
while (!this.logFile.isEmpty()) {
int i3 = d + 31;
c = i3 % 128;
if (i3 % 2 != 0) {
this.logFile.usedBytes();
throw null;
}
if (this.logFile.usedBytes() <= this.maxLogSize) {
return;
}
int i4 = d + 1;
c = i4 % 128;
int i5 = i4 % 2;
this.logFile.remove();
}
} catch (IOException e) {
Logger.getLogger().e("There was a problem writing to the Crashlytics log.", e);
}
}
static void b() {
b = 1173985987409458119L;
}
}