package com.google.android.gms.measurement.internal; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabaseLockedException; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import android.os.Build; /* loaded from: classes.dex */ final class zzap extends SQLiteOpenHelper { private final /* synthetic */ zzao a; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ zzap(zzao zzaoVar, Context context, String str) { super(context, str, (SQLiteDatabase.CursorFactory) null, 1); this.a = zzaoVar; } @Override // android.database.sqlite.SQLiteOpenHelper public final SQLiteDatabase getWritableDatabase() throws SQLiteException { try { return super.getWritableDatabase(); } catch (SQLiteDatabaseLockedException e) { throw e; } catch (SQLiteException unused) { this.a.e().t().a("Opening the local database failed, dropping and recreating it"); if (!this.a.b().getDatabasePath("google_app_measurement_local.db").delete()) { this.a.e().t().a("Failed to delete corrupted local db file", "google_app_measurement_local.db"); } try { return super.getWritableDatabase(); } catch (SQLiteException e2) { this.a.e().t().a("Failed to open local database. Events will bypass local storage", e2); return null; } } } @Override // android.database.sqlite.SQLiteOpenHelper public final void onCreate(SQLiteDatabase sQLiteDatabase) { zzx.a(this.a.e(), sQLiteDatabase); } @Override // android.database.sqlite.SQLiteOpenHelper public final void onDowngrade(SQLiteDatabase sQLiteDatabase, int i, int i2) { } @Override // android.database.sqlite.SQLiteOpenHelper public final void onOpen(SQLiteDatabase sQLiteDatabase) { if (Build.VERSION.SDK_INT < 15) { Cursor cursor = null; try { cursor = sQLiteDatabase.rawQuery("PRAGMA journal_mode=memory", null); cursor.moveToFirst(); } finally { if (cursor != null) { cursor.close(); } } } zzx.a(this.a.e(), sQLiteDatabase, "messages", "create table if not exists messages ( type INTEGER NOT NULL, entry BLOB NOT NULL)", "type,entry", null); } @Override // android.database.sqlite.SQLiteOpenHelper public final void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) { } }