mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
881 lines
53 KiB
Java
881 lines
53 KiB
Java
package androidx.room;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.database.Cursor;
|
|
import android.database.sqlite.SQLiteException;
|
|
import android.util.Log;
|
|
import androidx.arch.core.internal.SafeIterableMap;
|
|
import androidx.exifinterface.media.ExifInterface;
|
|
import androidx.lifecycle.LiveData;
|
|
import androidx.sqlite.db.SimpleSQLiteQuery;
|
|
import androidx.sqlite.db.SupportSQLiteDatabase;
|
|
import androidx.sqlite.db.SupportSQLiteStatement;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.locks.Lock;
|
|
import kotlin.Deprecated;
|
|
import kotlin.Metadata;
|
|
import kotlin.Unit;
|
|
import kotlin.collections.CollectionsKt;
|
|
import kotlin.collections.MapsKt;
|
|
import kotlin.collections.SetsKt;
|
|
import kotlin.io.CloseableKt;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.StringsKt;
|
|
|
|
/* compiled from: InvalidationTracker.kt */
|
|
@Metadata(d1 = {"\u0000¬\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010$\n\u0000\n\u0002\u0010\"\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\b\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0010\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0010\b\u0016\u0018\u0000 f2\u00020\u0001:\u0005fghijB#\b\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0012\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u0005\"\u00020\u0006¢\u0006\u0002\u0010\u0007BV\b\u0007\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0012\u0010\b\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00060\t\u0012\u001d\u0010\n\u001a\u0019\u0012\u0004\u0012\u00020\u0006\u0012\u000f\u0012\r\u0012\u0004\u0012\u00020\u00060\u000b¢\u0006\u0002\b\f0\t\u0012\u0012\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u0005\"\u00020\u0006¢\u0006\u0002\u0010\rJ\u0010\u00108\u001a\u0002092\u0006\u0010:\u001a\u00020\"H\u0017J\u0010\u0010;\u001a\u0002092\u0006\u0010:\u001a\u00020\"H\u0017J7\u0010<\u001a\b\u0012\u0004\u0012\u0002H>0=\"\u0004\b\u0000\u0010>2\u000e\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u00052\f\u0010?\u001a\b\u0012\u0004\u0012\u0002H>0@H\u0017¢\u0006\u0002\u0010AJ?\u0010<\u001a\b\u0012\u0004\u0012\u0002H>0=\"\u0004\b\u0000\u0010>2\u000e\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u00052\u0006\u0010B\u001a\u00020\u00192\f\u0010?\u001a\b\u0012\u0004\u0012\u0002H>0@H\u0017¢\u0006\u0002\u0010CJ\r\u0010D\u001a\u00020\u0019H\u0000¢\u0006\u0002\bEJ\u0015\u0010F\u001a\u0002092\u0006\u0010\u0002\u001a\u00020GH\u0000¢\u0006\u0002\bHJ!\u0010I\u001a\u0002092\u0012\u0010J\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u0005\"\u00020\u0006H\u0007¢\u0006\u0002\u0010KJ\r\u0010L\u001a\u000209H\u0000¢\u0006\u0002\bMJ\b\u0010N\u001a\u000209H\u0016J\b\u0010O\u001a\u000209H\u0017J\u0010\u0010P\u001a\u0002092\u0006\u0010:\u001a\u00020\"H\u0017J%\u0010Q\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u00052\u000e\u0010R\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u0005H\u0002¢\u0006\u0002\u0010SJ\u0015\u0010T\u001a\u0002092\u0006\u0010\u000e\u001a\u00020\u000fH\u0000¢\u0006\u0002\bUJ%\u0010V\u001a\u0002092\u0006\u0010W\u001a\u00020X2\u0006\u0010Y\u001a\u00020\u00062\u0006\u0010Z\u001a\u00020[H\u0000¢\u0006\u0002\b\\J\u0018\u0010]\u001a\u0002092\u0006\u0010^\u001a\u00020G2\u0006\u0010_\u001a\u000200H\u0002J\r\u0010`\u001a\u000209H\u0000¢\u0006\u0002\baJ\u0018\u0010b\u001a\u0002092\u0006\u0010^\u001a\u00020G2\u0006\u0010_\u001a\u000200H\u0002J\r\u0010c\u001a\u000209H\u0000¢\u0006\u0002\bdJ\u0015\u0010c\u001a\u0002092\u0006\u0010\u0002\u001a\u00020GH\u0000¢\u0006\u0002\bdJ%\u0010e\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u00052\u000e\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u0005H\u0002¢\u0006\u0002\u0010SR\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0012\u0010\u0013\"\u0004\b\u0014\u0010\u0015R\u0014\u0010\u0002\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0016\u0010\u0017R\u000e\u0010\u0018\u001a\u00020\u0019X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001a\u001a\u00020\u001bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u001c\u001a\u0004\u0018\u00010\u001dX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001e\u001a\u00020\u001fX\u0082\u0004¢\u0006\u0002\n\u0000R\"\u0010 \u001a\u000e\u0012\u0004\u0012\u00020\"\u0012\u0004\u0012\u00020#0!8\u0000X\u0081\u0004¢\u0006\b\n\u0000\u001a\u0004\b$\u0010%R\u0016\u0010&\u001a\u00020'8GX\u0087\u0004¢\u0006\b\n\u0000\u001a\u0004\b(\u0010)R\u0016\u0010*\u001a\u00020+8\u0006X\u0087\u0004¢\u0006\b\n\u0000\u0012\u0004\b,\u0010-R\u001a\u0010\b\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00060\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010.\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R \u0010/\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u0002000\tX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b1\u00102R\u001e\u00103\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u0005X\u0080\u0004¢\u0006\n\n\u0002\u00106\u001a\u0004\b4\u00105R\u000e\u00107\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R%\u0010\n\u001a\u0019\u0012\u0004\u0012\u00020\u0006\u0012\u000f\u0012\r\u0012\u0004\u0012\u00020\u00060\u000b¢\u0006\u0002\b\f0\tX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006k"}, d2 = {"Landroidx/room/InvalidationTracker;", "", "database", "Landroidx/room/RoomDatabase;", "tableNames", "", "", "(Landroidx/room/RoomDatabase;[Ljava/lang/String;)V", "shadowTablesMap", "", "viewTables", "", "Lkotlin/jvm/JvmSuppressWildcards;", "(Landroidx/room/RoomDatabase;Ljava/util/Map;Ljava/util/Map;[Ljava/lang/String;)V", "autoCloser", "Landroidx/room/AutoCloser;", "cleanupStatement", "Landroidx/sqlite/db/SupportSQLiteStatement;", "getCleanupStatement$room_runtime_release", "()Landroidx/sqlite/db/SupportSQLiteStatement;", "setCleanupStatement$room_runtime_release", "(Landroidx/sqlite/db/SupportSQLiteStatement;)V", "getDatabase$room_runtime_release", "()Landroidx/room/RoomDatabase;", "initialized", "", "invalidationLiveDataContainer", "Landroidx/room/InvalidationLiveDataContainer;", "multiInstanceInvalidationClient", "Landroidx/room/MultiInstanceInvalidationClient;", "observedTableTracker", "Landroidx/room/InvalidationTracker$ObservedTableTracker;", "observerMap", "Landroidx/arch/core/internal/SafeIterableMap;", "Landroidx/room/InvalidationTracker$Observer;", "Landroidx/room/InvalidationTracker$ObserverWrapper;", "getObserverMap$room_runtime_release", "()Landroidx/arch/core/internal/SafeIterableMap;", "pendingRefresh", "Ljava/util/concurrent/atomic/AtomicBoolean;", "getPendingRefresh", "()Ljava/util/concurrent/atomic/AtomicBoolean;", "refreshRunnable", "Ljava/lang/Runnable;", "getRefreshRunnable$annotations", "()V", "syncTriggersLock", "tableIdLookup", "", "getTableIdLookup$room_runtime_release", "()Ljava/util/Map;", "tablesNames", "getTablesNames$room_runtime_release", "()[Ljava/lang/String;", "[Ljava/lang/String;", "trackerLock", "addObserver", "", "observer", "addWeakObserver", "createLiveData", "Landroidx/lifecycle/LiveData;", ExifInterface.GPS_DIRECTION_TRUE, "computeFunction", "Ljava/util/concurrent/Callable;", "([Ljava/lang/String;Ljava/util/concurrent/Callable;)Landroidx/lifecycle/LiveData;", "inTransaction", "([Ljava/lang/String;ZLjava/util/concurrent/Callable;)Landroidx/lifecycle/LiveData;", "ensureInitialization", "ensureInitialization$room_runtime_release", "internalInit", "Landroidx/sqlite/db/SupportSQLiteDatabase;", "internalInit$room_runtime_release", "notifyObserversByTableNames", "tables", "([Ljava/lang/String;)V", "onAutoCloseCallback", "onAutoCloseCallback$room_runtime_release", "refreshVersionsAsync", "refreshVersionsSync", "removeObserver", "resolveViews", "names", "([Ljava/lang/String;)[Ljava/lang/String;", "setAutoCloser", "setAutoCloser$room_runtime_release", "startMultiInstanceInvalidation", "context", "Landroid/content/Context;", "name", "serviceIntent", "Landroid/content/Intent;", "startMultiInstanceInvalidation$room_runtime_release", "startTrackingTable", "db", "tableId", "stopMultiInstanceInvalidation", "stopMultiInstanceInvalidation$room_runtime_release", "stopTrackingTable", "syncTriggers", "syncTriggers$room_runtime_release", "validateAndResolveTableNames", "Companion", "ObservedTableTracker", "Observer", "ObserverWrapper", "WeakObserver", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public class InvalidationTracker {
|
|
private static final String CREATE_TRACKING_TABLE_SQL = "CREATE TEMP TABLE room_table_modification_log (table_id INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)";
|
|
private static final String INVALIDATED_COLUMN_NAME = "invalidated";
|
|
public static final String RESET_UPDATED_TABLES_SQL = "UPDATE room_table_modification_log SET invalidated = 0 WHERE invalidated = 1";
|
|
public static final String SELECT_UPDATED_TABLES_SQL = "SELECT * FROM room_table_modification_log WHERE invalidated = 1;";
|
|
private static final String TABLE_ID_COLUMN_NAME = "table_id";
|
|
private static final String UPDATE_TABLE_NAME = "room_table_modification_log";
|
|
private AutoCloser autoCloser;
|
|
private volatile SupportSQLiteStatement cleanupStatement;
|
|
private final RoomDatabase database;
|
|
private volatile boolean initialized;
|
|
private final InvalidationLiveDataContainer invalidationLiveDataContainer;
|
|
private MultiInstanceInvalidationClient multiInstanceInvalidationClient;
|
|
private final ObservedTableTracker observedTableTracker;
|
|
private final SafeIterableMap<Observer, ObserverWrapper> observerMap;
|
|
private final AtomicBoolean pendingRefresh;
|
|
public final Runnable refreshRunnable;
|
|
private final Map<String, String> shadowTablesMap;
|
|
private final Object syncTriggersLock;
|
|
private final Map<String, Integer> tableIdLookup;
|
|
private final String[] tablesNames;
|
|
private final Object trackerLock;
|
|
private final Map<String, Set<String>> viewTables;
|
|
|
|
/* renamed from: Companion, reason: from kotlin metadata */
|
|
public static final Companion INSTANCE = new Companion(null);
|
|
private static final String[] TRIGGERS = {"UPDATE", "DELETE", "INSERT"};
|
|
|
|
public static /* synthetic */ void getRefreshRunnable$annotations() {
|
|
}
|
|
|
|
/* renamed from: getCleanupStatement$room_runtime_release, reason: from getter */
|
|
public final SupportSQLiteStatement getCleanupStatement() {
|
|
return this.cleanupStatement;
|
|
}
|
|
|
|
/* renamed from: getDatabase$room_runtime_release, reason: from getter */
|
|
public final RoomDatabase getDatabase() {
|
|
return this.database;
|
|
}
|
|
|
|
public final SafeIterableMap<Observer, ObserverWrapper> getObserverMap$room_runtime_release() {
|
|
return this.observerMap;
|
|
}
|
|
|
|
public final AtomicBoolean getPendingRefresh() {
|
|
return this.pendingRefresh;
|
|
}
|
|
|
|
public final Map<String, Integer> getTableIdLookup$room_runtime_release() {
|
|
return this.tableIdLookup;
|
|
}
|
|
|
|
/* renamed from: getTablesNames$room_runtime_release, reason: from getter */
|
|
public final String[] getTablesNames() {
|
|
return this.tablesNames;
|
|
}
|
|
|
|
public final void setCleanupStatement$room_runtime_release(SupportSQLiteStatement supportSQLiteStatement) {
|
|
this.cleanupStatement = supportSQLiteStatement;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public InvalidationTracker(RoomDatabase database, Map<String, String> shadowTablesMap, Map<String, Set<String>> viewTables, String... tableNames) {
|
|
String str;
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
Intrinsics.checkNotNullParameter(shadowTablesMap, "shadowTablesMap");
|
|
Intrinsics.checkNotNullParameter(viewTables, "viewTables");
|
|
Intrinsics.checkNotNullParameter(tableNames, "tableNames");
|
|
this.database = database;
|
|
this.shadowTablesMap = shadowTablesMap;
|
|
this.viewTables = viewTables;
|
|
this.pendingRefresh = new AtomicBoolean(false);
|
|
this.observedTableTracker = new ObservedTableTracker(tableNames.length);
|
|
this.invalidationLiveDataContainer = new InvalidationLiveDataContainer(database);
|
|
this.observerMap = new SafeIterableMap<>();
|
|
this.syncTriggersLock = new Object();
|
|
this.trackerLock = new Object();
|
|
this.tableIdLookup = new LinkedHashMap();
|
|
int length = tableNames.length;
|
|
String[] strArr = new String[length];
|
|
for (int i = 0; i < length; i++) {
|
|
String str2 = tableNames[i];
|
|
Locale US = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US, "US");
|
|
String lowerCase = str2.toLowerCase(US);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
|
|
this.tableIdLookup.put(lowerCase, Integer.valueOf(i));
|
|
String str3 = this.shadowTablesMap.get(tableNames[i]);
|
|
if (str3 != null) {
|
|
Locale US2 = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US2, "US");
|
|
str = str3.toLowerCase(US2);
|
|
Intrinsics.checkNotNullExpressionValue(str, "this as java.lang.String).toLowerCase(locale)");
|
|
} else {
|
|
str = null;
|
|
}
|
|
if (str != null) {
|
|
lowerCase = str;
|
|
}
|
|
strArr[i] = lowerCase;
|
|
}
|
|
this.tablesNames = strArr;
|
|
for (Map.Entry<String, String> entry : this.shadowTablesMap.entrySet()) {
|
|
String value = entry.getValue();
|
|
Locale US3 = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US3, "US");
|
|
String lowerCase2 = value.toLowerCase(US3);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase2, "this as java.lang.String).toLowerCase(locale)");
|
|
if (this.tableIdLookup.containsKey(lowerCase2)) {
|
|
String key = entry.getKey();
|
|
Locale US4 = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US4, "US");
|
|
String lowerCase3 = key.toLowerCase(US4);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase3, "this as java.lang.String).toLowerCase(locale)");
|
|
Map<String, Integer> map = this.tableIdLookup;
|
|
map.put(lowerCase3, MapsKt.getValue(map, lowerCase2));
|
|
}
|
|
}
|
|
this.refreshRunnable = new Runnable() { // from class: androidx.room.InvalidationTracker$refreshRunnable$1
|
|
/* JADX WARN: Code restructure failed: missing block: B:30:0x0080, code lost:
|
|
|
|
if (r0 != null) goto L26;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:31:0x0082, code lost:
|
|
|
|
r0.decrementCountAndScheduleClose();
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:33:0x00c9, code lost:
|
|
|
|
if ((!r3.isEmpty()) == false) goto L56;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:34:0x00cb, code lost:
|
|
|
|
r0 = r5.this$0.getObserverMap$room_runtime_release();
|
|
r5 = r5.this$0;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:35:0x00d3, code lost:
|
|
|
|
monitor-enter(r0);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:37:0x00d4, code lost:
|
|
|
|
r5 = r5.getObserverMap$room_runtime_release().iterator();
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:39:0x00e2, code lost:
|
|
|
|
if (r5.hasNext() == false) goto L66;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:40:0x00e4, code lost:
|
|
|
|
((androidx.room.InvalidationTracker.ObserverWrapper) ((java.util.Map.Entry) r5.next()).getValue()).notifyByTableInvalidStatus$room_runtime_release(r3);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:42:0x00f4, code lost:
|
|
|
|
r5 = kotlin.Unit.INSTANCE;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:43:0x00f6, code lost:
|
|
|
|
monitor-exit(r0);
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:44:?, code lost:
|
|
|
|
return;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:48:0x00fb, code lost:
|
|
|
|
return;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:61:0x00a4, code lost:
|
|
|
|
if (r0 == null) goto L42;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:65:0x00be, code lost:
|
|
|
|
if (r0 == null) goto L42;
|
|
*/
|
|
@Override // java.lang.Runnable
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public void run() {
|
|
/*
|
|
Method dump skipped, instructions count: 267
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.room.InvalidationTracker$refreshRunnable$1.run():void");
|
|
}
|
|
|
|
private final Set<Integer> checkUpdatedTable() {
|
|
InvalidationTracker invalidationTracker = InvalidationTracker.this;
|
|
Set createSetBuilder = SetsKt.createSetBuilder();
|
|
Cursor query$default = RoomDatabase.query$default(invalidationTracker.getDatabase(), new SimpleSQLiteQuery(InvalidationTracker.SELECT_UPDATED_TABLES_SQL), null, 2, null);
|
|
try {
|
|
Cursor cursor = query$default;
|
|
while (cursor.moveToNext()) {
|
|
createSetBuilder.add(Integer.valueOf(cursor.getInt(0)));
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
CloseableKt.closeFinally(query$default, null);
|
|
Set<Integer> build = SetsKt.build(createSetBuilder);
|
|
if (!build.isEmpty()) {
|
|
if (InvalidationTracker.this.getCleanupStatement() == null) {
|
|
throw new IllegalStateException("Required value was null.".toString());
|
|
}
|
|
SupportSQLiteStatement cleanupStatement = InvalidationTracker.this.getCleanupStatement();
|
|
if (cleanupStatement == null) {
|
|
throw new IllegalArgumentException("Required value was null.".toString());
|
|
}
|
|
cleanupStatement.executeUpdateDelete();
|
|
}
|
|
return build;
|
|
} finally {
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public InvalidationTracker(RoomDatabase database, String... tableNames) {
|
|
this(database, MapsKt.emptyMap(), MapsKt.emptyMap(), (String[]) Arrays.copyOf(tableNames, tableNames.length));
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
Intrinsics.checkNotNullParameter(tableNames, "tableNames");
|
|
}
|
|
|
|
public final void setAutoCloser$room_runtime_release(AutoCloser autoCloser) {
|
|
Intrinsics.checkNotNullParameter(autoCloser, "autoCloser");
|
|
this.autoCloser = autoCloser;
|
|
autoCloser.setAutoCloseCallback(new Runnable() { // from class: androidx.room.InvalidationTracker$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
InvalidationTracker.this.onAutoCloseCallback$room_runtime_release();
|
|
}
|
|
});
|
|
}
|
|
|
|
public final void internalInit$room_runtime_release(SupportSQLiteDatabase database) {
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
synchronized (this.trackerLock) {
|
|
if (this.initialized) {
|
|
Log.e(Room.LOG_TAG, "Invalidation tracker is initialized twice :/.");
|
|
return;
|
|
}
|
|
database.execSQL("PRAGMA temp_store = MEMORY;");
|
|
database.execSQL("PRAGMA recursive_triggers='ON';");
|
|
database.execSQL(CREATE_TRACKING_TABLE_SQL);
|
|
syncTriggers$room_runtime_release(database);
|
|
this.cleanupStatement = database.compileStatement(RESET_UPDATED_TABLES_SQL);
|
|
this.initialized = true;
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
}
|
|
|
|
public final void onAutoCloseCallback$room_runtime_release() {
|
|
synchronized (this.trackerLock) {
|
|
this.initialized = false;
|
|
this.observedTableTracker.resetTriggerState();
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
}
|
|
|
|
public final void startMultiInstanceInvalidation$room_runtime_release(Context context, String name, Intent serviceIntent) {
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
Intrinsics.checkNotNullParameter(serviceIntent, "serviceIntent");
|
|
this.multiInstanceInvalidationClient = new MultiInstanceInvalidationClient(context, name, serviceIntent, this, this.database.getQueryExecutor());
|
|
}
|
|
|
|
public final void stopMultiInstanceInvalidation$room_runtime_release() {
|
|
MultiInstanceInvalidationClient multiInstanceInvalidationClient = this.multiInstanceInvalidationClient;
|
|
if (multiInstanceInvalidationClient != null) {
|
|
multiInstanceInvalidationClient.stop();
|
|
}
|
|
this.multiInstanceInvalidationClient = null;
|
|
}
|
|
|
|
private final void stopTrackingTable(SupportSQLiteDatabase db, int tableId) {
|
|
String str = this.tablesNames[tableId];
|
|
for (String str2 : TRIGGERS) {
|
|
String str3 = "DROP TRIGGER IF EXISTS " + INSTANCE.getTriggerName$room_runtime_release(str, str2);
|
|
Intrinsics.checkNotNullExpressionValue(str3, "StringBuilder().apply(builderAction).toString()");
|
|
db.execSQL(str3);
|
|
}
|
|
}
|
|
|
|
private final void startTrackingTable(SupportSQLiteDatabase db, int tableId) {
|
|
db.execSQL("INSERT OR IGNORE INTO room_table_modification_log VALUES(" + tableId + ", 0)");
|
|
String str = this.tablesNames[tableId];
|
|
for (String str2 : TRIGGERS) {
|
|
String str3 = "CREATE TEMP TRIGGER IF NOT EXISTS " + INSTANCE.getTriggerName$room_runtime_release(str, str2) + " AFTER " + str2 + " ON `" + str + "` BEGIN UPDATE room_table_modification_log SET invalidated = 1 WHERE table_id = " + tableId + " AND invalidated = 0; END";
|
|
Intrinsics.checkNotNullExpressionValue(str3, "StringBuilder().apply(builderAction).toString()");
|
|
db.execSQL(str3);
|
|
}
|
|
}
|
|
|
|
public void addObserver(Observer observer) {
|
|
ObserverWrapper putIfAbsent;
|
|
Intrinsics.checkNotNullParameter(observer, "observer");
|
|
String[] resolveViews = resolveViews(observer.getTables());
|
|
ArrayList arrayList = new ArrayList(resolveViews.length);
|
|
for (String str : resolveViews) {
|
|
Map<String, Integer> map = this.tableIdLookup;
|
|
Locale US = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US, "US");
|
|
String lowerCase = str.toLowerCase(US);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
|
|
Integer num = map.get(lowerCase);
|
|
if (num == null) {
|
|
throw new IllegalArgumentException("There is no table with name " + str);
|
|
}
|
|
arrayList.add(Integer.valueOf(num.intValue()));
|
|
}
|
|
int[] intArray = CollectionsKt.toIntArray(arrayList);
|
|
ObserverWrapper observerWrapper = new ObserverWrapper(observer, intArray, resolveViews);
|
|
synchronized (this.observerMap) {
|
|
putIfAbsent = this.observerMap.putIfAbsent(observer, observerWrapper);
|
|
}
|
|
if (putIfAbsent == null && this.observedTableTracker.onAdded(Arrays.copyOf(intArray, intArray.length))) {
|
|
syncTriggers$room_runtime_release();
|
|
}
|
|
}
|
|
|
|
private final String[] validateAndResolveTableNames(String[] tableNames) {
|
|
String[] resolveViews = resolveViews(tableNames);
|
|
for (String str : resolveViews) {
|
|
Map<String, Integer> map = this.tableIdLookup;
|
|
Locale US = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US, "US");
|
|
String lowerCase = str.toLowerCase(US);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
|
|
if (!map.containsKey(lowerCase)) {
|
|
throw new IllegalArgumentException(("There is no table with name " + str).toString());
|
|
}
|
|
}
|
|
return resolveViews;
|
|
}
|
|
|
|
private final String[] resolveViews(String[] names) {
|
|
Set createSetBuilder = SetsKt.createSetBuilder();
|
|
for (String str : names) {
|
|
Map<String, Set<String>> map = this.viewTables;
|
|
Locale US = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US, "US");
|
|
String lowerCase = str.toLowerCase(US);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
|
|
if (map.containsKey(lowerCase)) {
|
|
Map<String, Set<String>> map2 = this.viewTables;
|
|
Locale US2 = Locale.US;
|
|
Intrinsics.checkNotNullExpressionValue(US2, "US");
|
|
String lowerCase2 = str.toLowerCase(US2);
|
|
Intrinsics.checkNotNullExpressionValue(lowerCase2, "this as java.lang.String).toLowerCase(locale)");
|
|
Set<String> set = map2.get(lowerCase2);
|
|
Intrinsics.checkNotNull(set);
|
|
createSetBuilder.addAll(set);
|
|
} else {
|
|
createSetBuilder.add(str);
|
|
}
|
|
}
|
|
Object[] array = SetsKt.build(createSetBuilder).toArray(new String[0]);
|
|
Intrinsics.checkNotNull(array, "null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
|
|
return (String[]) array;
|
|
}
|
|
|
|
public void addWeakObserver(Observer observer) {
|
|
Intrinsics.checkNotNullParameter(observer, "observer");
|
|
addObserver(new WeakObserver(this, observer));
|
|
}
|
|
|
|
public void removeObserver(Observer observer) {
|
|
ObserverWrapper remove;
|
|
Intrinsics.checkNotNullParameter(observer, "observer");
|
|
synchronized (this.observerMap) {
|
|
remove = this.observerMap.remove(observer);
|
|
}
|
|
if (remove != null) {
|
|
ObservedTableTracker observedTableTracker = this.observedTableTracker;
|
|
int[] tableIds = remove.getTableIds();
|
|
if (observedTableTracker.onRemoved(Arrays.copyOf(tableIds, tableIds.length))) {
|
|
syncTriggers$room_runtime_release();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final boolean ensureInitialization$room_runtime_release() {
|
|
if (!this.database.isOpen()) {
|
|
return false;
|
|
}
|
|
if (!this.initialized) {
|
|
this.database.getOpenHelper().getWritableDatabase();
|
|
}
|
|
if (this.initialized) {
|
|
return true;
|
|
}
|
|
Log.e(Room.LOG_TAG, "database is not initialized even though it is open");
|
|
return false;
|
|
}
|
|
|
|
public void refreshVersionsAsync() {
|
|
if (this.pendingRefresh.compareAndSet(false, true)) {
|
|
AutoCloser autoCloser = this.autoCloser;
|
|
if (autoCloser != null) {
|
|
autoCloser.incrementCountAndEnsureDbIsOpen();
|
|
}
|
|
this.database.getQueryExecutor().execute(this.refreshRunnable);
|
|
}
|
|
}
|
|
|
|
public void refreshVersionsSync() {
|
|
AutoCloser autoCloser = this.autoCloser;
|
|
if (autoCloser != null) {
|
|
autoCloser.incrementCountAndEnsureDbIsOpen();
|
|
}
|
|
syncTriggers$room_runtime_release();
|
|
this.refreshRunnable.run();
|
|
}
|
|
|
|
public final void notifyObserversByTableNames(String... tables) {
|
|
Intrinsics.checkNotNullParameter(tables, "tables");
|
|
synchronized (this.observerMap) {
|
|
Iterator<Map.Entry<K, V>> it = this.observerMap.iterator();
|
|
while (it.hasNext()) {
|
|
Map.Entry entry = (Map.Entry) it.next();
|
|
Intrinsics.checkNotNullExpressionValue(entry, "(observer, wrapper)");
|
|
Observer observer = (Observer) entry.getKey();
|
|
ObserverWrapper observerWrapper = (ObserverWrapper) entry.getValue();
|
|
if (!observer.isRemote$room_runtime_release()) {
|
|
observerWrapper.notifyByTableNames$room_runtime_release(tables);
|
|
}
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
}
|
|
|
|
public final void syncTriggers$room_runtime_release(SupportSQLiteDatabase database) {
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
if (database.inTransaction()) {
|
|
return;
|
|
}
|
|
try {
|
|
Lock closeLock$room_runtime_release = this.database.getCloseLock$room_runtime_release();
|
|
closeLock$room_runtime_release.lock();
|
|
try {
|
|
synchronized (this.syncTriggersLock) {
|
|
int[] tablesToSync = this.observedTableTracker.getTablesToSync();
|
|
if (tablesToSync == null) {
|
|
return;
|
|
}
|
|
INSTANCE.beginTransactionInternal$room_runtime_release(database);
|
|
try {
|
|
int length = tablesToSync.length;
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (i < length) {
|
|
int i3 = tablesToSync[i];
|
|
int i4 = i2 + 1;
|
|
if (i3 == 1) {
|
|
startTrackingTable(database, i2);
|
|
} else if (i3 == 2) {
|
|
stopTrackingTable(database, i2);
|
|
}
|
|
i++;
|
|
i2 = i4;
|
|
}
|
|
database.setTransactionSuccessful();
|
|
database.endTransaction();
|
|
Unit unit = Unit.INSTANCE;
|
|
} catch (Throwable th) {
|
|
database.endTransaction();
|
|
throw th;
|
|
}
|
|
}
|
|
} finally {
|
|
closeLock$room_runtime_release.unlock();
|
|
}
|
|
} catch (SQLiteException e) {
|
|
Log.e(Room.LOG_TAG, "Cannot run invalidation tracker. Is the db closed?", e);
|
|
} catch (IllegalStateException e2) {
|
|
Log.e(Room.LOG_TAG, "Cannot run invalidation tracker. Is the db closed?", e2);
|
|
}
|
|
}
|
|
|
|
public final void syncTriggers$room_runtime_release() {
|
|
if (this.database.isOpen()) {
|
|
syncTriggers$room_runtime_release(this.database.getOpenHelper().getWritableDatabase());
|
|
}
|
|
}
|
|
|
|
@Deprecated(message = "Use [createLiveData(String[], boolean, Callable)]")
|
|
public <T> LiveData<T> createLiveData(String[] tableNames, Callable<T> computeFunction) {
|
|
Intrinsics.checkNotNullParameter(tableNames, "tableNames");
|
|
Intrinsics.checkNotNullParameter(computeFunction, "computeFunction");
|
|
return createLiveData(tableNames, false, computeFunction);
|
|
}
|
|
|
|
public <T> LiveData<T> createLiveData(String[] tableNames, boolean inTransaction, Callable<T> computeFunction) {
|
|
Intrinsics.checkNotNullParameter(tableNames, "tableNames");
|
|
Intrinsics.checkNotNullParameter(computeFunction, "computeFunction");
|
|
return this.invalidationLiveDataContainer.create(validateAndResolveTableNames(tableNames), inTransaction, computeFunction);
|
|
}
|
|
|
|
/* compiled from: InvalidationTracker.kt */
|
|
@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0015\n\u0000\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\"\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006\b\u0000\u0018\u00002\u00020\u0001B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u000e\u0010\u0006\u001a\n\u0012\u0006\b\u0001\u0012\u00020\b0\u0007¢\u0006\u0002\u0010\tJ\u001d\u0010\u0011\u001a\u00020\u00122\u000e\u0010\u0013\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00140\rH\u0000¢\u0006\u0002\b\u0015J\u001f\u0010\u0016\u001a\u00020\u00122\u000e\u0010\u0017\u001a\n\u0012\u0006\b\u0001\u0012\u00020\b0\u0007H\u0000¢\u0006\u0004\b\u0018\u0010\u0019R\u0014\u0010\u0002\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u0014\u0010\f\u001a\b\u0012\u0004\u0012\u00020\b0\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\u00020\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000fR\u0018\u0010\u0006\u001a\n\u0012\u0006\b\u0001\u0012\u00020\b0\u0007X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0010¨\u0006\u001a"}, d2 = {"Landroidx/room/InvalidationTracker$ObserverWrapper;", "", "observer", "Landroidx/room/InvalidationTracker$Observer;", "tableIds", "", "tableNames", "", "", "(Landroidx/room/InvalidationTracker$Observer;[I[Ljava/lang/String;)V", "getObserver$room_runtime_release", "()Landroidx/room/InvalidationTracker$Observer;", "singleTableSet", "", "getTableIds$room_runtime_release", "()[I", "[Ljava/lang/String;", "notifyByTableInvalidStatus", "", "invalidatedTablesIds", "", "notifyByTableInvalidStatus$room_runtime_release", "notifyByTableNames", "tables", "notifyByTableNames$room_runtime_release", "([Ljava/lang/String;)V", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class ObserverWrapper {
|
|
private final Observer observer;
|
|
private final Set<String> singleTableSet;
|
|
private final int[] tableIds;
|
|
private final String[] tableNames;
|
|
|
|
/* renamed from: getObserver$room_runtime_release, reason: from getter */
|
|
public final Observer getObserver() {
|
|
return this.observer;
|
|
}
|
|
|
|
/* renamed from: getTableIds$room_runtime_release, reason: from getter */
|
|
public final int[] getTableIds() {
|
|
return this.tableIds;
|
|
}
|
|
|
|
public ObserverWrapper(Observer observer, int[] tableIds, String[] tableNames) {
|
|
Set<String> emptySet;
|
|
Intrinsics.checkNotNullParameter(observer, "observer");
|
|
Intrinsics.checkNotNullParameter(tableIds, "tableIds");
|
|
Intrinsics.checkNotNullParameter(tableNames, "tableNames");
|
|
this.observer = observer;
|
|
this.tableIds = tableIds;
|
|
this.tableNames = tableNames;
|
|
if (!(tableNames.length == 0)) {
|
|
emptySet = SetsKt.setOf(tableNames[0]);
|
|
} else {
|
|
emptySet = SetsKt.emptySet();
|
|
}
|
|
this.singleTableSet = emptySet;
|
|
if (tableIds.length != tableNames.length) {
|
|
throw new IllegalStateException("Check failed.".toString());
|
|
}
|
|
}
|
|
|
|
public final void notifyByTableInvalidStatus$room_runtime_release(Set<Integer> invalidatedTablesIds) {
|
|
Set<String> emptySet;
|
|
Intrinsics.checkNotNullParameter(invalidatedTablesIds, "invalidatedTablesIds");
|
|
int[] iArr = this.tableIds;
|
|
int length = iArr.length;
|
|
if (length != 0) {
|
|
int i = 0;
|
|
if (length == 1) {
|
|
emptySet = invalidatedTablesIds.contains(Integer.valueOf(iArr[0])) ? this.singleTableSet : SetsKt.emptySet();
|
|
} else {
|
|
Set createSetBuilder = SetsKt.createSetBuilder();
|
|
int[] iArr2 = this.tableIds;
|
|
int length2 = iArr2.length;
|
|
int i2 = 0;
|
|
while (i < length2) {
|
|
int i3 = i2 + 1;
|
|
if (invalidatedTablesIds.contains(Integer.valueOf(iArr2[i]))) {
|
|
createSetBuilder.add(this.tableNames[i2]);
|
|
}
|
|
i++;
|
|
i2 = i3;
|
|
}
|
|
emptySet = SetsKt.build(createSetBuilder);
|
|
}
|
|
} else {
|
|
emptySet = SetsKt.emptySet();
|
|
}
|
|
if (!emptySet.isEmpty()) {
|
|
this.observer.onInvalidated(emptySet);
|
|
}
|
|
}
|
|
|
|
public final void notifyByTableNames$room_runtime_release(String[] tables) {
|
|
Set<String> emptySet;
|
|
Intrinsics.checkNotNullParameter(tables, "tables");
|
|
int length = this.tableNames.length;
|
|
if (length != 0) {
|
|
if (length != 1) {
|
|
Set createSetBuilder = SetsKt.createSetBuilder();
|
|
for (String str : tables) {
|
|
for (String str2 : this.tableNames) {
|
|
if (StringsKt.equals(str2, str, true)) {
|
|
createSetBuilder.add(str2);
|
|
}
|
|
}
|
|
}
|
|
emptySet = SetsKt.build(createSetBuilder);
|
|
} else {
|
|
int length2 = tables.length;
|
|
int i = 0;
|
|
while (true) {
|
|
if (i < length2) {
|
|
if (StringsKt.equals(tables[i], this.tableNames[0], true)) {
|
|
emptySet = this.singleTableSet;
|
|
break;
|
|
}
|
|
i++;
|
|
} else {
|
|
emptySet = SetsKt.emptySet();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
emptySet = SetsKt.emptySet();
|
|
}
|
|
if (!emptySet.isEmpty()) {
|
|
this.observer.onInvalidated(emptySet);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: InvalidationTracker.kt */
|
|
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\u0010\"\n\u0000\b&\u0018\u00002\u00020\u0001B#\b\u0014\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0012\u0010\u0004\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00030\u0005\"\u00020\u0003¢\u0006\u0002\u0010\u0006B\u0015\u0012\u000e\u0010\u0007\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00030\u0005¢\u0006\u0002\u0010\bJ\u0016\u0010\u0010\u001a\u00020\u00112\f\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\u00030\u0012H&R\u0014\u0010\t\u001a\u00020\n8PX\u0090\u0004¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u001e\u0010\u0007\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00030\u0005X\u0080\u0004¢\u0006\n\n\u0002\u0010\u000f\u001a\u0004\b\r\u0010\u000e¨\u0006\u0013"}, d2 = {"Landroidx/room/InvalidationTracker$Observer;", "", "firstTable", "", "rest", "", "(Ljava/lang/String;[Ljava/lang/String;)V", "tables", "([Ljava/lang/String;)V", "isRemote", "", "isRemote$room_runtime_release", "()Z", "getTables$room_runtime_release", "()[Ljava/lang/String;", "[Ljava/lang/String;", "onInvalidated", "", "", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static abstract class Observer {
|
|
private final String[] tables;
|
|
|
|
/* renamed from: getTables$room_runtime_release, reason: from getter */
|
|
public final String[] getTables() {
|
|
return this.tables;
|
|
}
|
|
|
|
public boolean isRemote$room_runtime_release() {
|
|
return false;
|
|
}
|
|
|
|
public abstract void onInvalidated(Set<String> tables);
|
|
|
|
public Observer(String[] tables) {
|
|
Intrinsics.checkNotNullParameter(tables, "tables");
|
|
this.tables = tables;
|
|
}
|
|
|
|
/* JADX WARN: Illegal instructions before constructor call */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
protected Observer(java.lang.String r3, java.lang.String... r4) {
|
|
/*
|
|
r2 = this;
|
|
java.lang.String r0 = "firstTable"
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r3, r0)
|
|
java.lang.String r0 = "rest"
|
|
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r4, r0)
|
|
java.util.List r0 = kotlin.collections.CollectionsKt.createListBuilder()
|
|
r1 = r0
|
|
java.util.Collection r1 = (java.util.Collection) r1
|
|
kotlin.collections.CollectionsKt.addAll(r1, r4)
|
|
r0.add(r3)
|
|
java.util.List r3 = kotlin.collections.CollectionsKt.build(r0)
|
|
java.util.Collection r3 = (java.util.Collection) r3
|
|
r4 = 0
|
|
java.lang.String[] r4 = new java.lang.String[r4]
|
|
java.lang.Object[] r3 = r3.toArray(r4)
|
|
java.lang.String r4 = "null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>"
|
|
kotlin.jvm.internal.Intrinsics.checkNotNull(r3, r4)
|
|
java.lang.String[] r3 = (java.lang.String[]) r3
|
|
r2.<init>(r3)
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.room.InvalidationTracker.Observer.<init>(java.lang.String, java.lang.String[]):void");
|
|
}
|
|
}
|
|
|
|
/* compiled from: InvalidationTracker.kt */
|
|
@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\u0016\n\u0002\b\u0003\n\u0002\u0010\u0015\n\u0000\n\u0002\u0010\u0018\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0002\b\u0000\u0018\u0000 \u00192\u00020\u0001:\u0001\u0019B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\n\u0010\u0013\u001a\u0004\u0018\u00010\u0010H\u0007J\u0012\u0010\u0014\u001a\u00020\u00062\n\u0010\u0015\u001a\u00020\u0010\"\u00020\u0003J\u0012\u0010\u0016\u001a\u00020\u00062\n\u0010\u0015\u001a\u00020\u0010\"\u00020\u0003J\u0006\u0010\u0017\u001a\u00020\u0018R\u001a\u0010\u0005\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\nR\u0011\u0010\u000b\u001a\u00020\f¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u000e\u0010\u000f\u001a\u00020\u0010X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001a"}, d2 = {"Landroidx/room/InvalidationTracker$ObservedTableTracker;", "", "tableCount", "", "(I)V", "needsSync", "", "getNeedsSync", "()Z", "setNeedsSync", "(Z)V", "tableObservers", "", "getTableObservers", "()[J", "triggerStateChanges", "", "triggerStates", "", "getTablesToSync", "onAdded", "tableIds", "onRemoved", "resetTriggerState", "", "Companion", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class ObservedTableTracker {
|
|
public static final int ADD = 1;
|
|
public static final int NO_OP = 0;
|
|
public static final int REMOVE = 2;
|
|
private boolean needsSync;
|
|
private final long[] tableObservers;
|
|
private final int[] triggerStateChanges;
|
|
private final boolean[] triggerStates;
|
|
|
|
public final boolean getNeedsSync() {
|
|
return this.needsSync;
|
|
}
|
|
|
|
public final long[] getTableObservers() {
|
|
return this.tableObservers;
|
|
}
|
|
|
|
public final void setNeedsSync(boolean z) {
|
|
this.needsSync = z;
|
|
}
|
|
|
|
public ObservedTableTracker(int i) {
|
|
this.tableObservers = new long[i];
|
|
this.triggerStates = new boolean[i];
|
|
this.triggerStateChanges = new int[i];
|
|
}
|
|
|
|
public final boolean onAdded(int... tableIds) {
|
|
boolean z;
|
|
Intrinsics.checkNotNullParameter(tableIds, "tableIds");
|
|
synchronized (this) {
|
|
z = false;
|
|
for (int i : tableIds) {
|
|
long[] jArr = this.tableObservers;
|
|
long j = jArr[i];
|
|
jArr[i] = 1 + j;
|
|
if (j == 0) {
|
|
z = true;
|
|
this.needsSync = true;
|
|
}
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public final boolean onRemoved(int... tableIds) {
|
|
boolean z;
|
|
Intrinsics.checkNotNullParameter(tableIds, "tableIds");
|
|
synchronized (this) {
|
|
z = false;
|
|
for (int i : tableIds) {
|
|
long[] jArr = this.tableObservers;
|
|
long j = jArr[i];
|
|
jArr[i] = j - 1;
|
|
if (j == 1) {
|
|
z = true;
|
|
this.needsSync = true;
|
|
}
|
|
}
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public final void resetTriggerState() {
|
|
synchronized (this) {
|
|
Arrays.fill(this.triggerStates, false);
|
|
this.needsSync = true;
|
|
Unit unit = Unit.INSTANCE;
|
|
}
|
|
}
|
|
|
|
public final int[] getTablesToSync() {
|
|
synchronized (this) {
|
|
if (!this.needsSync) {
|
|
return null;
|
|
}
|
|
long[] jArr = this.tableObservers;
|
|
int length = jArr.length;
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (i < length) {
|
|
int i3 = i2 + 1;
|
|
int i4 = 1;
|
|
boolean z = jArr[i] > 0;
|
|
boolean[] zArr = this.triggerStates;
|
|
if (z != zArr[i2]) {
|
|
int[] iArr = this.triggerStateChanges;
|
|
if (!z) {
|
|
i4 = 2;
|
|
}
|
|
iArr[i2] = i4;
|
|
} else {
|
|
this.triggerStateChanges[i2] = 0;
|
|
}
|
|
zArr[i2] = z;
|
|
i++;
|
|
i2 = i3;
|
|
}
|
|
this.needsSync = false;
|
|
return (int[]) this.triggerStateChanges.clone();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: InvalidationTracker.kt */
|
|
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\"\n\u0002\u0010\u000e\n\u0000\b\u0000\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0001¢\u0006\u0002\u0010\u0005J\u0016\u0010\f\u001a\u00020\r2\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\u00100\u000fH\u0016R\u0017\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\u00010\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\tR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000b¨\u0006\u0011"}, d2 = {"Landroidx/room/InvalidationTracker$WeakObserver;", "Landroidx/room/InvalidationTracker$Observer;", "tracker", "Landroidx/room/InvalidationTracker;", "delegate", "(Landroidx/room/InvalidationTracker;Landroidx/room/InvalidationTracker$Observer;)V", "delegateRef", "Ljava/lang/ref/WeakReference;", "getDelegateRef", "()Ljava/lang/ref/WeakReference;", "getTracker", "()Landroidx/room/InvalidationTracker;", "onInvalidated", "", "tables", "", "", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class WeakObserver extends Observer {
|
|
private final WeakReference<Observer> delegateRef;
|
|
private final InvalidationTracker tracker;
|
|
|
|
public final WeakReference<Observer> getDelegateRef() {
|
|
return this.delegateRef;
|
|
}
|
|
|
|
public final InvalidationTracker getTracker() {
|
|
return this.tracker;
|
|
}
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public WeakObserver(InvalidationTracker tracker, Observer delegate) {
|
|
super(delegate.getTables());
|
|
Intrinsics.checkNotNullParameter(tracker, "tracker");
|
|
Intrinsics.checkNotNullParameter(delegate, "delegate");
|
|
this.tracker = tracker;
|
|
this.delegateRef = new WeakReference<>(delegate);
|
|
}
|
|
|
|
@Override // androidx.room.InvalidationTracker.Observer
|
|
public void onInvalidated(Set<String> tables) {
|
|
Intrinsics.checkNotNullParameter(tables, "tables");
|
|
Observer observer = this.delegateRef.get();
|
|
if (observer == null) {
|
|
this.tracker.removeObserver(this);
|
|
} else {
|
|
observer.onInvalidated(tables);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: InvalidationTracker.kt */
|
|
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0007\n\u0002\u0010\u0011\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0015\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0000¢\u0006\u0002\b\u0013J\u001d\u0010\u0014\u001a\u00020\u00042\u0006\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u0016\u001a\u00020\u0004H\u0000¢\u0006\u0002\b\u0017R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u0016\u0010\u0006\u001a\u00020\u00048\u0000X\u0081T¢\u0006\b\n\u0000\u0012\u0004\b\u0007\u0010\u0002R\u0016\u0010\b\u001a\u00020\u00048\u0000X\u0081T¢\u0006\b\n\u0000\u0012\u0004\b\t\u0010\u0002R\u000e\u0010\n\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u0016\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\u00040\fX\u0082\u0004¢\u0006\u0004\n\u0002\u0010\rR\u000e\u0010\u000e\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Landroidx/room/InvalidationTracker$Companion;", "", "()V", "CREATE_TRACKING_TABLE_SQL", "", "INVALIDATED_COLUMN_NAME", "RESET_UPDATED_TABLES_SQL", "getRESET_UPDATED_TABLES_SQL$room_runtime_release$annotations", "SELECT_UPDATED_TABLES_SQL", "getSELECT_UPDATED_TABLES_SQL$room_runtime_release$annotations", "TABLE_ID_COLUMN_NAME", "TRIGGERS", "", "[Ljava/lang/String;", "UPDATE_TABLE_NAME", "beginTransactionInternal", "", "database", "Landroidx/sqlite/db/SupportSQLiteDatabase;", "beginTransactionInternal$room_runtime_release", "getTriggerName", "tableName", "triggerType", "getTriggerName$room_runtime_release", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public static /* synthetic */ void getRESET_UPDATED_TABLES_SQL$room_runtime_release$annotations() {
|
|
}
|
|
|
|
public static /* synthetic */ void getSELECT_UPDATED_TABLES_SQL$room_runtime_release$annotations() {
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public final String getTriggerName$room_runtime_release(String tableName, String triggerType) {
|
|
Intrinsics.checkNotNullParameter(tableName, "tableName");
|
|
Intrinsics.checkNotNullParameter(triggerType, "triggerType");
|
|
return "`room_table_modification_trigger_" + tableName + '_' + triggerType + '`';
|
|
}
|
|
|
|
public final void beginTransactionInternal$room_runtime_release(SupportSQLiteDatabase database) {
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
if (database.isWriteAheadLoggingEnabled()) {
|
|
database.beginTransactionNonExclusive();
|
|
} else {
|
|
database.beginTransaction();
|
|
}
|
|
}
|
|
}
|
|
}
|