Rabbit-R1/android (non root)/java/sources/androidx/room/RoomSQLiteQuery.java

317 lines
16 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package androidx.room;
import androidx.sqlite.db.SupportSQLiteProgram;
import androidx.sqlite.db.SupportSQLiteQuery;
import io.sentry.Session;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.annotation.AnnotationRetention;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: RoomSQLiteQuery.kt */
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0010\u0015\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0002\u0010\u0012\n\u0002\b\u0004\n\u0002\u0010\u0013\n\u0002\b\u0002\n\u0002\u0010\u0016\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\t\n\u0002\b\u000e\b\u0007\u0018\u0000 62\u00020\u00012\u00020\u0002:\u000256B\u000f\b\u0002\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u0018\u0010\"\u001a\u00020#2\u0006\u0010$\u001a\u00020\u00042\u0006\u0010%\u001a\u00020\u0010H\u0016J\u0018\u0010&\u001a\u00020#2\u0006\u0010$\u001a\u00020\u00042\u0006\u0010%\u001a\u00020'H\u0016J\u0018\u0010(\u001a\u00020#2\u0006\u0010$\u001a\u00020\u00042\u0006\u0010%\u001a\u00020)H\u0016J\u0010\u0010*\u001a\u00020#2\u0006\u0010$\u001a\u00020\u0004H\u0016J\u0018\u0010+\u001a\u00020#2\u0006\u0010$\u001a\u00020\u00042\u0006\u0010%\u001a\u00020\u001bH\u0016J\u0010\u0010,\u001a\u00020#2\u0006\u0010-\u001a\u00020\u0002H\u0016J\b\u0010.\u001a\u00020#H\u0016J\b\u0010/\u001a\u00020#H\u0016J\u000e\u00100\u001a\u00020#2\u0006\u00101\u001a\u00020\u0000J\u0016\u00102\u001a\u00020#2\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u00103\u001a\u00020\u0004J\u0006\u00104\u001a\u00020#R\u001e\u0010\u0007\u001a\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u0004@RX\u0096\u000e¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\tR\u0014\u0010\n\u001a\u00020\u000bX\u0082\u0004¢\u0006\b\n\u0000\u0012\u0004\b\f\u0010\rR \u0010\u000e\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00100\u000f8\u0006X\u0087\u0004¢\u0006\n\n\u0002\u0010\u0012\u0012\u0004\b\u0011\u0010\rR\u0016\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\tR\u0016\u0010\u0014\u001a\u00020\u00158\u0006X\u0087\u0004¢\u0006\b\n\u0000\u0012\u0004\b\u0016\u0010\rR\u0016\u0010\u0017\u001a\u00020\u00188\u0006X\u0087\u0004¢\u0006\b\n\u0000\u0012\u0004\b\u0019\u0010\rR\u0010\u0010\u001a\u001a\u0004\u0018\u00010\u001bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u001c\u001a\u00020\u001b8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u001d\u0010\u001eR \u0010\u001f\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u001b0\u000f8\u0006X\u0087\u0004¢\u0006\n\n\u0002\u0010!\u0012\u0004\b \u0010\\u00067"}, d2 = {"Landroidx/room/RoomSQLiteQuery;", "Landroidx/sqlite/db/SupportSQLiteQuery;", "Landroidx/sqlite/db/SupportSQLiteProgram;", "capacity", "", "(I)V", "<set-?>", "argCount", "getArgCount", "()I", "bindingTypes", "", "getBindingTypes$annotations", "()V", "blobBindings", "", "", "getBlobBindings$annotations", "[[B", "getCapacity", "doubleBindings", "", "getDoubleBindings$annotations", "longBindings", "", "getLongBindings$annotations", "query", "", "sql", "getSql", "()Ljava/lang/String;", "stringBindings", "getStringBindings$annotations", "[Ljava/lang/String;", "bindBlob", "", "index", "value", "bindDouble", "", "bindLong", "", "bindNull", "bindString", "bindTo", "statement", "clearBindings", "close", "copyArgumentsFrom", "other", Session.JsonKeys.INIT, "initArgCount", "release", "Binding", "Companion", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
/* loaded from: classes2.dex */
public final class RoomSQLiteQuery implements SupportSQLiteQuery, SupportSQLiteProgram {
private static final int BLOB = 5;
public static final int DESIRED_POOL_SIZE = 10;
private static final int DOUBLE = 3;
private static final int LONG = 2;
private static final int NULL = 1;
public static final int POOL_LIMIT = 15;
private static final int STRING = 4;
private int argCount;
private final int[] bindingTypes;
public final byte[][] blobBindings;
private final int capacity;
public final double[] doubleBindings;
public final long[] longBindings;
private volatile String query;
public final String[] stringBindings;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final TreeMap<Integer, RoomSQLiteQuery> queryPool = new TreeMap<>();
/* compiled from: RoomSQLiteQuery.kt */
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0000\b\u0081\u0002\u0018\u00002\u00020\u0001B\u0000¨\u0006\u0002"}, d2 = {"Landroidx/room/RoomSQLiteQuery$Binding;", "", "room-runtime_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
@Retention(RetentionPolicy.SOURCE)
@kotlin.annotation.Retention(AnnotationRetention.SOURCE)
/* loaded from: classes2.dex */
public @interface Binding {
}
public /* synthetic */ RoomSQLiteQuery(int i, DefaultConstructorMarker defaultConstructorMarker) {
this(i);
}
@JvmStatic
public static final RoomSQLiteQuery acquire(String str, int i) {
return INSTANCE.acquire(str, i);
}
@JvmStatic
public static final RoomSQLiteQuery copyFrom(SupportSQLiteQuery supportSQLiteQuery) {
return INSTANCE.copyFrom(supportSQLiteQuery);
}
private static /* synthetic */ void getBindingTypes$annotations() {
}
public static /* synthetic */ void getBlobBindings$annotations() {
}
public static /* synthetic */ void getDoubleBindings$annotations() {
}
public static /* synthetic */ void getLongBindings$annotations() {
}
public static /* synthetic */ void getStringBindings$annotations() {
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
}
@Override // androidx.sqlite.db.SupportSQLiteQuery
public int getArgCount() {
return this.argCount;
}
public final int getCapacity() {
return this.capacity;
}
public final void init(String query, int initArgCount) {
Intrinsics.checkNotNullParameter(query, "query");
this.query = query;
this.argCount = initArgCount;
}
private RoomSQLiteQuery(int i) {
this.capacity = i;
int i2 = i + 1;
this.bindingTypes = new int[i2];
this.longBindings = new long[i2];
this.doubleBindings = new double[i2];
this.stringBindings = new String[i2];
this.blobBindings = new byte[i2];
}
public final void release() {
TreeMap<Integer, RoomSQLiteQuery> treeMap = queryPool;
synchronized (treeMap) {
treeMap.put(Integer.valueOf(this.capacity), this);
INSTANCE.prunePoolLocked$room_runtime_release();
Unit unit = Unit.INSTANCE;
}
}
@Override // androidx.sqlite.db.SupportSQLiteQuery
/* renamed from: getSql */
public String getQuery() {
String str = this.query;
if (str != null) {
return str;
}
throw new IllegalStateException("Required value was null.".toString());
}
@Override // androidx.sqlite.db.SupportSQLiteQuery
public void bindTo(SupportSQLiteProgram statement) {
Intrinsics.checkNotNullParameter(statement, "statement");
int argCount = getArgCount();
if (1 > argCount) {
return;
}
int i = 1;
while (true) {
int i2 = this.bindingTypes[i];
if (i2 == 1) {
statement.bindNull(i);
} else if (i2 == 2) {
statement.bindLong(i, this.longBindings[i]);
} else if (i2 == 3) {
statement.bindDouble(i, this.doubleBindings[i]);
} else if (i2 == 4) {
String str = this.stringBindings[i];
if (str == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
statement.bindString(i, str);
} else if (i2 == 5) {
byte[] bArr = this.blobBindings[i];
if (bArr == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
statement.bindBlob(i, bArr);
}
if (i == argCount) {
return;
} else {
i++;
}
}
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindNull(int index) {
this.bindingTypes[index] = 1;
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindLong(int index, long value) {
this.bindingTypes[index] = 2;
this.longBindings[index] = value;
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindDouble(int index, double value) {
this.bindingTypes[index] = 3;
this.doubleBindings[index] = value;
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindString(int index, String value) {
Intrinsics.checkNotNullParameter(value, "value");
this.bindingTypes[index] = 4;
this.stringBindings[index] = value;
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindBlob(int index, byte[] value) {
Intrinsics.checkNotNullParameter(value, "value");
this.bindingTypes[index] = 5;
this.blobBindings[index] = value;
}
public final void copyArgumentsFrom(RoomSQLiteQuery other) {
Intrinsics.checkNotNullParameter(other, "other");
int argCount = other.getArgCount() + 1;
System.arraycopy(other.bindingTypes, 0, this.bindingTypes, 0, argCount);
System.arraycopy(other.longBindings, 0, this.longBindings, 0, argCount);
System.arraycopy(other.stringBindings, 0, this.stringBindings, 0, argCount);
System.arraycopy(other.blobBindings, 0, this.blobBindings, 0, argCount);
System.arraycopy(other.doubleBindings, 0, this.doubleBindings, 0, argCount);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void clearBindings() {
Arrays.fill(this.bindingTypes, 1);
Arrays.fill(this.stringBindings, (Object) null);
Arrays.fill(this.blobBindings, (Object) null);
this.query = null;
}
/* compiled from: RoomSQLiteQuery.kt */
@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0018\u0010\u0011\u001a\u00020\u000f2\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0004H\u0007J\u0010\u0010\u0015\u001a\u00020\u000f2\u0006\u0010\u0016\u001a\u00020\u0017H\u0007J\r\u0010\u0018\u001a\u00020\u0019H\u0000¢\u0006\u0002\b\u001aR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u0016\u0010\u0005\u001a\u00020\u00048\u0006X\u0087T¢\u0006\b\n\u0000\u0012\u0004\b\u0006\u0010\u0002R\u000e\u0010\u0007\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u0016\u0010\n\u001a\u00020\u00048\u0006X\u0087T¢\u0006\b\n\u0000\u0012\u0004\b\u000b\u0010\u0002R\u000e\u0010\f\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\"\u0010\r\u001a\u000e\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00020\u000f0\u000e8\u0006X\u0087\u0004¢\u0006\b\n\u0000\u0012\u0004\b\u0010\u0010\u0002¨\u0006\u001b"}, d2 = {"Landroidx/room/RoomSQLiteQuery$Companion;", "", "()V", "BLOB", "", "DESIRED_POOL_SIZE", "getDESIRED_POOL_SIZE$annotations", "DOUBLE", "LONG", "NULL", "POOL_LIMIT", "getPOOL_LIMIT$annotations", "STRING", "queryPool", "Ljava/util/TreeMap;", "Landroidx/room/RoomSQLiteQuery;", "getQueryPool$annotations", "acquire", "query", "", "argumentCount", "copyFrom", "supportSQLiteQuery", "Landroidx/sqlite/db/SupportSQLiteQuery;", "prunePoolLocked", "", "prunePoolLocked$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 getDESIRED_POOL_SIZE$annotations() {
}
public static /* synthetic */ void getPOOL_LIMIT$annotations() {
}
public static /* synthetic */ void getQueryPool$annotations() {
}
private Companion() {
}
@JvmStatic
public final RoomSQLiteQuery copyFrom(SupportSQLiteQuery supportSQLiteQuery) {
Intrinsics.checkNotNullParameter(supportSQLiteQuery, "supportSQLiteQuery");
final RoomSQLiteQuery acquire = acquire(supportSQLiteQuery.getQuery(), supportSQLiteQuery.getArgCount());
supportSQLiteQuery.bindTo(new SupportSQLiteProgram() { // from class: androidx.room.RoomSQLiteQuery$Companion$copyFrom$1
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindBlob(int index, byte[] value) {
Intrinsics.checkNotNullParameter(value, "value");
RoomSQLiteQuery.this.bindBlob(index, value);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindDouble(int index, double value) {
RoomSQLiteQuery.this.bindDouble(index, value);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindLong(int index, long value) {
RoomSQLiteQuery.this.bindLong(index, value);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindNull(int index) {
RoomSQLiteQuery.this.bindNull(index);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindString(int index, String value) {
Intrinsics.checkNotNullParameter(value, "value");
RoomSQLiteQuery.this.bindString(index, value);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void clearBindings() {
RoomSQLiteQuery.this.clearBindings();
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
RoomSQLiteQuery.this.close();
}
});
return acquire;
}
@JvmStatic
public final RoomSQLiteQuery acquire(String query, int argumentCount) {
Intrinsics.checkNotNullParameter(query, "query");
synchronized (RoomSQLiteQuery.queryPool) {
Map.Entry<Integer, RoomSQLiteQuery> ceilingEntry = RoomSQLiteQuery.queryPool.ceilingEntry(Integer.valueOf(argumentCount));
if (ceilingEntry != null) {
RoomSQLiteQuery.queryPool.remove(ceilingEntry.getKey());
RoomSQLiteQuery sqliteQuery = ceilingEntry.getValue();
sqliteQuery.init(query, argumentCount);
Intrinsics.checkNotNullExpressionValue(sqliteQuery, "sqliteQuery");
return sqliteQuery;
}
Unit unit = Unit.INSTANCE;
RoomSQLiteQuery roomSQLiteQuery = new RoomSQLiteQuery(argumentCount, null);
roomSQLiteQuery.init(query, argumentCount);
return roomSQLiteQuery;
}
}
public final void prunePoolLocked$room_runtime_release() {
if (RoomSQLiteQuery.queryPool.size() <= 15) {
return;
}
int size = RoomSQLiteQuery.queryPool.size() - 10;
Iterator<Integer> it = RoomSQLiteQuery.queryPool.descendingKeySet().iterator();
Intrinsics.checkNotNullExpressionValue(it, "queryPool.descendingKeySet().iterator()");
while (true) {
int i = size - 1;
if (size <= 0) {
return;
}
it.next();
it.remove();
size = i;
}
}
}
}