what-the-bank/sources/com/google/firebase/firestore/local/SQLiteSchema.java

1436 lines
57 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.firestore.local;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.graphics.Color;
import android.os.Process;
import android.os.SystemClock;
import android.telephony.cdma.CdmaCellLocation;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
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.common.base.Ascii;
import com.google.firebase.firestore.local.MemoryIndexManager;
import com.google.firebase.firestore.local.SQLitePersistence;
import com.google.firebase.firestore.model.ResourcePath;
import com.google.firebase.firestore.proto.Target;
import com.google.firebase.firestore.util.Assert;
import com.google.firebase.firestore.util.Consumer;
import com.google.firebase.firestore.util.Function;
import com.google.firebase.firestore.util.Logger;
import com.google.protobuf.InvalidProtocolBufferException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import o.dQY;
import o.xzZ;
import org.jmrtd.lds.CVCAFile;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class SQLiteSchema {
private final SQLiteDatabase db;
private final LocalSerializer serializer;
private static final byte[] $$a = {CVCAFile.CAR_TAG, 74, -6, Ascii.DEL};
private static final int $$b = 53;
private static int $10 = 0;
private static int $11 = 1;
private static int c = 0;
private static int e = 1;
private static char[] b = {36834};
private static long a = 963184002254138255L;
/* 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, int r6, short r7, java.lang.Object[] r8) {
/*
byte[] r0 = com.google.firebase.firestore.local.SQLiteSchema.$$a
int r5 = r5 * 4
int r5 = 4 - r5
int r6 = r6 + 98
int r7 = r7 * 3
int r1 = 1 - r7
byte[] r1 = new byte[r1]
r2 = 0
int r7 = 0 - r7
if (r0 != 0) goto L16
r4 = r7
r3 = r2
goto L28
L16:
r3 = r2
L17:
byte r4 = (byte) r6
r1[r3] = r4
if (r3 != r7) 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 r4 = -r4
int r6 = r6 + r4
int r5 = r5 + 1
goto L17
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.firestore.local.SQLiteSchema.f(byte, int, short, java.lang.Object[]):void");
}
/* JADX INFO: Access modifiers changed from: package-private */
public SQLiteSchema(SQLiteDatabase sQLiteDatabase, LocalSerializer localSerializer) {
this.db = sQLiteDatabase;
this.serializer = localSerializer;
}
/* JADX INFO: Access modifiers changed from: package-private */
public void runSchemaUpgrades(int i) {
int i2 = 2 % 2;
int i3 = e + 119;
c = i3 % 128;
runSchemaUpgrades(i, i3 % 2 != 0 ? 29 : 16);
}
private static void d(char c2, int i, int i2, Object[] objArr) {
int i3 = 2;
int i4 = 2 % 2;
dQY dqy = new dQY();
long[] jArr = new long[i2];
dqy.a = 0;
while (dqy.a < i2) {
int i5 = $10 + 47;
$11 = i5 % 128;
if (i5 % i3 == 0) {
int i6 = dqy.a;
try {
Object[] objArr2 = {Integer.valueOf(b[i - dqy.a])};
Object obj = xzZ.y.get(1095064095);
if (obj == null) {
Class cls = (Class) xzZ.c(KeyEvent.keyCodeFromString("") + 308, (ViewConfiguration.getTapTimeout() >> 16) + 5, (char) ((ViewConfiguration.getPressedStateDuration() >> 16) + 32797));
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);
xzZ.y.put(1095064095, obj);
}
Object[] objArr4 = {Long.valueOf(((Long) ((Method) obj).invoke(null, objArr2)).longValue()), Long.valueOf(dqy.a), Long.valueOf(a), Integer.valueOf(c2)};
Object obj2 = xzZ.y.get(-548438098);
if (obj2 == null) {
Class cls2 = (Class) xzZ.c(412 - (ViewConfiguration.getScrollDefaultDelay() >> 16), 5 - Color.red(0), (char) TextUtils.getOffsetAfter("", 0));
byte b4 = (byte) 0;
byte b5 = (byte) (b4 + 1);
Object[] objArr5 = new Object[1];
f(b4, b5, (byte) (b5 - 1), objArr5);
obj2 = cls2.getMethod((String) objArr5[0], Long.TYPE, Long.TYPE, Long.TYPE, Integer.TYPE);
xzZ.y.put(-548438098, obj2);
}
jArr[i6] = ((Long) ((Method) obj2).invoke(null, objArr4)).longValue();
Object[] objArr6 = {dqy, dqy};
Object obj3 = xzZ.y.get(1071125919);
if (obj3 == null) {
Class cls3 = (Class) xzZ.c(407 - (ViewConfiguration.getTouchSlop() >> 8), ((Process.getThreadPriority(0) + 20) >> 6) + 5, (char) (29233 - TextUtils.indexOf((CharSequence) "", '0')));
byte b6 = (byte) 0;
Object[] objArr7 = new Object[1];
f(b6, (byte) (b6 | 8), b6, objArr7);
obj3 = cls3.getMethod((String) objArr7[0], Object.class, Object.class);
xzZ.y.put(1071125919, obj3);
}
((Method) obj3).invoke(null, objArr6);
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
} else {
int i7 = dqy.a;
Object[] objArr8 = {Integer.valueOf(b[i + dqy.a])};
Object obj4 = xzZ.y.get(1095064095);
if (obj4 == null) {
Class cls4 = (Class) xzZ.c(TextUtils.getCapsMode("", 0, 0) + 308, (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) > BitmapDescriptorFactory.HUE_RED ? 1 : (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 5, (char) (TextUtils.lastIndexOf("", '0') + 32798));
byte b7 = (byte) 0;
byte b8 = b7;
Object[] objArr9 = new Object[1];
f(b7, b8, b8, objArr9);
obj4 = cls4.getMethod((String) objArr9[0], Integer.TYPE);
xzZ.y.put(1095064095, obj4);
}
Object[] objArr10 = {Long.valueOf(((Long) ((Method) obj4).invoke(null, objArr8)).longValue()), Long.valueOf(dqy.a), Long.valueOf(a), Integer.valueOf(c2)};
Object obj5 = xzZ.y.get(-548438098);
if (obj5 == null) {
Class cls5 = (Class) xzZ.c((ViewConfiguration.getLongPressTimeout() >> 16) + 412, (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1)) + 4, (char) Color.green(0));
byte b9 = (byte) 0;
byte b10 = (byte) (b9 + 1);
Object[] objArr11 = new Object[1];
f(b9, b10, (byte) (b10 - 1), objArr11);
obj5 = cls5.getMethod((String) objArr11[0], Long.TYPE, Long.TYPE, Long.TYPE, Integer.TYPE);
xzZ.y.put(-548438098, obj5);
}
jArr[i7] = ((Long) ((Method) obj5).invoke(null, objArr10)).longValue();
Object[] objArr12 = {dqy, dqy};
Object obj6 = xzZ.y.get(1071125919);
if (obj6 == null) {
Class cls6 = (Class) xzZ.c((ViewConfiguration.getWindowTouchSlop() >> 8) + 407, (ViewConfiguration.getKeyRepeatDelay() >> 16) + 5, (char) (Color.alpha(0) + 29234));
byte b11 = (byte) 0;
Object[] objArr13 = new Object[1];
f(b11, (byte) (b11 | 8), b11, objArr13);
obj6 = cls6.getMethod((String) objArr13[0], Object.class, Object.class);
xzZ.y.put(1071125919, obj6);
}
((Method) obj6).invoke(null, objArr12);
}
i3 = 2;
}
char[] cArr = new char[i2];
dqy.a = 0;
while (dqy.a < i2) {
cArr[dqy.a] = (char) jArr[dqy.a];
Object[] objArr14 = {dqy, dqy};
Object obj7 = xzZ.y.get(1071125919);
if (obj7 == null) {
Class cls7 = (Class) xzZ.c(407 - (ViewConfiguration.getScrollDefaultDelay() >> 16), 5 - View.resolveSizeAndState(0, 0, 0), (char) (Color.red(0) + 29234));
byte b12 = (byte) 0;
Object[] objArr15 = new Object[1];
f(b12, (byte) (b12 | 8), b12, objArr15);
obj7 = cls7.getMethod((String) objArr15[0], Object.class, Object.class);
xzZ.y.put(1071125919, obj7);
}
((Method) obj7).invoke(null, objArr14);
int i8 = $11 + 21;
$10 = i8 % 128;
int i9 = i8 % 2;
}
objArr[0] = new String(cArr);
}
void runSchemaUpgrades(int i, int i2) {
int i3 = 2 % 2;
long currentTimeMillis = System.currentTimeMillis();
if (i <= 0 && i2 > 0) {
createV1MutationQueue();
createV1TargetCache();
createV1RemoteDocumentCache();
}
if (i < 3) {
int i4 = e + 67;
c = i4 % 128;
if (i4 % 2 == 0 ? i2 >= 3 : i2 >= 2) {
if (i != 0) {
dropV1TargetCache();
createV1TargetCache();
}
}
}
if (i < 4 && i2 >= 4) {
ensureTargetGlobal();
addTargetCount();
}
if (i < 5) {
int i5 = c + 9;
e = i5 % 128;
if (i5 % 2 != 0 ? i2 >= 5 : i2 >= 4) {
addSequenceNumber();
}
}
if (i < 6 && i2 >= 6) {
removeAcknowledgedMutations();
}
if (i < 7) {
int i6 = c + 109;
e = i6 % 128;
if (i6 % 2 != 0 ? i2 >= 7 : i2 >= 96) {
ensureSequenceNumbers();
}
}
if (i < 8 && i2 >= 8) {
int i7 = e + 35;
c = i7 % 128;
int i8 = i7 % 2;
createV8CollectionParentsIndex();
}
if (i < 9 && i2 >= 9) {
int i9 = e + 95;
c = i9 % 128;
int i10 = i9 % 2;
if (hasReadTime()) {
dropLastLimboFreeSnapshotVersion();
} else {
addReadTime();
}
}
if (i == 9 && i2 >= 10) {
dropLastLimboFreeSnapshotVersion();
}
if (i < 11 && i2 >= 11) {
rewriteCanonicalIds();
}
if (i < 12 && i2 >= 12) {
int i11 = c + 107;
e = i11 % 128;
if (i11 % 2 == 0) {
createBundleCache();
throw null;
}
createBundleCache();
}
if (i < 13 && i2 >= 13) {
addPathLength();
ensurePathLength();
}
if (i < 14 && i2 >= 14) {
createOverlays();
createDataMigrationTable();
addPendingDataMigration(Persistence.DATA_MIGRATION_BUILD_OVERLAYS);
}
if (i < 15 && i2 >= 15) {
ensureReadTime();
}
if (i < 16 && i2 >= 16) {
createFieldIndex();
}
Logger.debug("SQLiteSchema", "Migration from version %s to %s took %s milliseconds", Integer.valueOf(i), Integer.valueOf(i2), Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
}
private void ifTablesDontExist(String[] strArr, Runnable runnable) {
String obj;
int i = 2 % 2;
StringBuilder sb = new StringBuilder("[");
sb.append(TextUtils.join(", ", strArr));
sb.append("]");
String obj2 = sb.toString();
boolean z = false;
for (int i2 = 0; i2 < strArr.length; i2++) {
String str = strArr[i2];
boolean tableExists = tableExists(str);
if (i2 == 0) {
int i3 = c + 39;
int i4 = i3 % 128;
e = i4;
if (i3 % 2 == 0) {
Object obj3 = null;
obj3.hashCode();
throw null;
}
int i5 = i4 + 33;
c = i5 % 128;
int i6 = i5 % 2;
z = tableExists;
} else if (tableExists != z) {
StringBuilder sb2 = new StringBuilder("Expected all of ");
sb2.append(obj2);
sb2.append(" to either exist or not, but ");
String obj4 = sb2.toString();
if (z) {
StringBuilder sb3 = new StringBuilder();
sb3.append(obj4);
sb3.append(strArr[0]);
sb3.append(" exists and ");
sb3.append(str);
sb3.append(" does not");
obj = sb3.toString();
} else {
StringBuilder sb4 = new StringBuilder();
sb4.append(obj4);
sb4.append(strArr[0]);
sb4.append(" does not exist and ");
sb4.append(str);
sb4.append(" does");
obj = sb4.toString();
}
throw new IllegalStateException(obj);
}
}
if (z) {
StringBuilder sb5 = new StringBuilder("Skipping migration because all of ");
sb5.append(obj2);
sb5.append(" already exist");
Logger.debug("SQLiteSchema", sb5.toString(), new Object[0]);
return;
}
runnable.run();
int i7 = c + 75;
e = i7 % 128;
int i8 = i7 % 2;
}
private void createV1MutationQueue() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"mutation_queues", "mutations", "document_mutations"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda3
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m222xc194b013();
}
{
this.f$0 = this;
}
});
int i2 = c + 57;
e = i2 % 128;
int i3 = i2 % 2;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createV1MutationQueue$0$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m222xc194b013() {
int i = 2 % 2;
int i2 = c + 105;
e = i2 % 128;
Object obj = null;
if (i2 % 2 != 0) {
this.db.execSQL("CREATE TABLE mutation_queues (uid TEXT PRIMARY KEY, last_acknowledged_batch_id INTEGER, last_stream_token BLOB)");
this.db.execSQL("CREATE TABLE mutations (uid TEXT, batch_id INTEGER, mutations BLOB, PRIMARY KEY (uid, batch_id))");
this.db.execSQL("CREATE TABLE document_mutations (uid TEXT, path TEXT, batch_id INTEGER, PRIMARY KEY (uid, path, batch_id))");
int i3 = e + 123;
c = i3 % 128;
if (i3 % 2 == 0) {
return;
}
obj.hashCode();
throw null;
}
this.db.execSQL("CREATE TABLE mutation_queues (uid TEXT PRIMARY KEY, last_acknowledged_batch_id INTEGER, last_stream_token BLOB)");
this.db.execSQL("CREATE TABLE mutations (uid TEXT, batch_id INTEGER, mutations BLOB, PRIMARY KEY (uid, batch_id))");
this.db.execSQL("CREATE TABLE document_mutations (uid TEXT, path TEXT, batch_id INTEGER, PRIMARY KEY (uid, path, batch_id))");
obj.hashCode();
throw null;
}
private void removeAcknowledgedMutations() {
int i = 2 % 2;
new SQLitePersistence.Query(this.db, "SELECT uid, last_acknowledged_batch_id FROM mutation_queues").forEach(new Consumer(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda15
public final SQLiteSchema f$0;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
this.f$0.m228x4d5efda4((Cursor) obj);
}
{
this.f$0 = this;
}
});
int i2 = e + 77;
c = i2 % 128;
int i3 = i2 % 2;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$removeAcknowledgedMutations$1$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m227x5bb55785(String str, Cursor cursor) {
int i = 2 % 2;
int i2 = e + 71;
c = i2 % 128;
int i3 = i2 % 2;
removeMutationBatch(str, cursor.getInt(0));
int i4 = e + 37;
c = i4 % 128;
if (i4 % 2 != 0) {
int i5 = 80 / 0;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$removeAcknowledgedMutations$2$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m228x4d5efda4(Cursor cursor) {
int i = 2 % 2;
final String string = cursor.getString(0);
new SQLitePersistence.Query(this.db, "SELECT batch_id FROM mutations WHERE uid = ? AND batch_id <= ?").binding(string, Long.valueOf(cursor.getLong(1))).forEach(new Consumer(this, string) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda0
public final SQLiteSchema f$0;
public final String f$1;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
this.f$0.m227x5bb55785(this.f$1, (Cursor) obj);
}
{
this.f$0 = this;
this.f$1 = string;
}
});
int i2 = e + 69;
c = i2 % 128;
int i3 = i2 % 2;
}
private void removeMutationBatch(String str, int i) {
int i2 = 2 % 2;
SQLiteStatement compileStatement = this.db.compileStatement("DELETE FROM mutations WHERE uid = ? AND batch_id = ?");
boolean z = true;
compileStatement.bindString(1, str);
compileStatement.bindLong(2, i);
if (compileStatement.executeUpdateDelete() == 0) {
int i3 = e;
int i4 = i3 + 31;
c = i4 % 128;
int i5 = i4 % 2;
int i6 = i3 + 123;
c = i6 % 128;
int i7 = i6 % 2;
z = false;
}
Assert.hardAssert(z, "Mutation batch (%s, %d) did not exist", str, Integer.valueOf(i));
this.db.execSQL("DELETE FROM document_mutations WHERE uid = ? AND batch_id = ?", new Object[]{str, Integer.valueOf(i)});
}
private void createV1TargetCache() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"targets", "target_globals", "target_documents"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda9
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m224x3db62447();
}
{
this.f$0 = this;
}
});
int i2 = c + 83;
e = i2 % 128;
if (i2 % 2 != 0) {
return;
}
Object obj = null;
obj.hashCode();
throw null;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createV1TargetCache$3$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m224x3db62447() {
int i = 2 % 2;
int i2 = e + 41;
c = i2 % 128;
int i3 = i2 % 2;
this.db.execSQL("CREATE TABLE targets (target_id INTEGER PRIMARY KEY, canonical_id TEXT, snapshot_version_seconds INTEGER, snapshot_version_nanos INTEGER, resume_token BLOB, last_listen_sequence_number INTEGER,target_proto BLOB)");
this.db.execSQL("CREATE INDEX query_targets ON targets (canonical_id, target_id)");
this.db.execSQL("CREATE TABLE target_globals (highest_target_id INTEGER, highest_listen_sequence_number INTEGER, last_remote_snapshot_version_seconds INTEGER, last_remote_snapshot_version_nanos INTEGER)");
this.db.execSQL("CREATE TABLE target_documents (target_id INTEGER, path TEXT, PRIMARY KEY (target_id, path))");
this.db.execSQL("CREATE INDEX document_targets ON target_documents (path, target_id)");
int i4 = e + 91;
c = i4 % 128;
int i5 = i4 % 2;
}
private void dropV1TargetCache() {
int i = 2 % 2;
if (tableExists("targets")) {
this.db.execSQL("DROP TABLE targets");
int i2 = c + 31;
e = i2 % 128;
int i3 = i2 % 2;
}
if (tableExists("target_globals")) {
int i4 = c + 11;
e = i4 % 128;
if (i4 % 2 == 0) {
this.db.execSQL("DROP TABLE target_globals");
Object obj = null;
obj.hashCode();
throw null;
}
this.db.execSQL("DROP TABLE target_globals");
}
if (tableExists("target_documents")) {
this.db.execSQL("DROP TABLE target_documents");
}
}
private void createV1RemoteDocumentCache() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"remote_documents"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda14
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m223xd80c1c56();
}
{
this.f$0 = this;
}
});
int i2 = e + 19;
c = i2 % 128;
if (i2 % 2 != 0) {
throw null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createV1RemoteDocumentCache$4$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m223xd80c1c56() {
int i = 2 % 2;
int i2 = c + 47;
e = i2 % 128;
if (i2 % 2 != 0) {
this.db.execSQL("CREATE TABLE remote_documents (path TEXT PRIMARY KEY, contents BLOB)");
return;
}
this.db.execSQL("CREATE TABLE remote_documents (path TEXT PRIMARY KEY, contents BLOB)");
Object obj = null;
obj.hashCode();
throw null;
}
private void createFieldIndex() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"index_configuration", "index_state", "index_entries"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda13
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m220x6d36fdb1();
}
{
this.f$0 = this;
}
});
int i2 = c + 115;
e = i2 % 128;
if (i2 % 2 == 0) {
int i3 = 38 / 0;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createFieldIndex$5$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m220x6d36fdb1() {
int i = 2 % 2;
int i2 = e + 23;
c = i2 % 128;
int i3 = i2 % 2;
this.db.execSQL("CREATE TABLE index_configuration (index_id INTEGER, collection_group TEXT, index_proto BLOB, PRIMARY KEY (index_id))");
this.db.execSQL("CREATE TABLE index_state (index_id INTEGER, uid TEXT, sequence_number INTEGER, read_time_seconds INTEGER, read_time_nanos INTEGER, document_key TEXT, largest_batch_id INTEGER, PRIMARY KEY (index_id, uid))");
this.db.execSQL("CREATE TABLE index_entries (index_id INTEGER, uid TEXT, array_value BLOB, directional_value BLOB, document_key TEXT, PRIMARY KEY (index_id, uid, array_value, directional_value, document_key))");
this.db.execSQL("CREATE INDEX read_time ON remote_documents(read_time_seconds, read_time_nanos)");
int i4 = c + 39;
e = i4 % 128;
int i5 = i4 % 2;
}
private void ensureTargetGlobal() {
int i = 2 % 2;
int i2 = e + 107;
c = i2 % 128;
if (i2 % 2 != 0) {
if (DatabaseUtils.queryNumEntries(this.db, "target_globals") == 0) {
return;
}
} else if (DatabaseUtils.queryNumEntries(this.db, "target_globals") == 1) {
return;
}
SQLiteDatabase sQLiteDatabase = this.db;
Object[] objArr = new Object[1];
d((char) ExpandableListView.getPackedPositionGroup(0L), ((byte) KeyEvent.getModifierMetaStateMask()) + 1, -Process.getGidForName(""), objArr);
String intern = ((String) objArr[0]).intern();
Object[] objArr2 = new Object[1];
d((char) TextUtils.getTrimmedLength(""), ViewConfiguration.getEdgeSlop() >> 16, 1 - View.MeasureSpec.makeMeasureSpec(0, 0), objArr2);
String intern2 = ((String) objArr2[0]).intern();
Object[] objArr3 = new Object[1];
d((char) (TypedValue.complexToFloat(0) > BitmapDescriptorFactory.HUE_RED ? 1 : (TypedValue.complexToFloat(0) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), ViewConfiguration.getTapTimeout() >> 16, 1 - Gravity.getAbsoluteGravity(0, 0), objArr3);
String intern3 = ((String) objArr3[0]).intern();
Object[] objArr4 = new Object[1];
d((char) ((Process.getThreadPriority(0) + 20) >> 6), ViewConfiguration.getKeyRepeatDelay() >> 16, (CdmaCellLocation.convertQuartSecToDecDegrees(0) > 0.0d ? 1 : (CdmaCellLocation.convertQuartSecToDecDegrees(0) == 0.0d ? 0 : -1)) + 1, objArr4);
sQLiteDatabase.execSQL("INSERT INTO target_globals (highest_target_id, highest_listen_sequence_number, last_remote_snapshot_version_seconds, last_remote_snapshot_version_nanos) VALUES (?, ?, ?, ?)", new String[]{intern, intern2, intern3, ((String) objArr4[0]).intern()});
int i3 = c + 37;
e = i3 % 128;
int i4 = i3 % 2;
}
/* JADX WARN: Code restructure failed: missing block: B:10:0x0032, code lost:
r6.db.execSQL("ALTER TABLE target_globals ADD COLUMN target_count INTEGER");
r1 = com.google.firebase.firestore.local.SQLiteSchema.c + 25;
com.google.firebase.firestore.local.SQLiteSchema.e = r1 % 128;
r1 = r1 % 2;
*/
/* JADX WARN: Code restructure failed: missing block: B:11:0x005a, code lost:
r6.db.execSQL("ALTER TABLE target_globals ADD COLUMN target_count INTEGER");
r4.hashCode();
*/
/* JADX WARN: Code restructure failed: missing block: B:12:0x0062, code lost:
throw null;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x0022, code lost:
if (tableContainsColumn("target_globals", "target_count") != false) goto L13;
*/
/* JADX WARN: Code restructure failed: missing block: B:4:0x001b, code lost:
if (tableContainsColumn("target_globals", "target_count") == false) goto L10;
*/
/* JADX WARN: Code restructure failed: missing block: B:8:0x0025, code lost:
r1 = com.google.firebase.firestore.local.SQLiteSchema.e + 45;
com.google.firebase.firestore.local.SQLiteSchema.c = r1 % 128;
*/
/* JADX WARN: Code restructure failed: missing block: B:9:0x0030, code lost:
if ((r1 % 2) != 0) goto L15;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void addTargetCount() {
/*
r6 = this;
r0 = 2
int r1 = r0 % r0
int r1 = com.google.firebase.firestore.local.SQLiteSchema.e
int r1 = r1 + 15
int r2 = r1 % 128
com.google.firebase.firestore.local.SQLiteSchema.c = r2
int r1 = r1 % r0
java.lang.String r2 = "target_count"
java.lang.String r3 = "target_globals"
r4 = 0
if (r1 == 0) goto L1e
boolean r1 = r6.tableContainsColumn(r3, r2)
r5 = 78
int r5 = r5 / 0
if (r1 != 0) goto L40
goto L25
L1e:
boolean r1 = r6.tableContainsColumn(r3, r2)
if (r1 == 0) goto L25
goto L40
L25:
int r1 = com.google.firebase.firestore.local.SQLiteSchema.e
int r1 = r1 + 45
int r5 = r1 % 128
com.google.firebase.firestore.local.SQLiteSchema.c = r5
int r1 = r1 % r0
java.lang.String r5 = "ALTER TABLE target_globals ADD COLUMN target_count INTEGER"
if (r1 != 0) goto L5a
android.database.sqlite.SQLiteDatabase r1 = r6.db
r1.execSQL(r5)
int r1 = com.google.firebase.firestore.local.SQLiteSchema.c
int r1 = r1 + 25
int r5 = r1 % 128
com.google.firebase.firestore.local.SQLiteSchema.e = r5
int r1 = r1 % r0
L40:
android.database.sqlite.SQLiteDatabase r0 = r6.db
java.lang.String r1 = "targets"
long r0 = android.database.DatabaseUtils.queryNumEntries(r0, r1)
android.content.ContentValues r5 = new android.content.ContentValues
r5.<init>()
java.lang.Long r0 = java.lang.Long.valueOf(r0)
r5.put(r2, r0)
android.database.sqlite.SQLiteDatabase r0 = r6.db
r0.update(r3, r5, r4, r4)
return
L5a:
android.database.sqlite.SQLiteDatabase r0 = r6.db
r0.execSQL(r5)
r4.hashCode()
throw r4
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.firestore.local.SQLiteSchema.addTargetCount():void");
}
private void addSequenceNumber() {
int i = 2 % 2;
int i2 = c + 103;
e = i2 % 128;
int i3 = i2 % 2;
if (tableContainsColumn("target_documents", "sequence_number")) {
return;
}
int i4 = c + 73;
e = i4 % 128;
if (i4 % 2 != 0) {
this.db.execSQL("ALTER TABLE target_documents ADD COLUMN sequence_number INTEGER");
return;
}
this.db.execSQL("ALTER TABLE target_documents ADD COLUMN sequence_number INTEGER");
Object obj = null;
obj.hashCode();
throw null;
}
private void addPathLength() {
int i = 2 % 2;
int i2 = e + 59;
c = i2 % 128;
int i3 = i2 % 2;
if (!tableContainsColumn("remote_documents", "path_length")) {
this.db.execSQL("ALTER TABLE remote_documents ADD COLUMN path_length INTEGER");
}
int i4 = c + 81;
e = i4 % 128;
int i5 = i4 % 2;
}
/* JADX WARN: Code restructure failed: missing block: B:17:0x002e, code lost:
r4 = true;
*/
/* JADX WARN: Code restructure failed: missing block: B:19:0x002c, code lost:
if (r1 == r3) goto L9;
*/
/* JADX WARN: Code restructure failed: missing block: B:4:0x0021, code lost:
if (r1 == r3) goto L9;
*/
/* JADX WARN: Code restructure failed: missing block: B:5:0x0030, code lost:
r4 = false;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private boolean hasReadTime() {
/*
r8 = this;
r0 = 2
int r1 = r0 % r0
int r1 = com.google.firebase.firestore.local.SQLiteSchema.e
int r1 = r1 + 41
int r2 = r1 % 128
com.google.firebase.firestore.local.SQLiteSchema.c = r2
int r1 = r1 % r0
r2 = 1
java.lang.String r3 = "read_time_nanos"
java.lang.String r4 = "read_time_seconds"
r5 = 0
java.lang.String r6 = "remote_documents"
if (r1 == 0) goto L24
boolean r1 = r8.tableContainsColumn(r6, r4)
boolean r3 = r8.tableContainsColumn(r6, r3)
r4 = 88
int r4 = r4 / r5
if (r1 != r3) goto L30
goto L2e
L24:
boolean r1 = r8.tableContainsColumn(r6, r4)
boolean r3 = r8.tableContainsColumn(r6, r3)
if (r1 != r3) goto L30
L2e:
r4 = r2
goto L31
L30:
r4 = r5
L31:
java.lang.Object[] r6 = new java.lang.Object[r5]
java.lang.String r7 = "Table contained just one of read_time_seconds or read_time_nanos"
com.google.firebase.firestore.util.Assert.hardAssert(r4, r7, r6)
if (r1 == 0) goto L4d
int r1 = com.google.firebase.firestore.local.SQLiteSchema.c
int r1 = r1 + 93
int r4 = r1 % 128
com.google.firebase.firestore.local.SQLiteSchema.e = r4
int r1 = r1 % r0
if (r1 == 0) goto L48
if (r3 == 0) goto L4d
goto L4e
L48:
r0 = 0
r0.hashCode()
throw r0
L4d:
r2 = r5
L4e:
return r2
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.firestore.local.SQLiteSchema.hasReadTime():boolean");
}
private void addReadTime() {
int i = 2 % 2;
int i2 = e + 75;
c = i2 % 128;
int i3 = i2 % 2;
this.db.execSQL("ALTER TABLE remote_documents ADD COLUMN read_time_seconds INTEGER");
this.db.execSQL("ALTER TABLE remote_documents ADD COLUMN read_time_nanos INTEGER");
int i4 = e + 121;
c = i4 % 128;
int i5 = i4 % 2;
}
private void dropLastLimboFreeSnapshotVersion() {
int i = 2 % 2;
new SQLitePersistence.Query(this.db, "SELECT target_id, target_proto FROM targets").forEach(new Consumer(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda17
public final SQLiteSchema f$0;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
this.f$0.m226x75baead4((Cursor) obj);
}
{
this.f$0 = this;
}
});
int i2 = e + 59;
c = i2 % 128;
if (i2 % 2 != 0) {
throw null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$dropLastLimboFreeSnapshotVersion$6$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m226x75baead4(Cursor cursor) {
int i = 2 % 2;
int i2 = c + 91;
e = i2 % 128;
int i3 = i2 % 2;
int i4 = cursor.getInt(0);
try {
this.db.execSQL("UPDATE targets SET target_proto = ? WHERE target_id = ?", new Object[]{Target.parseFrom(cursor.getBlob(1)).toBuilder().clearLastLimboFreeSnapshotVersion().build().toByteArray(), Integer.valueOf(i4)});
int i5 = e + 29;
c = i5 % 128;
if (i5 % 2 != 0) {
int i6 = 46 / 0;
}
} catch (InvalidProtocolBufferException unused) {
throw Assert.fail("Failed to decode Query data for target %s", Integer.valueOf(i4));
} catch (Exception e2) {
throw e2;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ Long lambda$ensureSequenceNumbers$7(Cursor cursor) {
int i = 2 % 2;
int i2 = c + 33;
e = i2 % 128;
Long valueOf = Long.valueOf(i2 % 2 == 0 ? cursor.getLong(1) : cursor.getLong(0));
int i3 = e + 73;
c = i3 % 128;
if (i3 % 2 != 0) {
int i4 = 2 / 0;
}
return valueOf;
}
private void ensureSequenceNumbers() {
boolean z;
int i = 2 % 2;
Long l = (Long) new SQLitePersistence.Query(this.db, "SELECT highest_listen_sequence_number FROM target_globals LIMIT 1").firstValue(new Function() { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda1
@Override // com.google.firebase.firestore.util.Function
public final Object apply(Object obj) {
return SQLiteSchema.lambda$ensureSequenceNumbers$7((Cursor) obj);
}
});
if (l != null) {
int i2 = e;
int i3 = i2 + 91;
c = i3 % 128;
int i4 = i3 % 2;
int i5 = i2 + 121;
c = i5 % 128;
int i6 = i5 % 2;
z = true;
} else {
z = false;
}
Assert.hardAssert(z, "Missing highest sequence number", new Object[0]);
final long longValue = l.longValue();
final SQLiteStatement compileStatement = this.db.compileStatement("INSERT INTO target_documents (target_id, path, sequence_number) VALUES (0, ?, ?)");
SQLitePersistence.Query binding = new SQLitePersistence.Query(this.db, "SELECT RD.path FROM remote_documents AS RD WHERE NOT EXISTS (SELECT TD.path FROM target_documents AS TD WHERE RD.path = TD.path AND TD.target_id = 0) LIMIT ?").binding(100);
final boolean[] zArr = new boolean[1];
do {
zArr[0] = false;
binding.forEach(new Consumer(zArr, compileStatement, longValue) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda2
public final boolean[] f$0;
public final SQLiteStatement f$1;
public final long f$2;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
SQLiteSchema.lambda$ensureSequenceNumbers$8(this.f$0, this.f$1, this.f$2, (Cursor) obj);
}
{
this.f$0 = zArr;
this.f$1 = compileStatement;
this.f$2 = longValue;
}
});
} while (zArr[0]);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void lambda$ensureSequenceNumbers$8(boolean[] zArr, SQLiteStatement sQLiteStatement, long j, Cursor cursor) {
int i = 2 % 2;
int i2 = e + 33;
c = i2 % 128;
int i3 = i2 % 2;
boolean z = true;
zArr[0] = true;
sQLiteStatement.clearBindings();
sQLiteStatement.bindString(1, cursor.getString(0));
sQLiteStatement.bindLong(2, j);
if (sQLiteStatement.executeInsert() == -1) {
int i4 = e + 57;
c = i4 % 128;
int i5 = i4 % 2;
z = false;
}
Assert.hardAssert(z, "Failed to insert a sentinel row", new Object[0]);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createV8CollectionParentsIndex$9$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m225xa9cab21c() {
int i = 2 % 2;
int i2 = e + 79;
c = i2 % 128;
if (i2 % 2 != 0) {
this.db.execSQL("CREATE TABLE collection_parents (collection_id TEXT, parent TEXT, PRIMARY KEY(collection_id, parent))");
int i3 = 65 / 0;
} else {
this.db.execSQL("CREATE TABLE collection_parents (collection_id TEXT, parent TEXT, PRIMARY KEY(collection_id, parent))");
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void lambda$createV8CollectionParentsIndex$10(MemoryIndexManager.MemoryCollectionParentIndex memoryCollectionParentIndex, SQLiteStatement sQLiteStatement, ResourcePath resourcePath) {
int i = 2 % 2;
int i2 = e + 5;
c = i2 % 128;
int i3 = i2 % 2;
if (!memoryCollectionParentIndex.add(resourcePath)) {
return;
}
int i4 = e + 9;
c = i4 % 128;
int i5 = i4 % 2;
String lastSegment = resourcePath.getLastSegment();
ResourcePath popLast = resourcePath.popLast();
sQLiteStatement.clearBindings();
sQLiteStatement.bindString(1, lastSegment);
sQLiteStatement.bindString(2, EncodedPath.encode(popLast));
sQLiteStatement.execute();
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void lambda$createV8CollectionParentsIndex$11(Consumer consumer, Cursor cursor) {
int i = 2 % 2;
int i2 = c + 105;
e = i2 % 128;
int i3 = i2 % 2;
consumer.accept(EncodedPath.decodeResourcePath(cursor.getString(0)).popLast());
int i4 = c + 117;
e = i4 % 128;
int i5 = i4 % 2;
}
private void createV8CollectionParentsIndex() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"collection_parents"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda4
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m225xa9cab21c();
}
{
this.f$0 = this;
}
});
final MemoryIndexManager.MemoryCollectionParentIndex memoryCollectionParentIndex = new MemoryIndexManager.MemoryCollectionParentIndex();
final SQLiteStatement compileStatement = this.db.compileStatement("INSERT OR REPLACE INTO collection_parents (collection_id, parent) VALUES (?, ?)");
final Consumer consumer = new Consumer(memoryCollectionParentIndex, compileStatement) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda5
public final MemoryIndexManager.MemoryCollectionParentIndex f$0;
public final SQLiteStatement f$1;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
SQLiteSchema.lambda$createV8CollectionParentsIndex$10(this.f$0, this.f$1, (ResourcePath) obj);
}
{
this.f$0 = memoryCollectionParentIndex;
this.f$1 = compileStatement;
}
};
new SQLitePersistence.Query(this.db, "SELECT path FROM remote_documents").forEach(new Consumer(consumer) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda6
public final Consumer f$0;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
SQLiteSchema.lambda$createV8CollectionParentsIndex$11(this.f$0, (Cursor) obj);
}
{
this.f$0 = consumer;
}
});
new SQLitePersistence.Query(this.db, "SELECT path FROM document_mutations").forEach(new Consumer(consumer) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda7
public final Consumer f$0;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
SQLiteSchema.lambda$createV8CollectionParentsIndex$12(this.f$0, (Cursor) obj);
}
{
this.f$0 = consumer;
}
});
int i2 = c + 3;
e = i2 % 128;
if (i2 % 2 != 0) {
return;
}
Object obj = null;
obj.hashCode();
throw null;
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void lambda$createV8CollectionParentsIndex$12(Consumer consumer, Cursor cursor) {
int i = 2 % 2;
int i2 = c + 67;
e = i2 % 128;
int i3 = i2 % 2;
consumer.accept(EncodedPath.decodeResourcePath(cursor.getString(0)).popLast());
}
private boolean tableContainsColumn(String str, String str2) {
boolean z;
int i = 2 % 2;
int i2 = e + 15;
c = i2 % 128;
int i3 = i2 % 2;
if (getTableColumns(str).indexOf(str2) != -1) {
z = true;
} else {
int i4 = c + 61;
e = i4 % 128;
if (i4 % 2 == 0) {
int i5 = 5 % 3;
}
z = false;
}
int i6 = e + 11;
c = i6 % 128;
int i7 = i6 % 2;
return z;
}
/* JADX WARN: Finally extract failed */
List<String> getTableColumns(String str) {
int i = 2 % 2;
ArrayList arrayList = new ArrayList();
Cursor cursor = null;
try {
SQLiteDatabase sQLiteDatabase = this.db;
StringBuilder sb = new StringBuilder("PRAGMA table_info(");
sb.append(str);
sb.append(")");
cursor = sQLiteDatabase.rawQuery(sb.toString(), null);
int columnIndex = cursor.getColumnIndex("name");
while (cursor.moveToNext()) {
int i2 = e + 25;
c = i2 % 128;
int i3 = i2 % 2;
arrayList.add(cursor.getString(columnIndex));
}
if (cursor != null) {
cursor.close();
int i4 = e + 101;
c = i4 % 128;
int i5 = i4 % 2;
}
int i6 = e + 125;
c = i6 % 128;
int i7 = i6 % 2;
return arrayList;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
private void rewriteCanonicalIds() {
int i = 2 % 2;
new SQLitePersistence.Query(this.db, "SELECT target_id, target_proto FROM targets").forEach(new Consumer(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda10
public final SQLiteSchema f$0;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
this.f$0.m229x9cba5780((Cursor) obj);
}
{
this.f$0 = this;
}
});
int i2 = e + 51;
c = i2 % 128;
if (i2 % 2 == 0) {
return;
}
Object obj = null;
obj.hashCode();
throw null;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$rewriteCanonicalIds$13$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m229x9cba5780(Cursor cursor) {
int i = 2 % 2;
int i2 = c + 39;
e = i2 % 128;
int i3 = i2 % 2;
int i4 = cursor.getInt(0);
try {
this.db.execSQL("UPDATE targets SET canonical_id = ? WHERE target_id = ?", new Object[]{this.serializer.decodeTargetData(Target.parseFrom(cursor.getBlob(1))).getTarget().getCanonicalId(), Integer.valueOf(i4)});
int i5 = e + 39;
c = i5 % 128;
if (i5 % 2 != 0) {
throw null;
}
} catch (InvalidProtocolBufferException unused) {
throw Assert.fail("Failed to decode Query data for target %s", Integer.valueOf(i4));
} catch (Exception e2) {
throw e2;
}
}
private void ensurePathLength() {
int i = 2 % 2;
SQLitePersistence.Query binding = new SQLitePersistence.Query(this.db, "SELECT path FROM remote_documents WHERE path_length IS NULL LIMIT ?").binding(100);
final SQLiteStatement compileStatement = this.db.compileStatement("UPDATE remote_documents SET path_length = ? WHERE path = ?");
final boolean[] zArr = new boolean[1];
int i2 = e + 35;
c = i2 % 128;
int i3 = i2 % 2;
do {
zArr[0] = false;
binding.forEach(new Consumer(zArr, compileStatement) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda8
public final boolean[] f$0;
public final SQLiteStatement f$1;
@Override // com.google.firebase.firestore.util.Consumer
public final void accept(Object obj) {
SQLiteSchema.lambda$ensurePathLength$14(this.f$0, this.f$1, (Cursor) obj);
}
{
this.f$0 = zArr;
this.f$1 = compileStatement;
}
});
} while (zArr[0]);
int i4 = c + 115;
e = i4 % 128;
if (i4 % 2 == 0) {
int i5 = 30 / 0;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void lambda$ensurePathLength$14(boolean[] zArr, SQLiteStatement sQLiteStatement, Cursor cursor) {
int i = 2 % 2;
int i2 = e + 73;
c = i2 % 128;
int i3 = i2 % 2;
boolean z = true;
zArr[0] = true;
String string = cursor.getString(0);
ResourcePath decodeResourcePath = EncodedPath.decodeResourcePath(string);
sQLiteStatement.clearBindings();
sQLiteStatement.bindLong(1, decodeResourcePath.length());
sQLiteStatement.bindString(2, string);
if (sQLiteStatement.executeUpdateDelete() == -1) {
int i4 = e + 27;
c = i4 % 128;
int i5 = i4 % 2;
z = false;
}
Assert.hardAssert(z, "Failed to update document path", new Object[0]);
int i6 = c + 93;
e = i6 % 128;
if (i6 % 2 != 0) {
return;
}
Object obj = null;
obj.hashCode();
throw null;
}
private void ensureReadTime() {
int i = 2 % 2;
int i2 = c + 85;
e = i2 % 128;
int i3 = i2 % 2;
this.db.execSQL("UPDATE remote_documents SET read_time_seconds = 0, read_time_nanos = 0 WHERE read_time_seconds IS NULL");
int i4 = e + 43;
c = i4 % 128;
if (i4 % 2 != 0) {
throw null;
}
}
private void createBundleCache() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"bundles", "named_queries"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda16
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m218x6e4b0732();
}
{
this.f$0 = this;
}
});
int i2 = e + 13;
c = i2 % 128;
if (i2 % 2 != 0) {
throw null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createBundleCache$15$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m218x6e4b0732() {
int i = 2 % 2;
int i2 = c + 45;
e = i2 % 128;
int i3 = i2 % 2;
this.db.execSQL("CREATE TABLE bundles (bundle_id TEXT PRIMARY KEY, create_time_seconds INTEGER, create_time_nanos INTEGER, schema_version INTEGER, total_documents INTEGER, total_bytes INTEGER)");
this.db.execSQL("CREATE TABLE named_queries (name TEXT PRIMARY KEY, read_time_seconds INTEGER, read_time_nanos INTEGER, bundled_query_proto BLOB)");
int i4 = e + 83;
c = i4 % 128;
if (i4 % 2 != 0) {
int i5 = 66 / 0;
}
}
private void createOverlays() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"document_overlays"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda12
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m221xe88164a6();
}
{
this.f$0 = this;
}
});
int i2 = c + 37;
e = i2 % 128;
if (i2 % 2 == 0) {
throw null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createOverlays$16$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m221xe88164a6() {
int i = 2 % 2;
int i2 = e + 89;
c = i2 % 128;
if (i2 % 2 != 0) {
this.db.execSQL("CREATE TABLE document_overlays (uid TEXT, collection_path TEXT, document_id TEXT, collection_group TEXT, largest_batch_id INTEGER, overlay_mutation BLOB, PRIMARY KEY (uid, collection_path, document_id))");
this.db.execSQL("CREATE INDEX batch_id_overlay ON document_overlays (uid, largest_batch_id)");
this.db.execSQL("CREATE INDEX collection_group_overlay ON document_overlays (uid, collection_group)");
int i3 = 59 / 0;
return;
}
this.db.execSQL("CREATE TABLE document_overlays (uid TEXT, collection_path TEXT, document_id TEXT, collection_group TEXT, largest_batch_id INTEGER, overlay_mutation BLOB, PRIMARY KEY (uid, collection_path, document_id))");
this.db.execSQL("CREATE INDEX batch_id_overlay ON document_overlays (uid, largest_batch_id)");
this.db.execSQL("CREATE INDEX collection_group_overlay ON document_overlays (uid, collection_group)");
}
private void createDataMigrationTable() {
int i = 2 % 2;
ifTablesDontExist(new String[]{"data_migrations"}, new Runnable(this) { // from class: com.google.firebase.firestore.local.SQLiteSchema$$ExternalSyntheticLambda11
public final SQLiteSchema f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.m219x9f4946cc();
}
{
this.f$0 = this;
}
});
int i2 = e + 3;
c = i2 % 128;
int i3 = i2 % 2;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: lambda$createDataMigrationTable$17$com-google-firebase-firestore-local-SQLiteSchema, reason: not valid java name */
public /* synthetic */ void m219x9f4946cc() {
int i = 2 % 2;
int i2 = e + 105;
c = i2 % 128;
int i3 = i2 % 2;
this.db.execSQL("CREATE TABLE data_migrations (migration_name TEXT, PRIMARY KEY (migration_name))");
int i4 = c + 89;
e = i4 % 128;
if (i4 % 2 == 0) {
throw null;
}
}
private void addPendingDataMigration(String str) {
int i = 2 % 2;
int i2 = e + 25;
c = i2 % 128;
if (i2 % 2 == 0) {
this.db.execSQL("INSERT OR IGNORE INTO data_migrations (migration_name) VALUES (?)", new String[]{str});
return;
}
SQLiteDatabase sQLiteDatabase = this.db;
String[] strArr = new String[0];
strArr[0] = str;
sQLiteDatabase.execSQL("INSERT OR IGNORE INTO data_migrations (migration_name) VALUES (?)", strArr);
}
private boolean tableExists(String str) {
int i = 2 % 2;
boolean z = !new SQLitePersistence.Query(this.db, "SELECT 1=1 FROM sqlite_master WHERE tbl_name = ?").binding(str).isEmpty();
int i2 = e + 47;
c = i2 % 128;
if (i2 % 2 == 0) {
return z;
}
throw null;
}
}