package p138.p176.p177.p242.p265.p266;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabaseLockedException;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import p138.p176.p177.p242.p246.p251.C4303;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.ˣ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4825 extends SQLiteOpenHelper {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final /* synthetic */ C4821 f14518;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C4825(C4821 c4821, Context context, String str) {
        super(context, str, (SQLiteDatabase.CursorFactory) null, 1);
        this.f14518 = c4821;
    }

    @Override // android.database.sqlite.SQLiteOpenHelper
    public final SQLiteDatabase getWritableDatabase() {
        try {
            return super.getWritableDatabase();
        } catch (SQLiteDatabaseLockedException e) {
            throw e;
        } catch (SQLiteException unused) {
            this.f14518.mo8165().f14444.m8034("Opening the local database failed, dropping and recreating it");
            if (!this.f14518.f14588.f15009.getDatabasePath("google_app_measurement_local.db").delete()) {
                this.f14518.mo8165().f14444.m8035("Failed to delete corrupted local db file", "google_app_measurement_local.db");
            }
            try {
                return super.getWritableDatabase();
            } catch (SQLiteException e2) {
                this.f14518.mo8165().f14444.m8035("Failed to open local database. Events will bypass local storage", e2);
                return null;
            }
        }
    }

    @Override // android.database.sqlite.SQLiteOpenHelper
    public final void onCreate(SQLiteDatabase sQLiteDatabase) {
        C4303.m7101(this.f14518.mo8165(), 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) {
        C4303.m7102(this.f14518.mo8165(), sQLiteDatabase, "messages", "create table if not exists messages ( type INTEGER NOT NULL, entry BLOB NOT NULL)", "type,entry", (String[]) null);
    }

    @Override // android.database.sqlite.SQLiteOpenHelper
    public final void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
    }
}
