mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-30 11:02:31 -06:00
63 lines
2.3 KiB
Java
63 lines
2.3 KiB
Java
|
package androidx.media3.database;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.database.Cursor;
|
||
|
import android.database.SQLException;
|
||
|
import android.database.sqlite.SQLiteDatabase;
|
||
|
import android.database.sqlite.SQLiteOpenHelper;
|
||
|
import androidx.media3.common.util.Log;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class StandaloneDatabaseProvider extends SQLiteOpenHelper implements DatabaseProvider {
|
||
|
public static final String DATABASE_NAME = "exoplayer_internal.db";
|
||
|
private static final String TAG = "SADatabaseProvider";
|
||
|
private static final int VERSION = 1;
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public void onCreate(SQLiteDatabase sQLiteDatabase) {
|
||
|
}
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||
|
}
|
||
|
|
||
|
public StandaloneDatabaseProvider(Context context) {
|
||
|
super(context.getApplicationContext(), "exoplayer_internal.db", (SQLiteDatabase.CursorFactory) null, 1);
|
||
|
}
|
||
|
|
||
|
@Override // android.database.sqlite.SQLiteOpenHelper
|
||
|
public void onDowngrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||
|
wipeDatabase(sQLiteDatabase);
|
||
|
}
|
||
|
|
||
|
private static void wipeDatabase(SQLiteDatabase sQLiteDatabase) {
|
||
|
Cursor query = sQLiteDatabase.query("sqlite_master", new String[]{"type", "name"}, null, null, null, null, null);
|
||
|
while (query.moveToNext()) {
|
||
|
try {
|
||
|
String string = query.getString(0);
|
||
|
String string2 = query.getString(1);
|
||
|
if (!"sqlite_sequence".equals(string2)) {
|
||
|
String str = "DROP " + string + " IF EXISTS " + string2;
|
||
|
try {
|
||
|
sQLiteDatabase.execSQL(str);
|
||
|
} catch (SQLException e) {
|
||
|
Log.e(TAG, "Error executing " + str, e);
|
||
|
}
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
if (query != null) {
|
||
|
try {
|
||
|
query.close();
|
||
|
} catch (Throwable th2) {
|
||
|
th.addSuppressed(th2);
|
||
|
}
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
if (query != null) {
|
||
|
query.close();
|
||
|
}
|
||
|
}
|
||
|
}
|