package androidx.room; import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.os.CancellationSignal; import android.os.Looper; import android.util.Log; import androidx.arch.core.executor.ArchTaskExecutor; import androidx.exifinterface.media.ExifInterface; import androidx.room.migration.AutoMigrationSpec; import androidx.room.migration.Migration; import androidx.sqlite.db.SimpleSQLiteQuery; 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 androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory; import io.sentry.Session; import io.sentry.protocol.OperatingSystem; import java.io.File; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; import kotlin.Deprecated; import kotlin.Metadata; import kotlin.ReplaceWith; import kotlin.collections.CollectionsKt; import kotlin.collections.MapsKt; import kotlin.collections.SetsKt; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Intrinsics; /* compiled from: RoomDatabase.kt */ @Metadata(d1 = {"\u0000Ä\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010%\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010$\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\"\n\u0002\b\r\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\r\b&\u0018\u0000 n2\u00020\u0001:\u0007lmnopqrB\u0005¢\u0006\u0002\u0010\u0002J\b\u00108\u001a\u000209H\u0017J\b\u0010:\u001a\u000209H\u0017J\b\u0010;\u001a\u000209H\u0017J\b\u0010<\u001a\u000209H'J\b\u0010=\u001a\u000209H\u0016J\u0010\u0010>\u001a\u00020?2\u0006\u0010@\u001a\u00020\u0010H\u0016J\b\u0010A\u001a\u00020\u0018H$J\u0010\u0010B\u001a\u00020\u00132\u0006\u0010C\u001a\u00020DH$J\b\u0010E\u001a\u000209H\u0017J*\u0010F\u001a\b\u0012\u0004\u0012\u00020G0!2\u001a\u0010\u0007\u001a\u0016\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020\n0\t\u0012\u0004\u0012\u00020\n0HH\u0017J\r\u0010I\u001a\u00020JH\u0000¢\u0006\u0002\bKJ\u0016\u0010L\u001a\u0010\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020\n0\t0MH\u0017J\"\u0010N\u001a\u001c\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t\u0012\u000e\u0012\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t0!0HH\u0015J#\u0010O\u001a\u0004\u0018\u0001HP\"\u0004\b\u0000\u0010P2\f\u0010Q\u001a\b\u0012\u0004\u0012\u0002HP0\tH\u0016¢\u0006\u0002\u0010RJ\b\u0010S\u001a\u00020\u0004H\u0016J\u0010\u0010T\u001a\u0002092\u0006\u0010U\u001a\u00020DH\u0017J\b\u0010V\u001a\u000209H\u0002J\b\u0010W\u001a\u000209H\u0002J\u0010\u0010X\u001a\u0002092\u0006\u0010Y\u001a\u00020%H\u0014J\u001c\u0010Z\u001a\u00020[2\u0006\u0010Z\u001a\u00020\\2\n\b\u0002\u0010]\u001a\u0004\u0018\u00010^H\u0017J)\u0010Z\u001a\u00020[2\u0006\u0010Z\u001a\u00020\u00102\u0012\u0010_\u001a\u000e\u0012\b\b\u0001\u0012\u0004\u0018\u00010\u0001\u0018\u00010`H\u0016¢\u0006\u0002\u0010aJ\u0010\u0010b\u001a\u0002092\u0006\u0010c\u001a\u00020dH\u0016J!\u0010b\u001a\u0002He\"\u0004\b\u0000\u0010e2\f\u0010c\u001a\b\u0012\u0004\u0012\u0002He0fH\u0016¢\u0006\u0002\u0010gJ\b\u0010h\u001a\u000209H\u0017J+\u0010i\u001a\u0004\u0018\u0001HP\"\u0004\b\u0000\u0010P2\f\u0010j\u001a\b\u0012\u0004\u0012\u0002HP0\t2\u0006\u0010'\u001a\u00020\u0013H\u0002¢\u0006\u0002\u0010kR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R2\u0010\u0007\u001a\u0016\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020\n0\t\u0012\u0004\u0012\u00020\n0\b8\u0004@\u0004X\u0085\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\f\"\u0004\b\r\u0010\u000eR\u001f\u0010\u000f\u001a\u000e\u0012\u0004\u0012\u00020\u0010\u0012\u0004\u0012\u00020\u00010\b8G¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\fR\u000e\u0010\u0012\u001a\u00020\u0013X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0014\u001a\u00020\u0015X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u0015X\u0082.¢\u0006\u0002\n\u0000R\u0014\u0010\u0017\u001a\u00020\u0018X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u001aR\u0014\u0010\u001b\u001a\u00020\u00048@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u001dR\u001a\u0010\u001e\u001a\u00020\u00048VX\u0096\u0004¢\u0006\f\u0012\u0004\b\u001f\u0010\u0002\u001a\u0004\b\u001e\u0010\u001dR \u0010 \u001a\n\u0012\u0004\u0012\u00020\"\u0018\u00010!8\u0004@\u0004X\u0085\u000e¢\u0006\b\n\u0000\u0012\u0004\b#\u0010\u0002R\u001a\u0010$\u001a\u0004\u0018\u00010%8\u0004@\u0004X\u0085\u000e¢\u0006\b\n\u0000\u0012\u0004\b&\u0010\u0002R\u0014\u0010'\u001a\u00020\u00138VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b(\u0010)R\u0014\u0010*\u001a\u00020\u00158VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b+\u0010,R\u000e\u0010-\u001a\u00020.X\u0082\u0004¢\u0006\u0002\n\u0000R\u0019\u0010/\u001a\b\u0012\u0004\u0012\u000201008G¢\u0006\b\n\u0000\u001a\u0004\b2\u00103R\u0014\u00104\u001a\u00020\u00158VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b5\u0010,R\u001e\u00106\u001a\u0012\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t\u0012\u0004\u0012\u00020\u00010\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u00107\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006s"}, d2 = {"Landroidx/room/RoomDatabase;", "", "()V", "allowMainThreadQueries", "", "autoCloser", "Landroidx/room/AutoCloser;", "autoMigrationSpecs", "", "Ljava/lang/Class;", "Landroidx/room/migration/AutoMigrationSpec;", "getAutoMigrationSpecs", "()Ljava/util/Map;", "setAutoMigrationSpecs", "(Ljava/util/Map;)V", "backingFieldMap", "", "getBackingFieldMap", "internalOpenHelper", "Landroidx/sqlite/db/SupportSQLiteOpenHelper;", "internalQueryExecutor", "Ljava/util/concurrent/Executor;", "internalTransactionExecutor", "invalidationTracker", "Landroidx/room/InvalidationTracker;", "getInvalidationTracker", "()Landroidx/room/InvalidationTracker;", "isMainThread", "isMainThread$room_runtime_release", "()Z", "isOpen", "isOpen$annotations", "mCallbacks", "", "Landroidx/room/RoomDatabase$Callback;", "getMCallbacks$annotations", "mDatabase", "Landroidx/sqlite/db/SupportSQLiteDatabase;", "getMDatabase$annotations", "openHelper", "getOpenHelper", "()Landroidx/sqlite/db/SupportSQLiteOpenHelper;", "queryExecutor", "getQueryExecutor", "()Ljava/util/concurrent/Executor;", "readWriteLock", "Ljava/util/concurrent/locks/ReentrantReadWriteLock;", "suspendingTransactionId", "Ljava/lang/ThreadLocal;", "", "getSuspendingTransactionId", "()Ljava/lang/ThreadLocal;", "transactionExecutor", "getTransactionExecutor", "typeConverters", "writeAheadLoggingEnabled", "assertNotMainThread", "", "assertNotSuspendingTransaction", "beginTransaction", "clearAllTables", "close", "compileStatement", "Landroidx/sqlite/db/SupportSQLiteStatement;", "sql", "createInvalidationTracker", "createOpenHelper", "config", "Landroidx/room/DatabaseConfiguration;", "endTransaction", "getAutoMigrations", "Landroidx/room/migration/Migration;", "", "getCloseLock", "Ljava/util/concurrent/locks/Lock;", "getCloseLock$room_runtime_release", "getRequiredAutoMigrationSpecs", "", "getRequiredTypeConverters", "getTypeConverter", ExifInterface.GPS_DIRECTION_TRUE, "klass", "(Ljava/lang/Class;)Ljava/lang/Object;", "inTransaction", Session.JsonKeys.INIT, "configuration", "internalBeginTransaction", "internalEndTransaction", "internalInitInvalidationTracker", "db", "query", "Landroid/database/Cursor;", "Landroidx/sqlite/db/SupportSQLiteQuery;", "signal", "Landroid/os/CancellationSignal;", "args", "", "(Ljava/lang/String;[Ljava/lang/Object;)Landroid/database/Cursor;", "runInTransaction", "body", "Ljava/lang/Runnable;", ExifInterface.GPS_MEASUREMENT_INTERRUPTED, "Ljava/util/concurrent/Callable;", "(Ljava/util/concurrent/Callable;)Ljava/lang/Object;", "setTransactionSuccessful", "unwrapOpenHelper", "clazz", "(Ljava/lang/Class;Landroidx/sqlite/db/SupportSQLiteOpenHelper;)Ljava/lang/Object;", "Builder", "Callback", "Companion", "JournalMode", "MigrationContainer", "PrepackagedDatabaseCallback", "QueryCallback", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public abstract class RoomDatabase { public static final int MAX_BIND_PARAMETER_CNT = 999; private boolean allowMainThreadQueries; private AutoCloser autoCloser; private final Map backingFieldMap; private SupportSQLiteOpenHelper internalOpenHelper; private Executor internalQueryExecutor; private Executor internalTransactionExecutor; protected List mCallbacks; protected volatile SupportSQLiteDatabase mDatabase; private final Map, Object> typeConverters; private boolean writeAheadLoggingEnabled; private final InvalidationTracker invalidationTracker = createInvalidationTracker(); private Map, AutoMigrationSpec> autoMigrationSpecs = new LinkedHashMap(); private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(); private final ThreadLocal suspendingTransactionId = new ThreadLocal<>(); /* compiled from: RoomDatabase.kt */ @Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b&\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0010\u0010\u0007\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0010\u0010\b\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016¨\u0006\t"}, d2 = {"Landroidx/room/RoomDatabase$Callback;", "", "()V", "onCreate", "", "db", "Landroidx/sqlite/db/SupportSQLiteDatabase;", "onDestructiveMigration", "onOpen", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public static abstract class Callback { public void onCreate(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); } public void onDestructiveMigration(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); } public void onOpen(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); } } /* compiled from: RoomDatabase.kt */ @Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b&\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016¨\u0006\u0007"}, d2 = {"Landroidx/room/RoomDatabase$PrepackagedDatabaseCallback;", "", "()V", "onOpenPrepackagedDatabase", "", "db", "Landroidx/sqlite/db/SupportSQLiteDatabase;", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public static abstract class PrepackagedDatabaseCallback { public void onOpenPrepackagedDatabase(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); } } /* compiled from: RoomDatabase.kt */ @Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010 \n\u0000\bf\u0018\u00002\u00020\u0001J \u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u000e\u0010\u0006\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00010\u0007H&ø\u0001\u0000\u0082\u0002\u0006\n\u0004\b!0\u0001¨\u0006\bÀ\u0006\u0001"}, d2 = {"Landroidx/room/RoomDatabase$QueryCallback;", "", "onQuery", "", "sqlQuery", "", "bindArgs", "", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public interface QueryCallback { void onQuery(String sqlQuery, List bindArgs); } @Deprecated(message = "Will be hidden in a future release.") protected static /* synthetic */ void getMCallbacks$annotations() { } @Deprecated(message = "Will be hidden in the next release.") protected static /* synthetic */ void getMDatabase$annotations() { } public static /* synthetic */ void isOpen$annotations() { } public abstract void clearAllTables(); protected abstract InvalidationTracker createInvalidationTracker(); protected abstract SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration config); protected final Map, AutoMigrationSpec> getAutoMigrationSpecs() { return this.autoMigrationSpecs; } public final Map getBackingFieldMap() { return this.backingFieldMap; } public InvalidationTracker getInvalidationTracker() { return this.invalidationTracker; } public final ThreadLocal getSuspendingTransactionId() { return this.suspendingTransactionId; } public final Cursor query(SupportSQLiteQuery query) { Intrinsics.checkNotNullParameter(query, "query"); return query$default(this, query, null, 2, null); } protected final void setAutoMigrationSpecs(Map, AutoMigrationSpec> map) { Intrinsics.checkNotNullParameter(map, ""); this.autoMigrationSpecs = map; } public RoomDatabase() { Map synchronizedMap = Collections.synchronizedMap(new LinkedHashMap()); Intrinsics.checkNotNullExpressionValue(synchronizedMap, "synchronizedMap(mutableMapOf())"); this.backingFieldMap = synchronizedMap; this.typeConverters = new LinkedHashMap(); } public Executor getQueryExecutor() { Executor executor = this.internalQueryExecutor; if (executor != null) { return executor; } Intrinsics.throwUninitializedPropertyAccessException("internalQueryExecutor"); return null; } public Executor getTransactionExecutor() { Executor executor = this.internalTransactionExecutor; if (executor != null) { return executor; } Intrinsics.throwUninitializedPropertyAccessException("internalTransactionExecutor"); return null; } public SupportSQLiteOpenHelper getOpenHelper() { SupportSQLiteOpenHelper supportSQLiteOpenHelper = this.internalOpenHelper; if (supportSQLiteOpenHelper != null) { return supportSQLiteOpenHelper; } Intrinsics.throwUninitializedPropertyAccessException("internalOpenHelper"); return null; } public final Lock getCloseLock$room_runtime_release() { ReentrantReadWriteLock.ReadLock readLock = this.readWriteLock.readLock(); Intrinsics.checkNotNullExpressionValue(readLock, "readWriteLock.readLock()"); return readLock; } public T getTypeConverter(Class klass) { Intrinsics.checkNotNullParameter(klass, "klass"); return (T) this.typeConverters.get(klass); } public void init(DatabaseConfiguration configuration) { Intrinsics.checkNotNullParameter(configuration, "configuration"); this.internalOpenHelper = createOpenHelper(configuration); Set> requiredAutoMigrationSpecs = getRequiredAutoMigrationSpecs(); BitSet bitSet = new BitSet(); Iterator> it = requiredAutoMigrationSpecs.iterator(); while (true) { int i = -1; if (it.hasNext()) { Class next = it.next(); int size = configuration.autoMigrationSpecs.size() - 1; if (size >= 0) { while (true) { int i2 = size - 1; if (next.isAssignableFrom(configuration.autoMigrationSpecs.get(size).getClass())) { bitSet.set(size); i = size; break; } else if (i2 < 0) { break; } else { size = i2; } } } if (i < 0) { throw new IllegalArgumentException(("A required auto migration spec (" + next.getCanonicalName() + ") is missing in the database configuration.").toString()); } this.autoMigrationSpecs.put(next, configuration.autoMigrationSpecs.get(i)); } else { int size2 = configuration.autoMigrationSpecs.size() - 1; if (size2 >= 0) { while (true) { int i3 = size2 - 1; if (!bitSet.get(size2)) { throw new IllegalArgumentException("Unexpected auto migration specs found. Annotate AutoMigrationSpec implementation with @ProvidedAutoMigrationSpec annotation or remove this spec from the builder.".toString()); } if (i3 < 0) { break; } else { size2 = i3; } } } Iterator it2 = getAutoMigrations(this.autoMigrationSpecs).iterator(); while (true) { if (!it2.hasNext()) { break; } Migration next2 = it2.next(); if (!configuration.migrationContainer.contains(next2.startVersion, next2.endVersion)) { configuration.migrationContainer.addMigrations(next2); } } SQLiteCopyOpenHelper sQLiteCopyOpenHelper = (SQLiteCopyOpenHelper) unwrapOpenHelper(SQLiteCopyOpenHelper.class, getOpenHelper()); if (sQLiteCopyOpenHelper != null) { sQLiteCopyOpenHelper.setDatabaseConfiguration(configuration); } AutoClosingRoomOpenHelper autoClosingRoomOpenHelper = (AutoClosingRoomOpenHelper) unwrapOpenHelper(AutoClosingRoomOpenHelper.class, getOpenHelper()); if (autoClosingRoomOpenHelper != null) { this.autoCloser = autoClosingRoomOpenHelper.autoCloser; getInvalidationTracker().setAutoCloser$room_runtime_release(autoClosingRoomOpenHelper.autoCloser); } boolean z = configuration.journalMode == JournalMode.WRITE_AHEAD_LOGGING; getOpenHelper().setWriteAheadLoggingEnabled(z); this.mCallbacks = configuration.callbacks; this.internalQueryExecutor = configuration.queryExecutor; this.internalTransactionExecutor = new TransactionExecutor(configuration.transactionExecutor); this.allowMainThreadQueries = configuration.allowMainThreadQueries; this.writeAheadLoggingEnabled = z; if (configuration.multiInstanceInvalidationServiceIntent != null) { if (configuration.name == null) { throw new IllegalArgumentException("Required value was null.".toString()); } getInvalidationTracker().startMultiInstanceInvalidation$room_runtime_release(configuration.context, configuration.name, configuration.multiInstanceInvalidationServiceIntent); } Map, List>> requiredTypeConverters = getRequiredTypeConverters(); BitSet bitSet2 = new BitSet(); for (Map.Entry, List>> entry : requiredTypeConverters.entrySet()) { Class key = entry.getKey(); for (Class cls : entry.getValue()) { int size3 = configuration.typeConverters.size() - 1; if (size3 >= 0) { while (true) { int i4 = size3 - 1; if (cls.isAssignableFrom(configuration.typeConverters.get(size3).getClass())) { bitSet2.set(size3); break; } else if (i4 < 0) { break; } else { size3 = i4; } } } size3 = -1; if (size3 < 0) { throw new IllegalArgumentException(("A required type converter (" + cls + ") for " + key.getCanonicalName() + " is missing in the database configuration.").toString()); } this.typeConverters.put(cls, configuration.typeConverters.get(size3)); } } int size4 = configuration.typeConverters.size() - 1; if (size4 < 0) { return; } while (true) { int i5 = size4 - 1; if (!bitSet2.get(size4)) { throw new IllegalArgumentException("Unexpected type converter " + configuration.typeConverters.get(size4) + ". Annotate TypeConverter class with @ProvidedTypeConverter annotation or remove this converter from the builder."); } if (i5 < 0) { return; } else { size4 = i5; } } } } } public List getAutoMigrations(Map, AutoMigrationSpec> autoMigrationSpecs) { Intrinsics.checkNotNullParameter(autoMigrationSpecs, "autoMigrationSpecs"); return CollectionsKt.emptyList(); } private final T unwrapOpenHelper(Class clazz, SupportSQLiteOpenHelper openHelper) { if (clazz.isInstance(openHelper)) { return (T) openHelper; } if (openHelper instanceof DelegatingOpenHelper) { return (T) unwrapOpenHelper(clazz, ((DelegatingOpenHelper) openHelper).getDelegate()); } return null; } protected Map, List>> getRequiredTypeConverters() { return MapsKt.emptyMap(); } public Set> getRequiredAutoMigrationSpecs() { return SetsKt.emptySet(); } public boolean isOpen() { Boolean bool; boolean isOpen; AutoCloser autoCloser = this.autoCloser; if (autoCloser != null) { isOpen = autoCloser.isActive(); } else { SupportSQLiteDatabase supportSQLiteDatabase = this.mDatabase; if (supportSQLiteDatabase == null) { bool = null; return Intrinsics.areEqual((Object) bool, (Object) true); } isOpen = supportSQLiteDatabase.isOpen(); } bool = Boolean.valueOf(isOpen); return Intrinsics.areEqual((Object) bool, (Object) true); } public void close() { if (isOpen()) { ReentrantReadWriteLock.WriteLock writeLock = this.readWriteLock.writeLock(); Intrinsics.checkNotNullExpressionValue(writeLock, "readWriteLock.writeLock()"); ReentrantReadWriteLock.WriteLock writeLock2 = writeLock; writeLock2.lock(); try { getInvalidationTracker().stopMultiInstanceInvalidation$room_runtime_release(); getOpenHelper().close(); } finally { writeLock2.unlock(); } } } public final boolean isMainThread$room_runtime_release() { return Looper.getMainLooper().getThread() == Thread.currentThread(); } public void assertNotMainThread() { if (!this.allowMainThreadQueries && !(!isMainThread$room_runtime_release())) { throw new IllegalStateException("Cannot access database on the main thread since it may potentially lock the UI for a long period of time.".toString()); } } public void assertNotSuspendingTransaction() { if (!inTransaction() && this.suspendingTransactionId.get() != null) { throw new IllegalStateException("Cannot access database on a different coroutine context inherited from a suspending transaction.".toString()); } } public Cursor query(String query, Object[] args) { Intrinsics.checkNotNullParameter(query, "query"); return getOpenHelper().getWritableDatabase().query(new SimpleSQLiteQuery(query, args)); } public static /* synthetic */ Cursor query$default(RoomDatabase roomDatabase, SupportSQLiteQuery supportSQLiteQuery, CancellationSignal cancellationSignal, int i, Object obj) { if (obj != null) { throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: query"); } if ((i & 2) != 0) { cancellationSignal = null; } return roomDatabase.query(supportSQLiteQuery, cancellationSignal); } public Cursor query(SupportSQLiteQuery query, CancellationSignal signal) { Intrinsics.checkNotNullParameter(query, "query"); assertNotMainThread(); assertNotSuspendingTransaction(); if (signal != null) { return getOpenHelper().getWritableDatabase().query(query, signal); } return getOpenHelper().getWritableDatabase().query(query); } public SupportSQLiteStatement compileStatement(String sql) { Intrinsics.checkNotNullParameter(sql, "sql"); assertNotMainThread(); assertNotSuspendingTransaction(); return getOpenHelper().getWritableDatabase().compileStatement(sql); } @Deprecated(message = "beginTransaction() is deprecated", replaceWith = @ReplaceWith(expression = "runInTransaction(Runnable)", imports = {})) public void beginTransaction() { assertNotMainThread(); AutoCloser autoCloser = this.autoCloser; if (autoCloser == null) { internalBeginTransaction(); } else { autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.RoomDatabase$beginTransaction$1 /* JADX INFO: Access modifiers changed from: package-private */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase it) { Intrinsics.checkNotNullParameter(it, "it"); RoomDatabase.this.internalBeginTransaction(); return null; } }); } } /* JADX INFO: Access modifiers changed from: private */ public final void internalBeginTransaction() { assertNotMainThread(); SupportSQLiteDatabase writableDatabase = getOpenHelper().getWritableDatabase(); getInvalidationTracker().syncTriggers$room_runtime_release(writableDatabase); if (writableDatabase.isWriteAheadLoggingEnabled()) { writableDatabase.beginTransactionNonExclusive(); } else { writableDatabase.beginTransaction(); } } @Deprecated(message = "endTransaction() is deprecated", replaceWith = @ReplaceWith(expression = "runInTransaction(Runnable)", imports = {})) public void endTransaction() { AutoCloser autoCloser = this.autoCloser; if (autoCloser == null) { internalEndTransaction(); } else { autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.RoomDatabase$endTransaction$1 /* JADX INFO: Access modifiers changed from: package-private */ { super(1); } @Override // kotlin.jvm.functions.Function1 public final Object invoke(SupportSQLiteDatabase it) { Intrinsics.checkNotNullParameter(it, "it"); RoomDatabase.this.internalEndTransaction(); return null; } }); } } /* JADX INFO: Access modifiers changed from: private */ public final void internalEndTransaction() { getOpenHelper().getWritableDatabase().endTransaction(); if (inTransaction()) { return; } getInvalidationTracker().refreshVersionsAsync(); } @Deprecated(message = "setTransactionSuccessful() is deprecated", replaceWith = @ReplaceWith(expression = "runInTransaction(Runnable)", imports = {})) public void setTransactionSuccessful() { getOpenHelper().getWritableDatabase().setTransactionSuccessful(); } public void runInTransaction(Runnable body) { Intrinsics.checkNotNullParameter(body, "body"); beginTransaction(); try { body.run(); setTransactionSuccessful(); } finally { endTransaction(); } } public V runInTransaction(Callable body) { Intrinsics.checkNotNullParameter(body, "body"); beginTransaction(); try { V call = body.call(); setTransactionSuccessful(); return call; } finally { endTransaction(); } } /* JADX INFO: Access modifiers changed from: protected */ public void internalInitInvalidationTracker(SupportSQLiteDatabase db) { Intrinsics.checkNotNullParameter(db, "db"); getInvalidationTracker().internalInit$room_runtime_release(db); } public boolean inTransaction() { return getOpenHelper().getWritableDatabase().inTransaction(); } /* compiled from: RoomDatabase.kt */ @Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0002J\u0015\u0010\u0007\u001a\u00020\u00002\u0006\u0010\b\u001a\u00020\tH\u0000¢\u0006\u0002\b\nj\u0002\b\u000bj\u0002\b\fj\u0002\b\r¨\u0006\u000e"}, d2 = {"Landroidx/room/RoomDatabase$JournalMode;", "", "(Ljava/lang/String;I)V", "isLowRamDevice", "", "activityManager", "Landroid/app/ActivityManager;", "resolve", "context", "Landroid/content/Context;", "resolve$room_runtime_release", "AUTOMATIC", "TRUNCATE", "WRITE_AHEAD_LOGGING", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public enum JournalMode { AUTOMATIC, TRUNCATE, WRITE_AHEAD_LOGGING; public final JournalMode resolve$room_runtime_release(Context context) { Intrinsics.checkNotNullParameter(context, "context"); if (this != AUTOMATIC) { return this; } Object systemService = context.getSystemService("activity"); Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.ActivityManager"); return !isLowRamDevice((ActivityManager) systemService) ? WRITE_AHEAD_LOGGING : TRUNCATE; } private final boolean isLowRamDevice(ActivityManager activityManager) { return SupportSQLiteCompat.Api19Impl.isLowRamDevice(activityManager); } } /* compiled from: RoomDatabase.kt */ @Metadata(d1 = {"\u0000¦\u0001\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010#\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0010\u0015\n\u0002\b\u000b\b\u0016\u0018\u0000*\b\b\u0000\u0010\u0001*\u00020\u00022\u00020\u0003B'\b\u0000\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00028\u00000\u0007\u0012\b\u0010\b\u001a\u0004\u0018\u00010\t¢\u0006\u0002\u0010\nJ\u0016\u00103\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u00104\u001a\u00020\u0014H\u0016J\u0016\u00105\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u00106\u001a\u00020\u0016H\u0016J'\u00107\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0012\u00108\u001a\n\u0012\u0006\b\u0001\u0012\u00020:09\"\u00020:H\u0016¢\u0006\u0002\u0010;J\u0016\u0010<\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010=\u001a\u00020\u0003H\u0016J\u000e\u0010\r\u001a\b\u0012\u0004\u0012\u00028\u00000\u0000H\u0016J\r\u0010>\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010?J\u0016\u0010@\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010A\u001a\u00020\tH\u0016J\u001e\u0010@\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010A\u001a\u00020\t2\u0006\u00106\u001a\u00020*H\u0017J\u0016\u0010B\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010C\u001a\u00020\u0019H\u0016J\u001e\u0010B\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010C\u001a\u00020\u00192\u0006\u00106\u001a\u00020*H\u0017J\u001c\u0010D\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\f\u0010E\u001a\b\u0012\u0004\u0012\u00020\u001c0\u001bH\u0017J$\u0010D\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\f\u0010E\u001a\b\u0012\u0004\u0012\u00020\u001c0\u001b2\u0006\u00106\u001a\u00020*H\u0017J\u000e\u0010F\u001a\b\u0012\u0004\u0012\u00028\u00000\u0000H\u0016J\u000e\u0010G\u001a\b\u0012\u0004\u0012\u00028\u00000\u0000H\u0016J\u001a\u0010H\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\n\u0010I\u001a\u00020J\"\u00020%H\u0016J\u000e\u0010K\u001a\b\u0012\u0004\u0012\u00028\u00000\u0000H\u0016J\u0018\u0010L\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\b\u0010\u001d\u001a\u0004\u0018\u00010\u001eH\u0016J \u0010M\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\b\b\u0001\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u000e\u001a\u00020\u000fH\u0017J\u0016\u0010N\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010\u001f\u001a\u00020 H\u0016J\u0016\u0010O\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010P\u001a\u00020(H\u0017J\u001e\u0010Q\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010+\u001a\u00020,2\u0006\u0010R\u001a\u00020.H\u0016J\u0016\u0010S\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010R\u001a\u00020.H\u0016J\u0016\u0010T\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010R\u001a\u00020.H\u0016R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0012\u001a\b\u0012\u0004\u0012\u00020\u00140\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\u00160\u0013X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0017\u001a\u0004\u0018\u00010\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0018\u001a\u0004\u0018\u00010\u0019X\u0082\u000e¢\u0006\u0002\n\u0000R\u0016\u0010\u001a\u001a\n\u0012\u0004\u0012\u00020\u001c\u0018\u00010\u001bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u001d\u001a\u0004\u0018\u00010\u001eX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001f\u001a\u00020 X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0006\u001a\b\u0012\u0004\u0012\u00028\u00000\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010!\u001a\u00020\"X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010#\u001a\n\u0012\u0004\u0012\u00020%\u0018\u00010$X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010&\u001a\b\u0012\u0004\u0012\u00020%0$X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010'\u001a\u0004\u0018\u00010(X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\b\u001a\u0004\u0018\u00010\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010)\u001a\u0004\u0018\u00010*X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010+\u001a\u0004\u0018\u00010,X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010-\u001a\u0004\u0018\u00010.X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010/\u001a\u0004\u0018\u00010.X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u00100\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u00101\u001a\u0004\u0018\u00010.X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u00102\u001a\b\u0012\u0004\u0012\u00020\u00030\u0013X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006U"}, d2 = {"Landroidx/room/RoomDatabase$Builder;", ExifInterface.GPS_DIRECTION_TRUE, "Landroidx/room/RoomDatabase;", "", "context", "Landroid/content/Context;", "klass", "Ljava/lang/Class;", "name", "", "(Landroid/content/Context;Ljava/lang/Class;Ljava/lang/String;)V", "allowDestructiveMigrationOnDowngrade", "", "allowMainThreadQueries", "autoCloseTimeUnit", "Ljava/util/concurrent/TimeUnit;", "autoCloseTimeout", "", "autoMigrationSpecs", "", "Landroidx/room/migration/AutoMigrationSpec;", "callbacks", "Landroidx/room/RoomDatabase$Callback;", "copyFromAssetPath", "copyFromFile", "Ljava/io/File;", "copyFromInputStream", "Ljava/util/concurrent/Callable;", "Ljava/io/InputStream;", "factory", "Landroidx/sqlite/db/SupportSQLiteOpenHelper$Factory;", "journalMode", "Landroidx/room/RoomDatabase$JournalMode;", "migrationContainer", "Landroidx/room/RoomDatabase$MigrationContainer;", "migrationStartAndEndVersions", "", "", "migrationsNotRequiredFrom", "multiInstanceInvalidationIntent", "Landroid/content/Intent;", "prepackagedDatabaseCallback", "Landroidx/room/RoomDatabase$PrepackagedDatabaseCallback;", "queryCallback", "Landroidx/room/RoomDatabase$QueryCallback;", "queryCallbackExecutor", "Ljava/util/concurrent/Executor;", "queryExecutor", "requireMigration", "transactionExecutor", "typeConverters", "addAutoMigrationSpec", "autoMigrationSpec", "addCallback", "callback", "addMigrations", "migrations", "", "Landroidx/room/migration/Migration;", "([Landroidx/room/migration/Migration;)Landroidx/room/RoomDatabase$Builder;", "addTypeConverter", "typeConverter", OperatingSystem.JsonKeys.BUILD, "()Landroidx/room/RoomDatabase;", "createFromAsset", "databaseFilePath", "createFromFile", "databaseFile", "createFromInputStream", "inputStreamCallable", "enableMultiInstanceInvalidation", "fallbackToDestructiveMigration", "fallbackToDestructiveMigrationFrom", "startVersions", "", "fallbackToDestructiveMigrationOnDowngrade", "openHelperFactory", "setAutoCloseTimeout", "setJournalMode", "setMultiInstanceInvalidationServiceIntent", "invalidationServiceIntent", "setQueryCallback", "executor", "setQueryExecutor", "setTransactionExecutor", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public static class Builder { private boolean allowDestructiveMigrationOnDowngrade; private boolean allowMainThreadQueries; private TimeUnit autoCloseTimeUnit; private long autoCloseTimeout; private List autoMigrationSpecs; private final List callbacks; private final Context context; private String copyFromAssetPath; private File copyFromFile; private Callable copyFromInputStream; private SupportSQLiteOpenHelper.Factory factory; private JournalMode journalMode; private final Class klass; private final MigrationContainer migrationContainer; private Set migrationStartAndEndVersions; private Set migrationsNotRequiredFrom; private Intent multiInstanceInvalidationIntent; private final String name; private PrepackagedDatabaseCallback prepackagedDatabaseCallback; private QueryCallback queryCallback; private Executor queryCallbackExecutor; private Executor queryExecutor; private boolean requireMigration; private Executor transactionExecutor; private final List typeConverters; public Builder(Context context, Class klass, String str) { Intrinsics.checkNotNullParameter(context, "context"); Intrinsics.checkNotNullParameter(klass, "klass"); this.context = context; this.klass = klass; this.name = str; this.callbacks = new ArrayList(); this.typeConverters = new ArrayList(); this.autoMigrationSpecs = new ArrayList(); this.journalMode = JournalMode.AUTOMATIC; this.requireMigration = true; this.autoCloseTimeout = -1L; this.migrationContainer = new MigrationContainer(); this.migrationsNotRequiredFrom = new LinkedHashSet(); } public Builder createFromAsset(String databaseFilePath) { Intrinsics.checkNotNullParameter(databaseFilePath, "databaseFilePath"); this.copyFromAssetPath = databaseFilePath; return this; } public Builder createFromAsset(String databaseFilePath, PrepackagedDatabaseCallback callback) { Intrinsics.checkNotNullParameter(databaseFilePath, "databaseFilePath"); Intrinsics.checkNotNullParameter(callback, "callback"); this.prepackagedDatabaseCallback = callback; this.copyFromAssetPath = databaseFilePath; return this; } public Builder createFromFile(File databaseFile) { Intrinsics.checkNotNullParameter(databaseFile, "databaseFile"); this.copyFromFile = databaseFile; return this; } public Builder createFromFile(File databaseFile, PrepackagedDatabaseCallback callback) { Intrinsics.checkNotNullParameter(databaseFile, "databaseFile"); Intrinsics.checkNotNullParameter(callback, "callback"); this.prepackagedDatabaseCallback = callback; this.copyFromFile = databaseFile; return this; } public Builder createFromInputStream(Callable inputStreamCallable) { Intrinsics.checkNotNullParameter(inputStreamCallable, "inputStreamCallable"); this.copyFromInputStream = inputStreamCallable; return this; } public Builder createFromInputStream(Callable inputStreamCallable, PrepackagedDatabaseCallback callback) { Intrinsics.checkNotNullParameter(inputStreamCallable, "inputStreamCallable"); Intrinsics.checkNotNullParameter(callback, "callback"); this.prepackagedDatabaseCallback = callback; this.copyFromInputStream = inputStreamCallable; return this; } public Builder openHelperFactory(SupportSQLiteOpenHelper.Factory factory) { this.factory = factory; return this; } public Builder addMigrations(Migration... migrations) { Intrinsics.checkNotNullParameter(migrations, "migrations"); if (this.migrationStartAndEndVersions == null) { this.migrationStartAndEndVersions = new HashSet(); } for (Migration migration : migrations) { Set set = this.migrationStartAndEndVersions; Intrinsics.checkNotNull(set); set.add(Integer.valueOf(migration.startVersion)); Set set2 = this.migrationStartAndEndVersions; Intrinsics.checkNotNull(set2); set2.add(Integer.valueOf(migration.endVersion)); } this.migrationContainer.addMigrations((Migration[]) Arrays.copyOf(migrations, migrations.length)); return this; } public Builder addAutoMigrationSpec(AutoMigrationSpec autoMigrationSpec) { Intrinsics.checkNotNullParameter(autoMigrationSpec, "autoMigrationSpec"); this.autoMigrationSpecs.add(autoMigrationSpec); return this; } public Builder allowMainThreadQueries() { this.allowMainThreadQueries = true; return this; } public Builder setJournalMode(JournalMode journalMode) { Intrinsics.checkNotNullParameter(journalMode, "journalMode"); this.journalMode = journalMode; return this; } public Builder setQueryExecutor(Executor executor) { Intrinsics.checkNotNullParameter(executor, "executor"); this.queryExecutor = executor; return this; } public Builder setTransactionExecutor(Executor executor) { Intrinsics.checkNotNullParameter(executor, "executor"); this.transactionExecutor = executor; return this; } public Builder enableMultiInstanceInvalidation() { Intent intent; if (this.name != null) { intent = new Intent(this.context, (Class) MultiInstanceInvalidationService.class); } else { intent = null; } this.multiInstanceInvalidationIntent = intent; return this; } @ExperimentalRoomApi public Builder setMultiInstanceInvalidationServiceIntent(Intent invalidationServiceIntent) { Intrinsics.checkNotNullParameter(invalidationServiceIntent, "invalidationServiceIntent"); if (this.name == null) { invalidationServiceIntent = null; } this.multiInstanceInvalidationIntent = invalidationServiceIntent; return this; } public Builder fallbackToDestructiveMigration() { this.requireMigration = false; this.allowDestructiveMigrationOnDowngrade = true; return this; } public Builder fallbackToDestructiveMigrationOnDowngrade() { this.requireMigration = true; this.allowDestructiveMigrationOnDowngrade = true; return this; } public Builder fallbackToDestructiveMigrationFrom(int... startVersions) { Intrinsics.checkNotNullParameter(startVersions, "startVersions"); for (int i : startVersions) { this.migrationsNotRequiredFrom.add(Integer.valueOf(i)); } return this; } public Builder addCallback(Callback callback) { Intrinsics.checkNotNullParameter(callback, "callback"); this.callbacks.add(callback); return this; } public Builder setQueryCallback(QueryCallback queryCallback, Executor executor) { Intrinsics.checkNotNullParameter(queryCallback, "queryCallback"); Intrinsics.checkNotNullParameter(executor, "executor"); this.queryCallback = queryCallback; this.queryCallbackExecutor = executor; return this; } public Builder addTypeConverter(Object typeConverter) { Intrinsics.checkNotNullParameter(typeConverter, "typeConverter"); this.typeConverters.add(typeConverter); return this; } @ExperimentalRoomApi public Builder setAutoCloseTimeout(long autoCloseTimeout, TimeUnit autoCloseTimeUnit) { Intrinsics.checkNotNullParameter(autoCloseTimeUnit, "autoCloseTimeUnit"); if (autoCloseTimeout < 0) { throw new IllegalArgumentException("autoCloseTimeout must be >= 0".toString()); } this.autoCloseTimeout = autoCloseTimeout; this.autoCloseTimeUnit = autoCloseTimeUnit; return this; } public T build() { Executor executor = this.queryExecutor; if (executor == null && this.transactionExecutor == null) { Executor iOThreadExecutor = ArchTaskExecutor.getIOThreadExecutor(); this.transactionExecutor = iOThreadExecutor; this.queryExecutor = iOThreadExecutor; } else if (executor != null && this.transactionExecutor == null) { this.transactionExecutor = executor; } else if (executor == null) { this.queryExecutor = this.transactionExecutor; } Set set = this.migrationStartAndEndVersions; if (set != null) { Intrinsics.checkNotNull(set); Iterator it = set.iterator(); while (it.hasNext()) { int intValue = it.next().intValue(); if (!(!this.migrationsNotRequiredFrom.contains(Integer.valueOf(intValue)))) { throw new IllegalArgumentException(("Inconsistency detected. A Migration was supplied to addMigration(Migration... migrations) that has a start or end version equal to a start version supplied to fallbackToDestructiveMigrationFrom(int... startVersions). Start version: " + intValue).toString()); } } } SQLiteCopyOpenHelperFactory sQLiteCopyOpenHelperFactory = this.factory; if (sQLiteCopyOpenHelperFactory == null) { sQLiteCopyOpenHelperFactory = new FrameworkSQLiteOpenHelperFactory(); } if (sQLiteCopyOpenHelperFactory != null) { if (this.autoCloseTimeout > 0) { if (this.name == null) { throw new IllegalArgumentException("Cannot create auto-closing database for an in-memory database.".toString()); } long j = this.autoCloseTimeout; TimeUnit timeUnit = this.autoCloseTimeUnit; if (timeUnit == null) { throw new IllegalArgumentException("Required value was null.".toString()); } Executor executor2 = this.queryExecutor; if (executor2 == null) { throw new IllegalArgumentException("Required value was null.".toString()); } sQLiteCopyOpenHelperFactory = new AutoClosingRoomOpenHelperFactory(sQLiteCopyOpenHelperFactory, new AutoCloser(j, timeUnit, executor2)); } String str = this.copyFromAssetPath; if (str != null || this.copyFromFile != null || this.copyFromInputStream != null) { if (this.name == null) { throw new IllegalArgumentException("Cannot create from asset or file for an in-memory database.".toString()); } if ((str == null ? 0 : 1) + (this.copyFromFile == null ? 0 : 1) + (this.copyFromInputStream != null ? 1 : 0) != 1) { throw new IllegalArgumentException("More than one of createFromAsset(), createFromInputStream(), and createFromFile() were called on this Builder, but the database can only be created using one of the three configurations.".toString()); } sQLiteCopyOpenHelperFactory = new SQLiteCopyOpenHelperFactory(this.copyFromAssetPath, this.copyFromFile, this.copyFromInputStream, sQLiteCopyOpenHelperFactory); } } else { sQLiteCopyOpenHelperFactory = null; } if (sQLiteCopyOpenHelperFactory == null) { throw new IllegalArgumentException("Required value was null.".toString()); } if (this.queryCallback != null) { Executor executor3 = this.queryCallbackExecutor; if (executor3 == null) { throw new IllegalArgumentException("Required value was null.".toString()); } QueryCallback queryCallback = this.queryCallback; if (queryCallback != null) { sQLiteCopyOpenHelperFactory = new QueryInterceptorOpenHelperFactory(sQLiteCopyOpenHelperFactory, executor3, queryCallback); } else { throw new IllegalArgumentException("Required value was null.".toString()); } } SupportSQLiteOpenHelper.Factory factory = sQLiteCopyOpenHelperFactory; Context context = this.context; String str2 = this.name; MigrationContainer migrationContainer = this.migrationContainer; List list = this.callbacks; boolean z = this.allowMainThreadQueries; JournalMode resolve$room_runtime_release = this.journalMode.resolve$room_runtime_release(context); Executor executor4 = this.queryExecutor; if (executor4 == null) { throw new IllegalArgumentException("Required value was null.".toString()); } Executor executor5 = this.transactionExecutor; if (executor5 != null) { DatabaseConfiguration databaseConfiguration = new DatabaseConfiguration(context, str2, factory, migrationContainer, list, z, resolve$room_runtime_release, executor4, executor5, this.multiInstanceInvalidationIntent, this.requireMigration, this.allowDestructiveMigrationOnDowngrade, this.migrationsNotRequiredFrom, this.copyFromAssetPath, this.copyFromFile, this.copyFromInputStream, this.prepackagedDatabaseCallback, (List) this.typeConverters, this.autoMigrationSpecs); T t = (T) Room.getGeneratedImplementation(this.klass, "_Impl"); t.init(databaseConfiguration); return t; } throw new IllegalArgumentException("Required value was null.".toString()); } } /* compiled from: RoomDatabase.kt */ @Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010%\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0000\n\u0002\u0010 \n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0010!\n\u0002\b\u0002\n\u0002\u0010$\n\u0000\b\u0016\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u0007H\u0002J!\u0010\u000b\u001a\u00020\t2\u0012\u0010\u0003\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\f\"\u00020\u0007H\u0016¢\u0006\u0002\u0010\rJ\u0016\u0010\u000b\u001a\u00020\t2\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00070\u000eH\u0016J\u0016\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00052\u0006\u0010\u0012\u001a\u00020\u0005J \u0010\u0013\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u000e2\u0006\u0010\u0014\u001a\u00020\u00052\u0006\u0010\u0015\u001a\u00020\u0005H\u0016J6\u0010\u0016\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u000e2\f\u0010\u0017\u001a\b\u0012\u0004\u0012\u00020\u00070\u00182\u0006\u0010\u0019\u001a\u00020\u00102\u0006\u0010\u0014\u001a\u00020\u00052\u0006\u0010\u0015\u001a\u00020\u0005H\u0002J \u0010\u001a\u001a\u001a\u0012\u0004\u0012\u00020\u0005\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00070\u001b0\u001bH\u0016R&\u0010\u0003\u001a\u001a\u0012\u0004\u0012\u00020\u0005\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00070\u00060\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001c"}, d2 = {"Landroidx/room/RoomDatabase$MigrationContainer;", "", "()V", "migrations", "", "", "Ljava/util/TreeMap;", "Landroidx/room/migration/Migration;", "addMigration", "", "migration", "addMigrations", "", "([Landroidx/room/migration/Migration;)V", "", "contains", "", "startVersion", "endVersion", "findMigrationPath", "start", "end", "findUpMigrationPath", "result", "", "upgrade", "getMigrations", "", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48) /* loaded from: classes2.dex */ public static class MigrationContainer { private final Map> migrations = new LinkedHashMap(); public Map> getMigrations() { return this.migrations; } public void addMigrations(List migrations) { Intrinsics.checkNotNullParameter(migrations, "migrations"); Iterator it = migrations.iterator(); while (it.hasNext()) { addMigration((Migration) it.next()); } } private final void addMigration(Migration migration) { int i = migration.startVersion; int i2 = migration.endVersion; Map> map = this.migrations; Integer valueOf = Integer.valueOf(i); TreeMap treeMap = map.get(valueOf); if (treeMap == null) { treeMap = new TreeMap<>(); map.put(valueOf, treeMap); } TreeMap treeMap2 = treeMap; TreeMap treeMap3 = treeMap2; if (treeMap3.containsKey(Integer.valueOf(i2))) { Log.w(Room.LOG_TAG, "Overriding migration " + treeMap2.get(Integer.valueOf(i2)) + " with " + migration); } treeMap3.put(Integer.valueOf(i2), migration); } public List findMigrationPath(int start, int end) { if (start == end) { return CollectionsKt.emptyList(); } return findUpMigrationPath(new ArrayList(), end > start, start, end); } /* JADX WARN: Removed duplicated region for block: B:40:0x0016 A[SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:5:0x0017 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private final java.util.List findUpMigrationPath(java.util.List r7, boolean r8, int r9, int r10) { /* r6 = this; L0: if (r8 == 0) goto L5 if (r9 >= r10) goto L65 goto L7 L5: if (r9 <= r10) goto L65 L7: java.util.Map> r0 = r6.migrations java.lang.Integer r1 = java.lang.Integer.valueOf(r9) java.lang.Object r0 = r0.get(r1) java.util.TreeMap r0 = (java.util.TreeMap) r0 r1 = 0 if (r0 != 0) goto L17 return r1 L17: if (r8 == 0) goto L20 java.util.NavigableSet r2 = r0.descendingKeySet() java.util.Set r2 = (java.util.Set) r2 goto L24 L20: java.util.Set r2 = r0.keySet() L24: java.util.Iterator r2 = r2.iterator() L28: boolean r3 = r2.hasNext() if (r3 == 0) goto L61 java.lang.Object r3 = r2.next() java.lang.Integer r3 = (java.lang.Integer) r3 java.lang.String r4 = "targetVersion" if (r8 == 0) goto L46 int r5 = r9 + 1 kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r4) int r4 = r3.intValue() if (r5 > r4) goto L28 if (r4 > r10) goto L28 goto L51 L46: kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r4) int r4 = r3.intValue() if (r10 > r4) goto L28 if (r4 >= r9) goto L28 L51: java.lang.Object r9 = r0.get(r3) kotlin.jvm.internal.Intrinsics.checkNotNull(r9) r7.add(r9) int r9 = r3.intValue() r0 = 1 goto L62 L61: r0 = 0 L62: if (r0 != 0) goto L0 return r1 L65: return r7 */ throw new UnsupportedOperationException("Method not decompiled: androidx.room.RoomDatabase.MigrationContainer.findUpMigrationPath(java.util.List, boolean, int, int):java.util.List"); } public final boolean contains(int startVersion, int endVersion) { Map> migrations = getMigrations(); if (!migrations.containsKey(Integer.valueOf(startVersion))) { return false; } Map map = migrations.get(Integer.valueOf(startVersion)); if (map == null) { map = MapsKt.emptyMap(); } return map.containsKey(Integer.valueOf(endVersion)); } public void addMigrations(Migration... migrations) { Intrinsics.checkNotNullParameter(migrations, "migrations"); for (Migration migration : migrations) { addMigration(migration); } } } }