Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,993 @@
package androidx.room;
import android.annotation.SuppressLint;
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.annotation.CallSuper;
import androidx.annotation.IntRange;
import androidx.annotation.RestrictTo;
import androidx.annotation.WorkerThread;
import androidx.arch.core.executor.ArchTaskExecutor;
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 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.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.collections.SetsKt__SetsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nRoomDatabase.kt\nKotlin\n*S Kotlin\n*F\n+ 1 RoomDatabase.kt\nandroidx/room/RoomDatabase\n+ 2 _Maps.kt\nkotlin/collections/MapsKt___MapsKt\n*L\n1#1,1548:1\n215#2,2:1549\n*S KotlinDebug\n*F\n+ 1 RoomDatabase.kt\nandroidx/room/RoomDatabase\n*L\n261#1:1549,2\n*E\n"})
/* loaded from: classes.dex */
public abstract class RoomDatabase {
public static final Companion Companion = new Companion(null);
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static final int MAX_BIND_PARAMETER_CNT = 999;
private boolean allowMainThreadQueries;
private AutoCloser autoCloser;
private final Map<String, Object> backingFieldMap;
private SupportSQLiteOpenHelper internalOpenHelper;
private Executor internalQueryExecutor;
private Executor internalTransactionExecutor;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
protected List<? extends Callback> mCallbacks;
protected volatile SupportSQLiteDatabase mDatabase;
private final Map<Class<?>, Object> typeConverters;
private boolean writeAheadLoggingEnabled;
private final InvalidationTracker invalidationTracker = createInvalidationTracker();
private Map<Class<? extends AutoMigrationSpec>, AutoMigrationSpec> autoMigrationSpecs = new LinkedHashMap();
private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
private final ThreadLocal<Integer> suspendingTransactionId = new ThreadLocal<>();
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");
}
}
public static abstract class PrepackagedDatabaseCallback {
public void onOpenPrepackagedDatabase(SupportSQLiteDatabase db) {
Intrinsics.checkNotNullParameter(db, "db");
}
}
public interface QueryCallback {
void onQuery(String str, List<? extends Object> list);
}
public static /* synthetic */ void getMCallbacks$annotations() {
}
public static /* synthetic */ void getMDatabase$annotations() {
}
public static /* synthetic */ void isOpen$annotations() {
}
public static /* synthetic */ void isOpenInternal$annotations() {
}
@WorkerThread
public abstract void clearAllTables();
public abstract InvalidationTracker createInvalidationTracker();
public abstract SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration databaseConfiguration);
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final Map<Class<? extends AutoMigrationSpec>, AutoMigrationSpec> getAutoMigrationSpecs() {
return this.autoMigrationSpecs;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final Map<String, Object> getBackingFieldMap() {
return this.backingFieldMap;
}
public InvalidationTracker getInvalidationTracker() {
return this.invalidationTracker;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final ThreadLocal<Integer> getSuspendingTransactionId() {
return this.suspendingTransactionId;
}
public final Cursor query(SupportSQLiteQuery query) {
Intrinsics.checkNotNullParameter(query, "query");
return query$default(this, query, null, 2, null);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final void setAutoMigrationSpecs(Map<Class<? extends AutoMigrationSpec>, AutoMigrationSpec> map) {
Intrinsics.checkNotNullParameter(map, "<set-?>");
this.autoMigrationSpecs = map;
}
public RoomDatabase() {
Map<String, Object> 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> T getTypeConverter(Class<T> klass) {
Intrinsics.checkNotNullParameter(klass, "klass");
return (T) this.typeConverters.get(klass);
}
@CallSuper
public void init(DatabaseConfiguration configuration) {
Intrinsics.checkNotNullParameter(configuration, "configuration");
this.internalOpenHelper = createOpenHelper(configuration);
Set<Class<? extends AutoMigrationSpec>> requiredAutoMigrationSpecs = getRequiredAutoMigrationSpecs();
BitSet bitSet = new BitSet();
Iterator<Class<? extends AutoMigrationSpec>> it = requiredAutoMigrationSpecs.iterator();
while (true) {
int i = -1;
if (it.hasNext()) {
Class<? extends AutoMigrationSpec> 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<Migration> 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<Class<?>, List<Class<?>>> requiredTypeConverters = getRequiredTypeConverters();
BitSet bitSet2 = new BitSet();
for (Map.Entry<Class<?>, List<Class<?>>> 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;
}
}
}
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public List<Migration> getAutoMigrations(Map<Class<? extends AutoMigrationSpec>, AutoMigrationSpec> autoMigrationSpecs) {
Intrinsics.checkNotNullParameter(autoMigrationSpecs, "autoMigrationSpecs");
return CollectionsKt__CollectionsKt.emptyList();
}
/* JADX WARN: Multi-variable type inference failed */
private final <T> T unwrapOpenHelper(Class<T> cls, SupportSQLiteOpenHelper supportSQLiteOpenHelper) {
if (cls.isInstance(supportSQLiteOpenHelper)) {
return supportSQLiteOpenHelper;
}
if (supportSQLiteOpenHelper instanceof DelegatingOpenHelper) {
return (T) unwrapOpenHelper(cls, ((DelegatingOpenHelper) supportSQLiteOpenHelper).getDelegate());
}
return null;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public Map<Class<?>, List<Class<?>>> getRequiredTypeConverters() {
Map<Class<?>, List<Class<?>>> emptyMap;
emptyMap = MapsKt__MapsKt.emptyMap();
return emptyMap;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public Set<Class<? extends AutoMigrationSpec>> getRequiredAutoMigrationSpecs() {
Set<Class<? extends AutoMigrationSpec>> emptySet;
emptySet = SetsKt__SetsKt.emptySet();
return 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(bool, Boolean.TRUE);
}
isOpen = supportSQLiteDatabase.isOpen();
}
bool = Boolean.valueOf(isOpen);
return Intrinsics.areEqual(bool, Boolean.TRUE);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final boolean isOpenInternal() {
SupportSQLiteDatabase supportSQLiteDatabase = this.mDatabase;
return supportSQLiteDatabase != null && supportSQLiteDatabase.isOpen();
}
public void close() {
if (isOpen()) {
ReentrantReadWriteLock.WriteLock writeLock = this.readWriteLock.writeLock();
Intrinsics.checkNotNullExpressionValue(writeLock, "readWriteLock.writeLock()");
writeLock.lock();
try {
getInvalidationTracker().stopMultiInstanceInvalidation$room_runtime_release();
getOpenHelper().close();
} finally {
writeLock.unlock();
}
}
}
public final boolean isMainThread$room_runtime_release() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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());
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
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[] objArr) {
Intrinsics.checkNotNullParameter(query, "query");
return getOpenHelper().getWritableDatabase().query(new SimpleSQLiteQuery(query, objArr));
}
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 cancellationSignal) {
Intrinsics.checkNotNullParameter(query, "query");
assertNotMainThread();
assertNotSuspendingTransaction();
if (cancellationSignal != null) {
return getOpenHelper().getWritableDatabase().query(query, cancellationSignal);
}
return getOpenHelper().getWritableDatabase().query(query);
}
public SupportSQLiteStatement compileStatement(String sql) {
Intrinsics.checkNotNullParameter(sql, "sql");
assertNotMainThread();
assertNotSuspendingTransaction();
return getOpenHelper().getWritableDatabase().compileStatement(sql);
}
public void beginTransaction() {
assertNotMainThread();
AutoCloser autoCloser = this.autoCloser;
if (autoCloser == null) {
internalBeginTransaction();
} else {
autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.RoomDatabase$beginTransaction$1
{
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();
}
}
public void endTransaction() {
AutoCloser autoCloser = this.autoCloser;
if (autoCloser == null) {
internalEndTransaction();
} else {
autoCloser.executeRefCountingFunction(new Function1() { // from class: androidx.room.RoomDatabase$endTransaction$1
{
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();
}
public void setTransactionSuccessful() {
getOpenHelper().getWritableDatabase().setTransactionSuccessful();
}
public void runInTransaction(Runnable body) {
Intrinsics.checkNotNullParameter(body, "body");
beginTransaction();
try {
body.run();
setTransactionSuccessful();
} finally {
endTransaction();
}
}
public <V> V runInTransaction(Callable<V> body) {
Intrinsics.checkNotNullParameter(body, "body");
beginTransaction();
try {
V call = body.call();
setTransactionSuccessful();
return call;
} finally {
endTransaction();
}
}
public void internalInitInvalidationTracker(SupportSQLiteDatabase db) {
Intrinsics.checkNotNullParameter(db, "db");
getInvalidationTracker().internalInit$room_runtime_release(db);
}
public boolean inTransaction() {
return getOpenHelper().getWritableDatabase().inTransaction();
}
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");
ActivityManager activityManager = systemService instanceof ActivityManager ? (ActivityManager) systemService : null;
return (activityManager == null || isLowRamDevice(activityManager)) ? TRUNCATE : WRITE_AHEAD_LOGGING;
}
private final boolean isLowRamDevice(ActivityManager activityManager) {
return SupportSQLiteCompat.Api19Impl.isLowRamDevice(activityManager);
}
}
@SourceDebugExtension({"SMAP\nRoomDatabase.kt\nKotlin\n*S Kotlin\n*F\n+ 1 RoomDatabase.kt\nandroidx/room/RoomDatabase$Builder\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,1548:1\n1#2:1549\n*E\n"})
public static class Builder<T extends RoomDatabase> {
private boolean allowDestructiveMigrationOnDowngrade;
private boolean allowMainThreadQueries;
private TimeUnit autoCloseTimeUnit;
private long autoCloseTimeout;
private List<AutoMigrationSpec> autoMigrationSpecs;
private final List<Callback> callbacks;
private final Context context;
private String copyFromAssetPath;
private File copyFromFile;
private Callable<InputStream> copyFromInputStream;
private SupportSQLiteOpenHelper.Factory factory;
private JournalMode journalMode;
private final Class<T> klass;
private final MigrationContainer migrationContainer;
private Set<Integer> migrationStartAndEndVersions;
private Set<Integer> 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<Object> typeConverters;
public Builder<T> allowMainThreadQueries() {
this.allowMainThreadQueries = true;
return this;
}
public Builder<T> createFromAsset(String databaseFilePath) {
Intrinsics.checkNotNullParameter(databaseFilePath, "databaseFilePath");
this.copyFromAssetPath = databaseFilePath;
return this;
}
@SuppressLint({"BuilderSetStyle"})
public Builder<T> createFromAsset(String databaseFilePath, PrepackagedDatabaseCallback callback) {
Intrinsics.checkNotNullParameter(databaseFilePath, "databaseFilePath");
Intrinsics.checkNotNullParameter(callback, "callback");
this.prepackagedDatabaseCallback = callback;
this.copyFromAssetPath = databaseFilePath;
return this;
}
public Builder<T> createFromFile(File databaseFile) {
Intrinsics.checkNotNullParameter(databaseFile, "databaseFile");
this.copyFromFile = databaseFile;
return this;
}
@SuppressLint({"BuilderSetStyle", "StreamFiles"})
public Builder<T> createFromFile(File databaseFile, PrepackagedDatabaseCallback callback) {
Intrinsics.checkNotNullParameter(databaseFile, "databaseFile");
Intrinsics.checkNotNullParameter(callback, "callback");
this.prepackagedDatabaseCallback = callback;
this.copyFromFile = databaseFile;
return this;
}
@SuppressLint({"BuilderSetStyle"})
public Builder<T> createFromInputStream(Callable<InputStream> inputStreamCallable) {
Intrinsics.checkNotNullParameter(inputStreamCallable, "inputStreamCallable");
this.copyFromInputStream = inputStreamCallable;
return this;
}
@SuppressLint({"BuilderSetStyle", "LambdaLast"})
public Builder<T> createFromInputStream(Callable<InputStream> inputStreamCallable, PrepackagedDatabaseCallback callback) {
Intrinsics.checkNotNullParameter(inputStreamCallable, "inputStreamCallable");
Intrinsics.checkNotNullParameter(callback, "callback");
this.prepackagedDatabaseCallback = callback;
this.copyFromInputStream = inputStreamCallable;
return this;
}
public Builder<T> fallbackToDestructiveMigration() {
this.requireMigration = false;
this.allowDestructiveMigrationOnDowngrade = true;
return this;
}
public Builder<T> fallbackToDestructiveMigrationOnDowngrade() {
this.requireMigration = true;
this.allowDestructiveMigrationOnDowngrade = true;
return this;
}
public Builder<T> openHelperFactory(SupportSQLiteOpenHelper.Factory factory) {
this.factory = factory;
return this;
}
public Builder<T> setJournalMode(JournalMode journalMode) {
Intrinsics.checkNotNullParameter(journalMode, "journalMode");
this.journalMode = journalMode;
return this;
}
@ExperimentalRoomApi
public Builder<T> setMultiInstanceInvalidationServiceIntent(Intent invalidationServiceIntent) {
Intrinsics.checkNotNullParameter(invalidationServiceIntent, "invalidationServiceIntent");
if (this.name == null) {
invalidationServiceIntent = null;
}
this.multiInstanceInvalidationIntent = invalidationServiceIntent;
return this;
}
public Builder<T> setQueryCallback(QueryCallback queryCallback, Executor executor) {
Intrinsics.checkNotNullParameter(queryCallback, "queryCallback");
Intrinsics.checkNotNullParameter(executor, "executor");
this.queryCallback = queryCallback;
this.queryCallbackExecutor = executor;
return this;
}
public Builder<T> setQueryExecutor(Executor executor) {
Intrinsics.checkNotNullParameter(executor, "executor");
this.queryExecutor = executor;
return this;
}
public Builder<T> setTransactionExecutor(Executor executor) {
Intrinsics.checkNotNullParameter(executor, "executor");
this.transactionExecutor = executor;
return this;
}
public Builder(Context context, Class<T> 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<T> addMigrations(Migration... migrations) {
Intrinsics.checkNotNullParameter(migrations, "migrations");
if (this.migrationStartAndEndVersions == null) {
this.migrationStartAndEndVersions = new HashSet();
}
for (Migration migration : migrations) {
Set<Integer> set = this.migrationStartAndEndVersions;
Intrinsics.checkNotNull(set);
set.add(Integer.valueOf(migration.startVersion));
Set<Integer> 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<T> addAutoMigrationSpec(AutoMigrationSpec autoMigrationSpec) {
Intrinsics.checkNotNullParameter(autoMigrationSpec, "autoMigrationSpec");
this.autoMigrationSpecs.add(autoMigrationSpec);
return this;
}
public Builder<T> enableMultiInstanceInvalidation() {
this.multiInstanceInvalidationIntent = this.name != null ? new Intent(this.context, (Class<?>) MultiInstanceInvalidationService.class) : null;
return this;
}
public Builder<T> fallbackToDestructiveMigrationFrom(int... startVersions) {
Intrinsics.checkNotNullParameter(startVersions, "startVersions");
for (int i : startVersions) {
this.migrationsNotRequiredFrom.add(Integer.valueOf(i));
}
return this;
}
public Builder<T> addCallback(Callback callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
this.callbacks.add(callback);
return this;
}
public Builder<T> addTypeConverter(Object typeConverter) {
Intrinsics.checkNotNullParameter(typeConverter, "typeConverter");
this.typeConverters.add(typeConverter);
return this;
}
@ExperimentalRoomApi
public Builder<T> setAutoCloseTimeout(@IntRange(from = 0) long j, TimeUnit autoCloseTimeUnit) {
Intrinsics.checkNotNullParameter(autoCloseTimeUnit, "autoCloseTimeUnit");
if (j < 0) {
throw new IllegalArgumentException("autoCloseTimeout must be >= 0".toString());
}
this.autoCloseTimeout = j;
this.autoCloseTimeUnit = autoCloseTimeUnit;
return this;
}
public T build() {
SupportSQLiteOpenHelper.Factory factory;
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<Integer> set = this.migrationStartAndEndVersions;
if (set != null) {
Intrinsics.checkNotNull(set);
Iterator<Integer> 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());
}
}
}
SupportSQLiteOpenHelper.Factory factory2 = this.factory;
if (factory2 == null) {
factory2 = new FrameworkSQLiteOpenHelperFactory();
}
if (factory2 != 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());
}
factory2 = new AutoClosingRoomOpenHelperFactory(factory2, 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());
}
int i = str == null ? 0 : 1;
File file = this.copyFromFile;
int i2 = file == null ? 0 : 1;
Callable<InputStream> callable = this.copyFromInputStream;
if (i + i2 + (callable != 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());
}
factory2 = new SQLiteCopyOpenHelperFactory(str, file, callable, factory2);
}
} else {
factory2 = null;
}
if (factory2 == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
QueryCallback queryCallback = this.queryCallback;
if (queryCallback != null) {
Executor executor3 = this.queryCallbackExecutor;
if (executor3 == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
if (queryCallback != null) {
factory = new QueryInterceptorOpenHelperFactory(factory2, executor3, queryCallback);
} else {
throw new IllegalArgumentException("Required value was null.".toString());
}
} else {
factory = factory2;
}
Context context = this.context;
String str2 = this.name;
MigrationContainer migrationContainer = this.migrationContainer;
List<Callback> 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<? extends Object>) 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());
}
}
@SourceDebugExtension({"SMAP\nRoomDatabase.kt\nKotlin\n*S Kotlin\n*F\n+ 1 RoomDatabase.kt\nandroidx/room/RoomDatabase$MigrationContainer\n+ 2 _Arrays.kt\nkotlin/collections/ArraysKt___ArraysKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 4 Maps.kt\nkotlin/collections/MapsKt__MapsKt\n*L\n1#1,1548:1\n13579#2,2:1549\n1855#3,2:1551\n361#4,7:1553\n*S KotlinDebug\n*F\n+ 1 RoomDatabase.kt\nandroidx/room/RoomDatabase$MigrationContainer\n*L\n1371#1:1549,2\n1381#1:1551,2\n1387#1:1553,7\n*E\n"})
public static class MigrationContainer {
private final Map<Integer, TreeMap<Integer, Migration>> migrations = new LinkedHashMap();
public Map<Integer, Map<Integer, Migration>> getMigrations() {
return this.migrations;
}
public void addMigrations(List<? extends Migration> migrations) {
Intrinsics.checkNotNullParameter(migrations, "migrations");
Iterator<T> 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<Integer, TreeMap<Integer, Migration>> map = this.migrations;
Integer valueOf = Integer.valueOf(i);
TreeMap<Integer, Migration> treeMap = map.get(valueOf);
if (treeMap == null) {
treeMap = new TreeMap<>();
map.put(valueOf, treeMap);
}
TreeMap<Integer, Migration> treeMap2 = treeMap;
if (treeMap2.containsKey(Integer.valueOf(i2))) {
Log.w(Room.LOG_TAG, "Overriding migration " + treeMap2.get(Integer.valueOf(i2)) + " with " + migration);
}
treeMap2.put(Integer.valueOf(i2), migration);
}
public List<Migration> findMigrationPath(int i, int i2) {
if (i == i2) {
return CollectionsKt__CollectionsKt.emptyList();
}
return findUpMigrationPath(new ArrayList(), i2 > i, i, i2);
}
/* 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<androidx.room.migration.Migration> findUpMigrationPath(java.util.List<androidx.room.migration.Migration> r7, boolean r8, int r9, int r10) {
/*
r6 = this;
L0:
if (r8 == 0) goto L5
if (r9 >= r10) goto L63
goto L7
L5:
if (r9 <= r10) goto L63
L7:
java.util.Map<java.lang.Integer, java.util.TreeMap<java.lang.Integer, androidx.room.migration.Migration>> 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 L1e
java.util.NavigableSet r2 = r0.descendingKeySet()
goto L22
L1e:
java.util.Set r2 = r0.keySet()
L22:
java.util.Iterator r2 = r2.iterator()
L26:
boolean r3 = r2.hasNext()
if (r3 == 0) goto L5f
java.lang.Object r3 = r2.next()
java.lang.Integer r3 = (java.lang.Integer) r3
java.lang.String r4 = "targetVersion"
if (r8 == 0) goto L44
int r5 = r9 + 1
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r4)
int r4 = r3.intValue()
if (r5 > r4) goto L26
if (r4 > r10) goto L26
goto L4f
L44:
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r3, r4)
int r4 = r3.intValue()
if (r10 > r4) goto L26
if (r4 >= r9) goto L26
L4f:
java.lang.Object r9 = r0.get(r3)
kotlin.jvm.internal.Intrinsics.checkNotNull(r9)
r7.add(r9)
int r9 = r3.intValue()
r0 = 1
goto L60
L5f:
r0 = 0
L60:
if (r0 != 0) goto L0
return r1
L63:
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 i, int i2) {
Map<Integer, Map<Integer, Migration>> migrations = getMigrations();
if (!migrations.containsKey(Integer.valueOf(i))) {
return false;
}
Map<Integer, Migration> map = migrations.get(Integer.valueOf(i));
if (map == null) {
map = MapsKt__MapsKt.emptyMap();
}
return map.containsKey(Integer.valueOf(i2));
}
public void addMigrations(Migration... migrations) {
Intrinsics.checkNotNullParameter(migrations, "migrations");
for (Migration migration : migrations) {
addMigration(migration);
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}