93 lines
3.1 KiB
Java
93 lines
3.1 KiB
Java
|
package o;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.database.sqlite.SQLiteDatabase;
|
||
|
import android.database.sqlite.SQLiteOpenHelper;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.List;
|
||
|
|
||
|
/* renamed from: o.XcZ, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes.dex */
|
||
|
final class C1172XcZ extends SQLiteOpenHelper {
|
||
|
private static final List<RVV> c = Arrays.asList(C15701hpx.d, C16590pYr.e, DvA.c, C16804rPj.d);
|
||
|
private boolean a;
|
||
|
private final int d;
|
||
|
|
||
|
/* renamed from: o.XcZ$RVV */
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface RVV {
|
||
|
void Hs_(SQLiteDatabase sQLiteDatabase);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
@InterfaceC13391fZD
|
||
|
public C1172XcZ(Context context, @InterfaceC13390fZB(a = "SQLITE_DB_NAME") String str, @InterfaceC13390fZB(a = "SCHEMA_VERSION") int i) {
|
||
|
super(context, str, (SQLiteDatabase.CursorFactory) null, i);
|
||
|
this.a = false;
|
||
|
this.d = i;
|
||
|
}
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public final void onConfigure(SQLiteDatabase sQLiteDatabase) {
|
||
|
this.a = true;
|
||
|
sQLiteDatabase.rawQuery("PRAGMA busy_timeout=0;", new String[0]).close();
|
||
|
sQLiteDatabase.setForeignKeyConstraintsEnabled(true);
|
||
|
}
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public final void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||
|
if (!this.a) {
|
||
|
onConfigure(sQLiteDatabase);
|
||
|
}
|
||
|
Hn_(sQLiteDatabase, i, i2);
|
||
|
}
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public final void onDowngrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||
|
sQLiteDatabase.execSQL("DROP TABLE events");
|
||
|
sQLiteDatabase.execSQL("DROP TABLE event_metadata");
|
||
|
sQLiteDatabase.execSQL("DROP TABLE transport_contexts");
|
||
|
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS event_payloads");
|
||
|
if (!this.a) {
|
||
|
onConfigure(sQLiteDatabase);
|
||
|
}
|
||
|
Hn_(sQLiteDatabase, 0, i2);
|
||
|
}
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public final void onOpen(SQLiteDatabase sQLiteDatabase) {
|
||
|
if (this.a) {
|
||
|
return;
|
||
|
}
|
||
|
onConfigure(sQLiteDatabase);
|
||
|
}
|
||
|
|
||
|
private static void Hn_(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||
|
List<RVV> list = c;
|
||
|
if (i2 <= list.size()) {
|
||
|
while (i < i2) {
|
||
|
c.get(i).Hs_(sQLiteDatabase);
|
||
|
i++;
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("Migration from ");
|
||
|
sb.append(i);
|
||
|
sb.append(" to ");
|
||
|
sb.append(i2);
|
||
|
sb.append(" was requested, but cannot be performed. Only ");
|
||
|
sb.append(list.size());
|
||
|
sb.append(" migrations are provided");
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public final void onCreate(SQLiteDatabase sQLiteDatabase) {
|
||
|
int i = this.d;
|
||
|
if (!this.a) {
|
||
|
onConfigure(sQLiteDatabase);
|
||
|
}
|
||
|
Hn_(sQLiteDatabase, 0, i);
|
||
|
}
|
||
|
}
|