package androidx.room; import android.content.ContentResolver; import android.content.ContentValues; import android.database.CharArrayBuffer; import android.database.ContentObserver; import android.database.Cursor; import android.database.DataSetObserver; import android.database.SQLException; import android.database.sqlite.SQLiteTransactionListener; import android.net.Uri; import android.os.Bundle; import android.os.CancellationSignal; import android.util.Pair; import androidx.annotation.RequiresApi; import androidx.room.AutoClosingRoomOpenHelper; import androidx.sqlite.db.SupportSQLiteCompat; import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.sqlite.db.SupportSQLiteOpenHelper; import androidx.sqlite.db.SupportSQLiteQuery; import androidx.sqlite.db.SupportSQLiteStatement; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Locale; import kotlin.Unit; import kotlin.collections.CollectionsKt__CollectionsKt; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.MutablePropertyReference1Impl; import kotlin.jvm.internal.PropertyReference1Impl; import kotlin.jvm.internal.SourceDebugExtension; /* loaded from: classes.dex */ public final class AutoClosingRoomOpenHelper implements SupportSQLiteOpenHelper, DelegatingOpenHelper { public final AutoCloser autoCloser; private final AutoClosingSupportSQLiteDatabase autoClosingDb; private final SupportSQLiteOpenHelper delegate; @Override // androidx.sqlite.db.SupportSQLiteOpenHelper public String getDatabaseName() { return this.delegate.getDatabaseName(); } @Override // androidx.room.DelegatingOpenHelper public SupportSQLiteOpenHelper getDelegate() { return this.delegate; } @Override // androidx.sqlite.db.SupportSQLiteOpenHelper @RequiresApi(api = 16) public void setWriteAheadLoggingEnabled(boolean z) { this.delegate.setWriteAheadLoggingEnabled(z); } public AutoClosingRoomOpenHelper(SupportSQLiteOpenHelper delegate, AutoCloser autoCloser) { Intrinsics.checkNotNullParameter(delegate, "delegate"); Intrinsics.checkNotNullParameter(autoCloser, "autoCloser"); this.delegate = delegate; this.autoCloser = autoCloser; autoCloser.init(getDelegate()); this.autoClosingDb = new AutoClosingSupportSQLiteDatabase(autoCloser); } @Override // androidx.sqlite.db.SupportSQLiteOpenHelper @RequiresApi(api = 24) public SupportSQLiteDatabase getWritableDatabase() { this.autoClosingDb.pokeOpen(); return this.autoClosingDb; } @Override // androidx.sqlite.db.SupportSQLiteOpenHelper @RequiresApi(api = 24) public SupportSQLiteDatabase getReadableDatabase() { this.autoClosingDb.pokeOpen(); return this.autoClosingDb; } @Override // androidx.sqlite.db.SupportSQLiteOpenHelper, java.io.Closeable, java.lang.AutoCloseable public void close() { this.autoClosingDb.close(); } public static final class AutoClosingSupportSQLiteDatabase implements SupportSQLiteDatabase { private final AutoCloser autoCloser; public AutoClosingSupportSQLiteDatabase(AutoCloser autoCloser) { Intrinsics.checkNotNullParameter(autoCloser, "autoCloser"); this.autoCloser = autoCloser; } public final void pokeOpen() { this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$pokeOpen$1 @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase it) { Intrinsics.checkNotNullParameter(it, "it"); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public SupportSQLiteStatement compileStatement(String sql) { Intrinsics.checkNotNullParameter(sql, "sql"); return new AutoClosingSupportSqliteStatement(sql, this.autoCloser); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void beginTransaction() { try { this.autoCloser.incrementCountAndEnsureDbIsOpen().beginTransaction(); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void beginTransactionNonExclusive() { try { this.autoCloser.incrementCountAndEnsureDbIsOpen().beginTransactionNonExclusive(); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void beginTransactionWithListener(SQLiteTransactionListener transactionListener) { Intrinsics.checkNotNullParameter(transactionListener, "transactionListener"); try { this.autoCloser.incrementCountAndEnsureDbIsOpen().beginTransactionWithListener(transactionListener); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void beginTransactionWithListenerNonExclusive(SQLiteTransactionListener transactionListener) { Intrinsics.checkNotNullParameter(transactionListener, "transactionListener"); try { this.autoCloser.incrementCountAndEnsureDbIsOpen().beginTransactionWithListenerNonExclusive(transactionListener); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void endTransaction() { if (this.autoCloser.getDelegateDatabase$room_runtime_release() == null) { throw new IllegalStateException("End transaction called but delegateDb is null".toString()); } try { SupportSQLiteDatabase delegateDatabase$room_runtime_release = this.autoCloser.getDelegateDatabase$room_runtime_release(); Intrinsics.checkNotNull(delegateDatabase$room_runtime_release); delegateDatabase$room_runtime_release.endTransaction(); } finally { this.autoCloser.decrementCountAndScheduleClose(); } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void setTransactionSuccessful() { Unit unit; SupportSQLiteDatabase delegateDatabase$room_runtime_release = this.autoCloser.getDelegateDatabase$room_runtime_release(); if (delegateDatabase$room_runtime_release != null) { delegateDatabase$room_runtime_release.setTransactionSuccessful(); unit = Unit.INSTANCE; } else { unit = null; } if (unit == null) { throw new IllegalStateException("setTransactionSuccessful called but delegateDb is null".toString()); } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean inTransaction() { if (this.autoCloser.getDelegateDatabase$room_runtime_release() == null) { return false; } return ((Boolean) this.autoCloser.executeRefCountingFunction(AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$inTransaction$1.INSTANCE)).booleanValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean isDbLockedByCurrentThread() { if (this.autoCloser.getDelegateDatabase$room_runtime_release() == null) { return false; } return ((Boolean) this.autoCloser.executeRefCountingFunction(new PropertyReference1Impl() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$isDbLockedByCurrentThread$1 @Override // kotlin.jvm.internal.PropertyReference1Impl, kotlin.jvm.internal.PropertyReference1 public Object get(Object obj) { return Boolean.valueOf(((SupportSQLiteDatabase) obj).isDbLockedByCurrentThread()); } })).booleanValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean yieldIfContendedSafely() { return ((Boolean) this.autoCloser.executeRefCountingFunction(AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$yieldIfContendedSafely$1.INSTANCE)).booleanValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean yieldIfContendedSafely(long j) { return ((Boolean) this.autoCloser.executeRefCountingFunction(AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$yieldIfContendedSafely$2.INSTANCE)).booleanValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public int getVersion() { return ((Number) this.autoCloser.executeRefCountingFunction(new MutablePropertyReference1Impl() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$version$1 @Override // kotlin.jvm.internal.MutablePropertyReference1Impl, kotlin.jvm.internal.MutablePropertyReference1 public Object get(Object obj) { return Integer.valueOf(((SupportSQLiteDatabase) obj).getVersion()); } @Override // kotlin.jvm.internal.MutablePropertyReference1Impl, kotlin.jvm.internal.MutablePropertyReference1 public void set(Object obj, Object obj2) { ((SupportSQLiteDatabase) obj).setVersion(((Number) obj2).intValue()); } })).intValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void setVersion(final int i) { this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$version$2 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); db.setVersion(i); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public long getMaximumSize() { return ((Number) this.autoCloser.executeRefCountingFunction(new PropertyReference1Impl() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$maximumSize$1 @Override // kotlin.jvm.internal.PropertyReference1Impl, kotlin.jvm.internal.PropertyReference1 public Object get(Object obj) { return Long.valueOf(((SupportSQLiteDatabase) obj).getMaximumSize()); } })).longValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public long setMaximumSize(final long j) { return ((Number) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$setMaximumSize$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Long invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); return Long.valueOf(db.setMaximumSize(j)); } })).longValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public long getPageSize() { return ((Number) this.autoCloser.executeRefCountingFunction(new MutablePropertyReference1Impl() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$pageSize$1 @Override // kotlin.jvm.internal.MutablePropertyReference1Impl, kotlin.jvm.internal.MutablePropertyReference1 public Object get(Object obj) { return Long.valueOf(((SupportSQLiteDatabase) obj).getPageSize()); } @Override // kotlin.jvm.internal.MutablePropertyReference1Impl, kotlin.jvm.internal.MutablePropertyReference1 public void set(Object obj, Object obj2) { ((SupportSQLiteDatabase) obj).setPageSize(((Number) obj2).longValue()); } })).longValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void setPageSize(final long j) { this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$pageSize$2 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); db.setPageSize(j); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public Cursor query(String query) { Intrinsics.checkNotNullParameter(query, "query"); try { return new KeepAliveCursor(this.autoCloser.incrementCountAndEnsureDbIsOpen().query(query), this.autoCloser); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public Cursor query(String query, Object[] bindArgs) { Intrinsics.checkNotNullParameter(query, "query"); Intrinsics.checkNotNullParameter(bindArgs, "bindArgs"); try { return new KeepAliveCursor(this.autoCloser.incrementCountAndEnsureDbIsOpen().query(query, bindArgs), this.autoCloser); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public Cursor query(SupportSQLiteQuery query) { Intrinsics.checkNotNullParameter(query, "query"); try { return new KeepAliveCursor(this.autoCloser.incrementCountAndEnsureDbIsOpen().query(query), this.autoCloser); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase @RequiresApi(api = 24) public Cursor query(SupportSQLiteQuery query, CancellationSignal cancellationSignal) { Intrinsics.checkNotNullParameter(query, "query"); try { return new KeepAliveCursor(this.autoCloser.incrementCountAndEnsureDbIsOpen().query(query, cancellationSignal), this.autoCloser); } catch (Throwable th) { this.autoCloser.decrementCountAndScheduleClose(); throw th; } } @Override // androidx.sqlite.db.SupportSQLiteDatabase public long insert(final String table, final int i, final ContentValues values) throws SQLException { Intrinsics.checkNotNullParameter(table, "table"); Intrinsics.checkNotNullParameter(values, "values"); return ((Number) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$insert$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Long invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); return Long.valueOf(db.insert(table, i, values)); } })).longValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public int delete(final String table, final String str, final Object[] objArr) { Intrinsics.checkNotNullParameter(table, "table"); return ((Number) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$delete$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Integer invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); return Integer.valueOf(db.delete(table, str, objArr)); } })).intValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public int update(final String table, final int i, final ContentValues values, final String str, final Object[] objArr) { Intrinsics.checkNotNullParameter(table, "table"); Intrinsics.checkNotNullParameter(values, "values"); return ((Number) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$update$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Integer invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); return Integer.valueOf(db.update(table, i, values, str, objArr)); } })).intValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void execSQL(final String sql) throws SQLException { Intrinsics.checkNotNullParameter(sql, "sql"); this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$execSQL$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); db.execSQL(sql); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void execSQL(final String sql, final Object[] bindArgs) throws SQLException { Intrinsics.checkNotNullParameter(sql, "sql"); Intrinsics.checkNotNullParameter(bindArgs, "bindArgs"); this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$execSQL$2 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); db.execSQL(sql, bindArgs); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean isReadOnly() { return ((Boolean) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$isReadOnly$1 @Override // kotlin.jvm.functions.Function1 public final Boolean invoke(SupportSQLiteDatabase obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return Boolean.valueOf(obj.isReadOnly()); } })).booleanValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean isOpen() { SupportSQLiteDatabase delegateDatabase$room_runtime_release = this.autoCloser.getDelegateDatabase$room_runtime_release(); if (delegateDatabase$room_runtime_release == null) { return false; } return delegateDatabase$room_runtime_release.isOpen(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean needUpgrade(final int i) { return ((Boolean) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$needUpgrade$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Boolean invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); return Boolean.valueOf(db.needUpgrade(i)); } })).booleanValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public String getPath() { return (String) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$path$1 @Override // kotlin.jvm.functions.Function1 public final String invoke(SupportSQLiteDatabase obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return obj.getPath(); } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void setLocale(final Locale locale) { Intrinsics.checkNotNullParameter(locale, "locale"); this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$setLocale$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); db.setLocale(locale); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void setMaxSqlCacheSize(final int i) { this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$setMaxSqlCacheSize$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); db.setMaxSqlCacheSize(i); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase @RequiresApi(api = 16) public void setForeignKeyConstraintsEnabled(final boolean z) { this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$setForeignKeyConstraintsEnabled$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); db.setForeignKeyConstraintsEnabled(z); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean enableWriteAheadLogging() { throw new UnsupportedOperationException("Enable/disable write ahead logging on the OpenHelper instead of on the database directly."); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public void disableWriteAheadLogging() { throw new UnsupportedOperationException("Enable/disable write ahead logging on the OpenHelper instead of on the database directly."); } @Override // androidx.sqlite.db.SupportSQLiteDatabase @RequiresApi(api = 16) public boolean isWriteAheadLoggingEnabled() { return ((Boolean) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$isWriteAheadLoggingEnabled$1 @Override // kotlin.jvm.functions.Function1 public final Boolean invoke(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); return Boolean.valueOf(db.isWriteAheadLoggingEnabled()); } })).booleanValue(); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public List> getAttachedDbs() { return (List) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$attachedDbs$1 @Override // kotlin.jvm.functions.Function1 public final List> invoke(SupportSQLiteDatabase obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return obj.getAttachedDbs(); } }); } @Override // androidx.sqlite.db.SupportSQLiteDatabase public boolean isDatabaseIntegrityOk() { return ((Boolean) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSQLiteDatabase$isDatabaseIntegrityOk$1 @Override // kotlin.jvm.functions.Function1 public final Boolean invoke(SupportSQLiteDatabase obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return Boolean.valueOf(obj.isDatabaseIntegrityOk()); } })).booleanValue(); } @Override // java.io.Closeable, java.lang.AutoCloseable public void close() throws IOException { this.autoCloser.closeDatabaseIfOpen(); } } public static final class KeepAliveCursor implements Cursor { private final AutoCloser autoCloser; private final Cursor delegate; @Override // android.database.Cursor public void copyStringToBuffer(int i, CharArrayBuffer charArrayBuffer) { this.delegate.copyStringToBuffer(i, charArrayBuffer); } @Override // android.database.Cursor public void deactivate() { this.delegate.deactivate(); } @Override // android.database.Cursor public byte[] getBlob(int i) { return this.delegate.getBlob(i); } @Override // android.database.Cursor public int getColumnCount() { return this.delegate.getColumnCount(); } @Override // android.database.Cursor public int getColumnIndex(String str) { return this.delegate.getColumnIndex(str); } @Override // android.database.Cursor public int getColumnIndexOrThrow(String str) { return this.delegate.getColumnIndexOrThrow(str); } @Override // android.database.Cursor public String getColumnName(int i) { return this.delegate.getColumnName(i); } @Override // android.database.Cursor public String[] getColumnNames() { return this.delegate.getColumnNames(); } @Override // android.database.Cursor public int getCount() { return this.delegate.getCount(); } @Override // android.database.Cursor public double getDouble(int i) { return this.delegate.getDouble(i); } @Override // android.database.Cursor public Bundle getExtras() { return this.delegate.getExtras(); } @Override // android.database.Cursor public float getFloat(int i) { return this.delegate.getFloat(i); } @Override // android.database.Cursor public int getInt(int i) { return this.delegate.getInt(i); } @Override // android.database.Cursor public long getLong(int i) { return this.delegate.getLong(i); } @Override // android.database.Cursor public int getPosition() { return this.delegate.getPosition(); } @Override // android.database.Cursor public short getShort(int i) { return this.delegate.getShort(i); } @Override // android.database.Cursor public String getString(int i) { return this.delegate.getString(i); } @Override // android.database.Cursor public int getType(int i) { return this.delegate.getType(i); } @Override // android.database.Cursor public boolean getWantsAllOnMoveCalls() { return this.delegate.getWantsAllOnMoveCalls(); } @Override // android.database.Cursor public boolean isAfterLast() { return this.delegate.isAfterLast(); } @Override // android.database.Cursor public boolean isBeforeFirst() { return this.delegate.isBeforeFirst(); } @Override // android.database.Cursor public boolean isClosed() { return this.delegate.isClosed(); } @Override // android.database.Cursor public boolean isFirst() { return this.delegate.isFirst(); } @Override // android.database.Cursor public boolean isLast() { return this.delegate.isLast(); } @Override // android.database.Cursor public boolean isNull(int i) { return this.delegate.isNull(i); } @Override // android.database.Cursor public boolean move(int i) { return this.delegate.move(i); } @Override // android.database.Cursor public boolean moveToFirst() { return this.delegate.moveToFirst(); } @Override // android.database.Cursor public boolean moveToLast() { return this.delegate.moveToLast(); } @Override // android.database.Cursor public boolean moveToNext() { return this.delegate.moveToNext(); } @Override // android.database.Cursor public boolean moveToPosition(int i) { return this.delegate.moveToPosition(i); } @Override // android.database.Cursor public boolean moveToPrevious() { return this.delegate.moveToPrevious(); } @Override // android.database.Cursor public void registerContentObserver(ContentObserver contentObserver) { this.delegate.registerContentObserver(contentObserver); } @Override // android.database.Cursor public void registerDataSetObserver(DataSetObserver dataSetObserver) { this.delegate.registerDataSetObserver(dataSetObserver); } @Override // android.database.Cursor public boolean requery() { return this.delegate.requery(); } @Override // android.database.Cursor public Bundle respond(Bundle bundle) { return this.delegate.respond(bundle); } @Override // android.database.Cursor public void setNotificationUri(ContentResolver contentResolver, Uri uri) { this.delegate.setNotificationUri(contentResolver, uri); } @Override // android.database.Cursor public void unregisterContentObserver(ContentObserver contentObserver) { this.delegate.unregisterContentObserver(contentObserver); } @Override // android.database.Cursor public void unregisterDataSetObserver(DataSetObserver dataSetObserver) { this.delegate.unregisterDataSetObserver(dataSetObserver); } public KeepAliveCursor(Cursor delegate, AutoCloser autoCloser) { Intrinsics.checkNotNullParameter(delegate, "delegate"); Intrinsics.checkNotNullParameter(autoCloser, "autoCloser"); this.delegate = delegate; this.autoCloser = autoCloser; } @Override // android.database.Cursor, java.io.Closeable, java.lang.AutoCloseable public void close() { this.delegate.close(); this.autoCloser.decrementCountAndScheduleClose(); } @Override // android.database.Cursor @RequiresApi(api = 29) public void setNotificationUris(ContentResolver cr, List uris) { Intrinsics.checkNotNullParameter(cr, "cr"); Intrinsics.checkNotNullParameter(uris, "uris"); SupportSQLiteCompat.Api29Impl.setNotificationUris(this.delegate, cr, uris); } @Override // android.database.Cursor @RequiresApi(api = 19) public Uri getNotificationUri() { return SupportSQLiteCompat.Api19Impl.getNotificationUri(this.delegate); } @Override // android.database.Cursor @RequiresApi(api = 29) public List getNotificationUris() { return SupportSQLiteCompat.Api29Impl.getNotificationUris(this.delegate); } @Override // android.database.Cursor @RequiresApi(api = 23) public void setExtras(Bundle extras) { Intrinsics.checkNotNullParameter(extras, "extras"); SupportSQLiteCompat.Api23Impl.setExtras(this.delegate, extras); } } @SourceDebugExtension({"SMAP\nAutoClosingRoomOpenHelper.kt\nKotlin\n*S Kotlin\n*F\n+ 1 AutoClosingRoomOpenHelper.kt\nandroidx/room/AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,571:1\n1864#2,3:572\n*S KotlinDebug\n*F\n+ 1 AutoClosingRoomOpenHelper.kt\nandroidx/room/AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement\n*L\n478#1:572,3\n*E\n"}) public static final class AutoClosingSupportSqliteStatement implements SupportSQLiteStatement { private final AutoCloser autoCloser; private final ArrayList binds; private final String sql; @Override // java.io.Closeable, java.lang.AutoCloseable public void close() throws IOException { } public AutoClosingSupportSqliteStatement(String sql, AutoCloser autoCloser) { Intrinsics.checkNotNullParameter(sql, "sql"); Intrinsics.checkNotNullParameter(autoCloser, "autoCloser"); this.sql = sql; this.autoCloser = autoCloser; this.binds = new ArrayList<>(); } private final T executeSqliteStatementWithRefCount(final Function1 function1) { return (T) this.autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement$executeSqliteStatementWithRefCount$1 /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(1); } /* JADX WARN: Type inference failed for: r2v2, types: [T, java.lang.Object] */ @Override // kotlin.jvm.functions.Function1 public final T invoke(SupportSQLiteDatabase db) { String str; Intrinsics.checkNotNullParameter(db, "db"); str = AutoClosingRoomOpenHelper.AutoClosingSupportSqliteStatement.this.sql; SupportSQLiteStatement compileStatement = db.compileStatement(str); AutoClosingRoomOpenHelper.AutoClosingSupportSqliteStatement.this.doBinds(compileStatement); return function1.invoke(compileStatement); } }); } private final void saveBinds(int i, Object obj) { int size; int i2 = i - 1; if (i2 >= this.binds.size() && (size = this.binds.size()) <= i2) { while (true) { this.binds.add(null); if (size == i2) { break; } else { size++; } } } this.binds.set(i2, obj); } @Override // androidx.sqlite.db.SupportSQLiteStatement public void execute() { executeSqliteStatementWithRefCount(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement$execute$1 @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteStatement statement) { Intrinsics.checkNotNullParameter(statement, "statement"); statement.execute(); return null; } }); } @Override // androidx.sqlite.db.SupportSQLiteStatement public int executeUpdateDelete() { return ((Number) executeSqliteStatementWithRefCount(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement$executeUpdateDelete$1 @Override // kotlin.jvm.functions.Function1 public final Integer invoke(SupportSQLiteStatement obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return Integer.valueOf(obj.executeUpdateDelete()); } })).intValue(); } @Override // androidx.sqlite.db.SupportSQLiteStatement public long executeInsert() { return ((Number) executeSqliteStatementWithRefCount(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement$executeInsert$1 @Override // kotlin.jvm.functions.Function1 public final Long invoke(SupportSQLiteStatement obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return Long.valueOf(obj.executeInsert()); } })).longValue(); } @Override // androidx.sqlite.db.SupportSQLiteStatement public long simpleQueryForLong() { return ((Number) executeSqliteStatementWithRefCount(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement$simpleQueryForLong$1 @Override // kotlin.jvm.functions.Function1 public final Long invoke(SupportSQLiteStatement obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return Long.valueOf(obj.simpleQueryForLong()); } })).longValue(); } @Override // androidx.sqlite.db.SupportSQLiteStatement public String simpleQueryForString() { return (String) executeSqliteStatementWithRefCount(new Function1() { // from class: androidx.room.AutoClosingRoomOpenHelper$AutoClosingSupportSqliteStatement$simpleQueryForString$1 @Override // kotlin.jvm.functions.Function1 public final String invoke(SupportSQLiteStatement obj) { Intrinsics.checkNotNullParameter(obj, "obj"); return obj.simpleQueryForString(); } }); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindNull(int i) { saveBinds(i, null); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindLong(int i, long j) { saveBinds(i, Long.valueOf(j)); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindDouble(int i, double d) { saveBinds(i, Double.valueOf(d)); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindString(int i, String value) { Intrinsics.checkNotNullParameter(value, "value"); saveBinds(i, value); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void bindBlob(int i, byte[] value) { Intrinsics.checkNotNullParameter(value, "value"); saveBinds(i, value); } @Override // androidx.sqlite.db.SupportSQLiteProgram public void clearBindings() { this.binds.clear(); } /* JADX INFO: Access modifiers changed from: private */ public final void doBinds(SupportSQLiteStatement supportSQLiteStatement) { Iterator it = this.binds.iterator(); int i = 0; while (it.hasNext()) { it.next(); int i2 = i + 1; if (i < 0) { CollectionsKt__CollectionsKt.throwIndexOverflow(); } Object obj = this.binds.get(i); if (obj == null) { supportSQLiteStatement.bindNull(i2); } else if (obj instanceof Long) { supportSQLiteStatement.bindLong(i2, ((Number) obj).longValue()); } else if (obj instanceof Double) { supportSQLiteStatement.bindDouble(i2, ((Number) obj).doubleValue()); } else if (obj instanceof String) { supportSQLiteStatement.bindString(i2, (String) obj); } else if (obj instanceof byte[]) { supportSQLiteStatement.bindBlob(i2, (byte[]) obj); } i = i2; } } } }