package p5;

import android.database.Cursor;
import android.database.sqlite.SQLiteCursor;
import android.database.sqlite.SQLiteCursorDriver;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQuery;
import android.database.sqlite.SQLiteStatement;
import android.os.CancellationSignal;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteQuery;
import androidx.sqlite.db.SupportSQLiteStatement;
import dn.r;
import java.util.List;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;

/* loaded from: classes.dex */
public final class c implements SupportSQLiteDatabase {

    /* renamed from: q, reason: collision with root package name */
    public static final a f32238q = new a(null);

    /* renamed from: r, reason: collision with root package name */
    private static final String[] f32239r = {"", " OR ROLLBACK ", " OR ABORT ", " OR FAIL ", " OR IGNORE ", " OR REPLACE "};

    /* renamed from: s, reason: collision with root package name */
    private static final String[] f32240s = new String[0];

    /* renamed from: p, reason: collision with root package name */
    private final SQLiteDatabase f32241p;

    /* loaded from: classes.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(k kVar) {
            this();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class b extends v implements r {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ SupportSQLiteQuery f32242p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(SupportSQLiteQuery supportSQLiteQuery) {
            super(4);
            this.f32242p = supportSQLiteQuery;
        }

        @Override // dn.r
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final SQLiteCursor j(SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
            SupportSQLiteQuery supportSQLiteQuery = this.f32242p;
            t.d(sQLiteQuery);
            supportSQLiteQuery.a(new g(sQLiteQuery));
            return new SQLiteCursor(sQLiteCursorDriver, str, sQLiteQuery);
        }
    }

    public c(SQLiteDatabase delegate) {
        t.g(delegate, "delegate");
        this.f32241p = delegate;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Cursor d(r tmp0, SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
        t.g(tmp0, "$tmp0");
        return (Cursor) tmp0.j(sQLiteDatabase, sQLiteCursorDriver, str, sQLiteQuery);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Cursor e(SupportSQLiteQuery query, SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
        t.g(query, "$query");
        t.d(sQLiteQuery);
        query.a(new g(sQLiteQuery));
        return new SQLiteCursor(sQLiteCursorDriver, str, sQLiteQuery);
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public void beginTransaction() {
        this.f32241p.beginTransaction();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public void beginTransactionNonExclusive() {
        this.f32241p.beginTransactionNonExclusive();
    }

    public final boolean c(SQLiteDatabase sqLiteDatabase) {
        t.g(sqLiteDatabase, "sqLiteDatabase");
        return t.b(this.f32241p, sqLiteDatabase);
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public void close() {
        this.f32241p.close();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public SupportSQLiteStatement compileStatement(String sql) {
        t.g(sql, "sql");
        SQLiteStatement compileStatement = this.f32241p.compileStatement(sql);
        t.f(compileStatement, "delegate.compileStatement(sql)");
        return new h(compileStatement);
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public void endTransaction() {
        this.f32241p.endTransaction();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public void execSQL(String sql) {
        t.g(sql, "sql");
        this.f32241p.execSQL(sql);
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public List getAttachedDbs() {
        return this.f32241p.getAttachedDbs();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public String getPath() {
        return this.f32241p.getPath();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public boolean inTransaction() {
        return this.f32241p.inTransaction();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public boolean isOpen() {
        return this.f32241p.isOpen();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public boolean isWriteAheadLoggingEnabled() {
        return o5.b.b(this.f32241p);
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public Cursor query(String query) {
        t.g(query, "query");
        return query(new o5.a(query));
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public void setTransactionSuccessful() {
        this.f32241p.setTransactionSuccessful();
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public void execSQL(String sql, Object[] bindArgs) {
        t.g(sql, "sql");
        t.g(bindArgs, "bindArgs");
        this.f32241p.execSQL(sql, bindArgs);
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public Cursor query(SupportSQLiteQuery query) {
        t.g(query, "query");
        final b bVar = new b(query);
        Cursor rawQueryWithFactory = this.f32241p.rawQueryWithFactory(new SQLiteDatabase.CursorFactory() { // from class: p5.b
            @Override // android.database.sqlite.SQLiteDatabase.CursorFactory
            public final Cursor newCursor(SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
                Cursor d10;
                d10 = c.d(r.this, sQLiteDatabase, sQLiteCursorDriver, str, sQLiteQuery);
                return d10;
            }
        }, query.c(), f32240s, null);
        t.f(rawQueryWithFactory, "delegate.rawQueryWithFac…EMPTY_STRING_ARRAY, null)");
        return rawQueryWithFactory;
    }

    @Override // androidx.sqlite.db.SupportSQLiteDatabase
    public Cursor query(final SupportSQLiteQuery query, CancellationSignal cancellationSignal) {
        t.g(query, "query");
        SQLiteDatabase sQLiteDatabase = this.f32241p;
        String c10 = query.c();
        String[] strArr = f32240s;
        t.d(cancellationSignal);
        return o5.b.c(sQLiteDatabase, c10, strArr, null, cancellationSignal, new SQLiteDatabase.CursorFactory() { // from class: p5.a
            @Override // android.database.sqlite.SQLiteDatabase.CursorFactory
            public final Cursor newCursor(SQLiteDatabase sQLiteDatabase2, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
                Cursor e10;
                e10 = c.e(SupportSQLiteQuery.this, sQLiteDatabase2, sQLiteCursorDriver, str, sQLiteQuery);
                return e10;
            }
        });
    }
}
