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,7 @@
package androidx.sqlite.db;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,114 @@
package androidx.sqlite.db;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class SimpleSQLiteQuery implements SupportSQLiteQuery {
public static final Companion Companion = new Companion(null);
private final Object[] bindArgs;
private final String query;
public static final void bind(SupportSQLiteProgram supportSQLiteProgram, Object[] objArr) {
Companion.bind(supportSQLiteProgram, objArr);
}
@Override // androidx.sqlite.db.SupportSQLiteQuery
public String getSql() {
return this.query;
}
public SimpleSQLiteQuery(String query, Object[] objArr) {
Intrinsics.checkNotNullParameter(query, "query");
this.query = query;
this.bindArgs = objArr;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public SimpleSQLiteQuery(String query) {
this(query, null);
Intrinsics.checkNotNullParameter(query, "query");
}
@Override // androidx.sqlite.db.SupportSQLiteQuery
public void bindTo(SupportSQLiteProgram statement) {
Intrinsics.checkNotNullParameter(statement, "statement");
Companion.bind(statement, this.bindArgs);
}
@Override // androidx.sqlite.db.SupportSQLiteQuery
public int getArgCount() {
Object[] objArr = this.bindArgs;
if (objArr != null) {
return objArr.length;
}
return 0;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final void bind(SupportSQLiteProgram statement, Object[] objArr) {
Intrinsics.checkNotNullParameter(statement, "statement");
if (objArr == null) {
return;
}
int length = objArr.length;
int i = 0;
while (i < length) {
Object obj = objArr[i];
i++;
bind(statement, i, obj);
}
}
private final void bind(SupportSQLiteProgram supportSQLiteProgram, int i, Object obj) {
if (obj == null) {
supportSQLiteProgram.bindNull(i);
return;
}
if (obj instanceof byte[]) {
supportSQLiteProgram.bindBlob(i, (byte[]) obj);
return;
}
if (obj instanceof Float) {
supportSQLiteProgram.bindDouble(i, ((Number) obj).floatValue());
return;
}
if (obj instanceof Double) {
supportSQLiteProgram.bindDouble(i, ((Number) obj).doubleValue());
return;
}
if (obj instanceof Long) {
supportSQLiteProgram.bindLong(i, ((Number) obj).longValue());
return;
}
if (obj instanceof Integer) {
supportSQLiteProgram.bindLong(i, ((Number) obj).intValue());
return;
}
if (obj instanceof Short) {
supportSQLiteProgram.bindLong(i, ((Number) obj).shortValue());
return;
}
if (obj instanceof Byte) {
supportSQLiteProgram.bindLong(i, ((Number) obj).byteValue());
return;
}
if (obj instanceof String) {
supportSQLiteProgram.bindString(i, (String) obj);
return;
}
if (obj instanceof Boolean) {
supportSQLiteProgram.bindLong(i, ((Boolean) obj).booleanValue() ? 1L : 0L);
return;
}
throw new IllegalArgumentException("Cannot bind " + obj + " at index " + i + " Supported types: Null, ByteArray, Float, Double, Long, Int, Short, Byte, String");
}
}
}

View File

@@ -0,0 +1,166 @@
package androidx.sqlite.db;
import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.io.File;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes.dex */
public final class SupportSQLiteCompat {
private SupportSQLiteCompat() {
}
@RequiresApi(16)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final class Api16Impl {
public static final Api16Impl INSTANCE = new Api16Impl();
private Api16Impl() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final void cancel(CancellationSignal cancellationSignal) {
Intrinsics.checkNotNullParameter(cancellationSignal, "cancellationSignal");
cancellationSignal.cancel();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final CancellationSignal createCancellationSignal() {
return new CancellationSignal();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final boolean deleteDatabase(File file) {
Intrinsics.checkNotNullParameter(file, "file");
return SQLiteDatabase.deleteDatabase(file);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final Cursor rawQueryWithFactory(SQLiteDatabase sQLiteDatabase, String sql, String[] selectionArgs, String str, CancellationSignal cancellationSignal, SQLiteDatabase.CursorFactory cursorFactory) {
Intrinsics.checkNotNullParameter(sQLiteDatabase, "sQLiteDatabase");
Intrinsics.checkNotNullParameter(sql, "sql");
Intrinsics.checkNotNullParameter(selectionArgs, "selectionArgs");
Intrinsics.checkNotNullParameter(cancellationSignal, "cancellationSignal");
Intrinsics.checkNotNullParameter(cursorFactory, "cursorFactory");
Cursor rawQueryWithFactory = sQLiteDatabase.rawQueryWithFactory(cursorFactory, sql, selectionArgs, str, cancellationSignal);
Intrinsics.checkNotNullExpressionValue(rawQueryWithFactory, "sQLiteDatabase.rawQueryW…ationSignal\n )");
return rawQueryWithFactory;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final void setForeignKeyConstraintsEnabled(SQLiteDatabase sQLiteDatabase, boolean z) {
Intrinsics.checkNotNullParameter(sQLiteDatabase, "sQLiteDatabase");
sQLiteDatabase.setForeignKeyConstraintsEnabled(z);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final void disableWriteAheadLogging(SQLiteDatabase sQLiteDatabase) {
Intrinsics.checkNotNullParameter(sQLiteDatabase, "sQLiteDatabase");
sQLiteDatabase.disableWriteAheadLogging();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final boolean isWriteAheadLoggingEnabled(SQLiteDatabase sQLiteDatabase) {
Intrinsics.checkNotNullParameter(sQLiteDatabase, "sQLiteDatabase");
return sQLiteDatabase.isWriteAheadLoggingEnabled();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final void setWriteAheadLoggingEnabled(SQLiteOpenHelper sQLiteOpenHelper, boolean z) {
Intrinsics.checkNotNullParameter(sQLiteOpenHelper, "sQLiteOpenHelper");
sQLiteOpenHelper.setWriteAheadLoggingEnabled(z);
}
}
@RequiresApi(19)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final class Api19Impl {
public static final Api19Impl INSTANCE = new Api19Impl();
private Api19Impl() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final Uri getNotificationUri(Cursor cursor) {
Intrinsics.checkNotNullParameter(cursor, "cursor");
Uri notificationUri = cursor.getNotificationUri();
Intrinsics.checkNotNullExpressionValue(notificationUri, "cursor.notificationUri");
return notificationUri;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final boolean isLowRamDevice(ActivityManager activityManager) {
Intrinsics.checkNotNullParameter(activityManager, "activityManager");
return activityManager.isLowRamDevice();
}
}
@RequiresApi(21)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final class Api21Impl {
public static final Api21Impl INSTANCE = new Api21Impl();
private Api21Impl() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final File getNoBackupFilesDir(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
File noBackupFilesDir = context.getNoBackupFilesDir();
Intrinsics.checkNotNullExpressionValue(noBackupFilesDir, "context.noBackupFilesDir");
return noBackupFilesDir;
}
}
@RequiresApi(23)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final class Api23Impl {
public static final Api23Impl INSTANCE = new Api23Impl();
private Api23Impl() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final void setExtras(Cursor cursor, Bundle extras) {
Intrinsics.checkNotNullParameter(cursor, "cursor");
Intrinsics.checkNotNullParameter(extras, "extras");
cursor.setExtras(extras);
}
}
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final class Api29Impl {
public static final Api29Impl INSTANCE = new Api29Impl();
private Api29Impl() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final void setNotificationUris(Cursor cursor, ContentResolver cr, List<? extends Uri> uris) {
Intrinsics.checkNotNullParameter(cursor, "cursor");
Intrinsics.checkNotNullParameter(cr, "cr");
Intrinsics.checkNotNullParameter(uris, "uris");
cursor.setNotificationUris(cr, uris);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final List<Uri> getNotificationUris(Cursor cursor) {
Intrinsics.checkNotNullParameter(cursor, "cursor");
List<Uri> notificationUris = cursor.getNotificationUris();
Intrinsics.checkNotNull(notificationUris);
return notificationUris;
}
}
}

View File

@@ -0,0 +1,106 @@
package androidx.sqlite.db;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteTransactionListener;
import android.os.CancellationSignal;
import android.util.Pair;
import androidx.annotation.RequiresApi;
import java.io.Closeable;
import java.util.List;
import java.util.Locale;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public interface SupportSQLiteDatabase extends Closeable {
void beginTransaction();
void beginTransactionNonExclusive();
void beginTransactionWithListener(SQLiteTransactionListener sQLiteTransactionListener);
void beginTransactionWithListenerNonExclusive(SQLiteTransactionListener sQLiteTransactionListener);
SupportSQLiteStatement compileStatement(String str);
int delete(String str, String str2, Object[] objArr);
@RequiresApi(api = 16)
void disableWriteAheadLogging();
boolean enableWriteAheadLogging();
void endTransaction();
void execSQL(String str) throws SQLException;
void execSQL(String str, Object[] objArr) throws SQLException;
List<Pair<String, String>> getAttachedDbs();
long getMaximumSize();
long getPageSize();
String getPath();
int getVersion();
boolean inTransaction();
long insert(String str, int i, ContentValues contentValues) throws SQLException;
boolean isDatabaseIntegrityOk();
boolean isDbLockedByCurrentThread();
default boolean isExecPerConnectionSQLSupported() {
return false;
}
boolean isOpen();
boolean isReadOnly();
@RequiresApi(api = 16)
boolean isWriteAheadLoggingEnabled();
boolean needUpgrade(int i);
Cursor query(SupportSQLiteQuery supportSQLiteQuery);
@RequiresApi(api = 16)
Cursor query(SupportSQLiteQuery supportSQLiteQuery, CancellationSignal cancellationSignal);
Cursor query(String str);
Cursor query(String str, Object[] objArr);
@RequiresApi(api = 16)
void setForeignKeyConstraintsEnabled(boolean z);
void setLocale(Locale locale);
void setMaxSqlCacheSize(int i);
long setMaximumSize(long j);
void setPageSize(long j);
void setTransactionSuccessful();
void setVersion(int i);
int update(String str, int i, ContentValues contentValues, String str2, Object[] objArr);
boolean yieldIfContendedSafely();
boolean yieldIfContendedSafely(long j);
default void execPerConnectionSQL(String sql, @SuppressLint({"ArrayReturn"}) Object[] objArr) {
Intrinsics.checkNotNullParameter(sql, "sql");
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,236 @@
package androidx.sqlite.db;
import android.content.Context;
import android.database.sqlite.SQLiteException;
import android.util.Log;
import android.util.Pair;
import androidx.annotation.RequiresApi;
import androidx.sqlite.db.SupportSQLiteCompat;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes.dex */
public interface SupportSQLiteOpenHelper extends Closeable {
public interface Factory {
SupportSQLiteOpenHelper create(Configuration configuration);
}
@Override // java.io.Closeable, java.lang.AutoCloseable
void close();
String getDatabaseName();
SupportSQLiteDatabase getReadableDatabase();
SupportSQLiteDatabase getWritableDatabase();
@RequiresApi(api = 16)
void setWriteAheadLoggingEnabled(boolean z);
@SourceDebugExtension({"SMAP\nSupportSQLiteOpenHelper.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SupportSQLiteOpenHelper.kt\nandroidx/sqlite/db/SupportSQLiteOpenHelper$Callback\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 4 Strings.kt\nkotlin/text/StringsKt__StringsKt\n*L\n1#1,426:1\n1#2:427\n1855#3,2:428\n107#4:430\n79#4,22:431\n*S KotlinDebug\n*F\n+ 1 SupportSQLiteOpenHelper.kt\nandroidx/sqlite/db/SupportSQLiteOpenHelper$Callback\n*L\n243#1:428,2\n251#1:430\n251#1:431,22\n*E\n"})
public static abstract class Callback {
public static final Companion Companion = new Companion(null);
private static final String TAG = "SupportSQLite";
public final int version;
public void onConfigure(SupportSQLiteDatabase db) {
Intrinsics.checkNotNullParameter(db, "db");
}
public abstract void onCreate(SupportSQLiteDatabase supportSQLiteDatabase);
public void onOpen(SupportSQLiteDatabase db) {
Intrinsics.checkNotNullParameter(db, "db");
}
public abstract void onUpgrade(SupportSQLiteDatabase supportSQLiteDatabase, int i, int i2);
public Callback(int i) {
this.version = i;
}
public void onDowngrade(SupportSQLiteDatabase db, int i, int i2) {
Intrinsics.checkNotNullParameter(db, "db");
throw new SQLiteException("Can't downgrade database from version " + i + " to " + i2);
}
public void onCorruption(SupportSQLiteDatabase db) {
Intrinsics.checkNotNullParameter(db, "db");
Log.e(TAG, "Corruption reported by sqlite on database: " + db + ".path");
if (!db.isOpen()) {
String path = db.getPath();
if (path != null) {
deleteDatabaseFile(path);
return;
}
return;
}
List<Pair<String, String>> list = null;
try {
try {
list = db.getAttachedDbs();
} catch (SQLiteException unused) {
}
try {
db.close();
} catch (IOException unused2) {
}
if (list != null) {
return;
}
} finally {
if (list == null) {
String path2 = db.getPath();
if (path2 != null) {
deleteDatabaseFile(path2);
}
} else {
Iterator<T> it = list.iterator();
while (it.hasNext()) {
Object obj = ((Pair) it.next()).second;
Intrinsics.checkNotNullExpressionValue(obj, "p.second");
deleteDatabaseFile((String) obj);
}
}
}
}
private final void deleteDatabaseFile(String str) {
boolean equals;
equals = StringsKt__StringsJVMKt.equals(str, ":memory:", true);
if (equals) {
return;
}
int length = str.length() - 1;
int i = 0;
boolean z = false;
while (i <= length) {
boolean z2 = Intrinsics.compare((int) str.charAt(!z ? i : length), 32) <= 0;
if (z) {
if (!z2) {
break;
} else {
length--;
}
} else if (z2) {
i++;
} else {
z = true;
}
}
if (str.subSequence(i, length + 1).toString().length() == 0) {
return;
}
Log.w(TAG, "deleting the database file: " + str);
try {
SupportSQLiteCompat.Api16Impl.deleteDatabase(new File(str));
} catch (Exception e) {
Log.w(TAG, "delete failed: ", e);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}
public static final class Configuration {
public static final Companion Companion = new Companion(null);
public final boolean allowDataLossOnRecovery;
public final Callback callback;
public final Context context;
public final String name;
public final boolean useNoBackupDirectory;
public static final Builder builder(Context context) {
return Companion.builder(context);
}
public Configuration(Context context, String str, Callback callback, boolean z, boolean z2) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(callback, "callback");
this.context = context;
this.name = str;
this.callback = callback;
this.useNoBackupDirectory = z;
this.allowDataLossOnRecovery = z2;
}
public /* synthetic */ Configuration(Context context, String str, Callback callback, boolean z, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(context, str, callback, (i & 8) != 0 ? false : z, (i & 16) != 0 ? false : z2);
}
public static class Builder {
private boolean allowDataLossOnRecovery;
private Callback callback;
private final Context context;
private String name;
private boolean useNoBackupDirectory;
public Builder allowDataLossOnRecovery(boolean z) {
this.allowDataLossOnRecovery = z;
return this;
}
public Builder callback(Callback callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
this.callback = callback;
return this;
}
public Builder name(String str) {
this.name = str;
return this;
}
public Builder noBackupDirectory(boolean z) {
this.useNoBackupDirectory = z;
return this;
}
public Builder(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
this.context = context;
}
public Configuration build() {
String str;
Callback callback = this.callback;
if (callback == null) {
throw new IllegalArgumentException("Must set a callback to create the configuration.".toString());
}
if (this.useNoBackupDirectory && ((str = this.name) == null || str.length() == 0)) {
throw new IllegalArgumentException("Must set a non-null database name to a configuration that uses the no backup directory.".toString());
}
return new Configuration(this.context, this.name, callback, this.useNoBackupDirectory, this.allowDataLossOnRecovery);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Builder builder(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
return new Builder(context);
}
}
}
}

View File

@@ -0,0 +1,18 @@
package androidx.sqlite.db;
import java.io.Closeable;
/* loaded from: classes.dex */
public interface SupportSQLiteProgram extends Closeable {
void bindBlob(int i, byte[] bArr);
void bindDouble(int i, double d);
void bindLong(int i, long j);
void bindNull(int i);
void bindString(int i, String str);
void clearBindings();
}

View File

@@ -0,0 +1,10 @@
package androidx.sqlite.db;
/* loaded from: classes.dex */
public interface SupportSQLiteQuery {
void bindTo(SupportSQLiteProgram supportSQLiteProgram);
int getArgCount();
String getSql();
}

View File

@@ -0,0 +1,139 @@
package androidx.sqlite.db;
import java.util.regex.Pattern;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nSupportSQLiteQueryBuilder.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SupportSQLiteQueryBuilder.kt\nandroidx/sqlite/db/SupportSQLiteQueryBuilder\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,187:1\n1#2:188\n*E\n"})
/* loaded from: classes.dex */
public final class SupportSQLiteQueryBuilder {
public static final Companion Companion = new Companion(null);
private static final Pattern limitPattern = Pattern.compile("\\s*\\d+\\s*(,\\s*\\d+\\s*)?");
private Object[] bindArgs;
private String[] columns;
private boolean distinct;
private String groupBy;
private String having;
private String limit;
private String orderBy;
private String selection;
private final String table;
public /* synthetic */ SupportSQLiteQueryBuilder(String str, DefaultConstructorMarker defaultConstructorMarker) {
this(str);
}
public static final SupportSQLiteQueryBuilder builder(String str) {
return Companion.builder(str);
}
public final SupportSQLiteQueryBuilder columns(String[] strArr) {
this.columns = strArr;
return this;
}
public final SupportSQLiteQueryBuilder distinct() {
this.distinct = true;
return this;
}
public final SupportSQLiteQueryBuilder groupBy(String str) {
this.groupBy = str;
return this;
}
public final SupportSQLiteQueryBuilder having(String str) {
this.having = str;
return this;
}
public final SupportSQLiteQueryBuilder orderBy(String str) {
this.orderBy = str;
return this;
}
public final SupportSQLiteQueryBuilder selection(String str, Object[] objArr) {
this.selection = str;
this.bindArgs = objArr;
return this;
}
private SupportSQLiteQueryBuilder(String str) {
this.table = str;
}
public final SupportSQLiteQueryBuilder limit(String limit) {
Intrinsics.checkNotNullParameter(limit, "limit");
boolean matches = limitPattern.matcher(limit).matches();
if (limit.length() == 0 || matches) {
this.limit = limit;
return this;
}
throw new IllegalArgumentException(("invalid LIMIT clauses:" + limit).toString());
}
public final SupportSQLiteQuery create() {
String str;
String str2 = this.groupBy;
if ((str2 == null || str2.length() == 0) && (str = this.having) != null && str.length() != 0) {
throw new IllegalArgumentException("HAVING clauses are only permitted when using a groupBy clause".toString());
}
StringBuilder sb = new StringBuilder(120);
sb.append("SELECT ");
if (this.distinct) {
sb.append("DISTINCT ");
}
String[] strArr = this.columns;
if (strArr != null && strArr.length != 0) {
Intrinsics.checkNotNull(strArr);
appendColumns(sb, strArr);
} else {
sb.append("* ");
}
sb.append("FROM ");
sb.append(this.table);
appendClause(sb, " WHERE ", this.selection);
appendClause(sb, " GROUP BY ", this.groupBy);
appendClause(sb, " HAVING ", this.having);
appendClause(sb, " ORDER BY ", this.orderBy);
appendClause(sb, " LIMIT ", this.limit);
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder(capacity).…builderAction).toString()");
return new SimpleSQLiteQuery(sb2, this.bindArgs);
}
private final void appendClause(StringBuilder sb, String str, String str2) {
if (str2 == null || str2.length() == 0) {
return;
}
sb.append(str);
sb.append(str2);
}
private final void appendColumns(StringBuilder sb, String[] strArr) {
int length = strArr.length;
for (int i = 0; i < length; i++) {
String str = strArr[i];
if (i > 0) {
sb.append(", ");
}
sb.append(str);
}
sb.append(' ');
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final SupportSQLiteQueryBuilder builder(String tableName) {
Intrinsics.checkNotNullParameter(tableName, "tableName");
return new SupportSQLiteQueryBuilder(tableName, null);
}
}
}

View File

@@ -0,0 +1,14 @@
package androidx.sqlite.db;
/* loaded from: classes.dex */
public interface SupportSQLiteStatement extends SupportSQLiteProgram {
void execute();
long executeInsert();
int executeUpdateDelete();
long simpleQueryForLong();
String simpleQueryForString();
}

View File

@@ -0,0 +1,402 @@
package androidx.sqlite.db.framework;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteCursor;
import android.database.sqlite.SQLiteCursorDriver;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQuery;
import android.database.sqlite.SQLiteStatement;
import android.database.sqlite.SQLiteTransactionListener;
import android.os.Build;
import android.os.CancellationSignal;
import android.text.TextUtils;
import android.util.Pair;
import androidx.annotation.DoNotInline;
import androidx.annotation.RequiresApi;
import androidx.sqlite.db.SimpleSQLiteQuery;
import androidx.sqlite.db.SupportSQLiteCompat;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteQuery;
import androidx.sqlite.db.SupportSQLiteStatement;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import kotlin.jvm.functions.Function4;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nFrameworkSQLiteDatabase.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FrameworkSQLiteDatabase.kt\nandroidx/sqlite/db/framework/FrameworkSQLiteDatabase\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,336:1\n1#2:337\n*E\n"})
/* loaded from: classes.dex */
public final class FrameworkSQLiteDatabase implements SupportSQLiteDatabase {
private final SQLiteDatabase delegate;
public static final Companion Companion = new Companion(null);
private static final String[] CONFLICT_VALUES = {"", " OR ROLLBACK ", " OR ABORT ", " OR FAIL ", " OR IGNORE ", " OR REPLACE "};
private static final String[] EMPTY_STRING_ARRAY = new String[0];
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean isExecPerConnectionSQLSupported() {
return Build.VERSION.SDK_INT >= 30;
}
public FrameworkSQLiteDatabase(SQLiteDatabase delegate) {
Intrinsics.checkNotNullParameter(delegate, "delegate");
this.delegate = delegate;
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public SupportSQLiteStatement compileStatement(String sql) {
Intrinsics.checkNotNullParameter(sql, "sql");
SQLiteStatement compileStatement = this.delegate.compileStatement(sql);
Intrinsics.checkNotNullExpressionValue(compileStatement, "delegate.compileStatement(sql)");
return new FrameworkSQLiteStatement(compileStatement);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void beginTransaction() {
this.delegate.beginTransaction();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void beginTransactionNonExclusive() {
this.delegate.beginTransactionNonExclusive();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void beginTransactionWithListener(SQLiteTransactionListener transactionListener) {
Intrinsics.checkNotNullParameter(transactionListener, "transactionListener");
this.delegate.beginTransactionWithListener(transactionListener);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void beginTransactionWithListenerNonExclusive(SQLiteTransactionListener transactionListener) {
Intrinsics.checkNotNullParameter(transactionListener, "transactionListener");
this.delegate.beginTransactionWithListenerNonExclusive(transactionListener);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void endTransaction() {
this.delegate.endTransaction();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void setTransactionSuccessful() {
this.delegate.setTransactionSuccessful();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean inTransaction() {
return this.delegate.inTransaction();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean isDbLockedByCurrentThread() {
return this.delegate.isDbLockedByCurrentThread();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean yieldIfContendedSafely() {
return this.delegate.yieldIfContendedSafely();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean yieldIfContendedSafely(long j) {
return this.delegate.yieldIfContendedSafely(j);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public int getVersion() {
return this.delegate.getVersion();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void setVersion(int i) {
this.delegate.setVersion(i);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public long getMaximumSize() {
return this.delegate.getMaximumSize();
}
/* renamed from: setMaximumSize, reason: collision with other method in class */
public void m177setMaximumSize(long j) {
this.delegate.setMaximumSize(j);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public long setMaximumSize(long j) {
this.delegate.setMaximumSize(j);
return this.delegate.getMaximumSize();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void execPerConnectionSQL(String sql, Object[] objArr) {
Intrinsics.checkNotNullParameter(sql, "sql");
int i = Build.VERSION.SDK_INT;
if (i >= 30) {
Api30Impl.INSTANCE.execPerConnectionSQL(this.delegate, sql, objArr);
return;
}
throw new UnsupportedOperationException("execPerConnectionSQL is not supported on a SDK version lower than 30, current version is: " + i);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public long getPageSize() {
return this.delegate.getPageSize();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void setPageSize(long j) {
this.delegate.setPageSize(j);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public Cursor query(String query) {
Intrinsics.checkNotNullParameter(query, "query");
return query(new SimpleSQLiteQuery(query));
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public Cursor query(String query, Object[] bindArgs) {
Intrinsics.checkNotNullParameter(query, "query");
Intrinsics.checkNotNullParameter(bindArgs, "bindArgs");
return query(new SimpleSQLiteQuery(query, bindArgs));
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public Cursor query(final SupportSQLiteQuery query) {
Intrinsics.checkNotNullParameter(query, "query");
final Function4 function4 = new Function4() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteDatabase$query$cursorFactory$1
{
super(4);
}
@Override // kotlin.jvm.functions.Function4
public final SQLiteCursor invoke(SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
SupportSQLiteQuery supportSQLiteQuery = SupportSQLiteQuery.this;
Intrinsics.checkNotNull(sQLiteQuery);
supportSQLiteQuery.bindTo(new FrameworkSQLiteProgram(sQLiteQuery));
return new SQLiteCursor(sQLiteCursorDriver, str, sQLiteQuery);
}
};
Cursor rawQueryWithFactory = this.delegate.rawQueryWithFactory(new SQLiteDatabase.CursorFactory() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteDatabase$$ExternalSyntheticLambda1
@Override // android.database.sqlite.SQLiteDatabase.CursorFactory
public final Cursor newCursor(SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
Cursor query$lambda$0;
query$lambda$0 = FrameworkSQLiteDatabase.query$lambda$0(Function4.this, sQLiteDatabase, sQLiteCursorDriver, str, sQLiteQuery);
return query$lambda$0;
}
}, query.getSql(), EMPTY_STRING_ARRAY, null);
Intrinsics.checkNotNullExpressionValue(rawQueryWithFactory, "delegate.rawQueryWithFac…EMPTY_STRING_ARRAY, null)");
return rawQueryWithFactory;
}
/* JADX INFO: Access modifiers changed from: private */
public static final Cursor query$lambda$0(Function4 tmp0, SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
Intrinsics.checkNotNullParameter(tmp0, "$tmp0");
return (Cursor) tmp0.invoke(sQLiteDatabase, sQLiteCursorDriver, str, sQLiteQuery);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
@RequiresApi(16)
public Cursor query(final SupportSQLiteQuery query, CancellationSignal cancellationSignal) {
Intrinsics.checkNotNullParameter(query, "query");
SQLiteDatabase sQLiteDatabase = this.delegate;
String sql = query.getSql();
String[] strArr = EMPTY_STRING_ARRAY;
Intrinsics.checkNotNull(cancellationSignal);
return SupportSQLiteCompat.Api16Impl.rawQueryWithFactory(sQLiteDatabase, sql, strArr, null, cancellationSignal, new SQLiteDatabase.CursorFactory() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteDatabase$$ExternalSyntheticLambda0
@Override // android.database.sqlite.SQLiteDatabase.CursorFactory
public final Cursor newCursor(SQLiteDatabase sQLiteDatabase2, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
Cursor query$lambda$1;
query$lambda$1 = FrameworkSQLiteDatabase.query$lambda$1(SupportSQLiteQuery.this, sQLiteDatabase2, sQLiteCursorDriver, str, sQLiteQuery);
return query$lambda$1;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static final Cursor query$lambda$1(SupportSQLiteQuery query, SQLiteDatabase sQLiteDatabase, SQLiteCursorDriver sQLiteCursorDriver, String str, SQLiteQuery sQLiteQuery) {
Intrinsics.checkNotNullParameter(query, "$query");
Intrinsics.checkNotNull(sQLiteQuery);
query.bindTo(new FrameworkSQLiteProgram(sQLiteQuery));
return new SQLiteCursor(sQLiteCursorDriver, str, sQLiteQuery);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public long insert(String table, int i, ContentValues values) throws SQLException {
Intrinsics.checkNotNullParameter(table, "table");
Intrinsics.checkNotNullParameter(values, "values");
return this.delegate.insertWithOnConflict(table, null, values, i);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public int delete(String table, String str, Object[] objArr) {
Intrinsics.checkNotNullParameter(table, "table");
StringBuilder sb = new StringBuilder();
sb.append("DELETE FROM ");
sb.append(table);
if (str != null && str.length() != 0) {
sb.append(" WHERE ");
sb.append(str);
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()");
SupportSQLiteStatement compileStatement = compileStatement(sb2);
SimpleSQLiteQuery.Companion.bind(compileStatement, objArr);
return compileStatement.executeUpdateDelete();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public int update(String table, int i, ContentValues values, String str, Object[] objArr) {
Intrinsics.checkNotNullParameter(table, "table");
Intrinsics.checkNotNullParameter(values, "values");
if (values.size() == 0) {
throw new IllegalArgumentException("Empty values".toString());
}
int size = values.size();
int length = objArr == null ? size : objArr.length + size;
Object[] objArr2 = new Object[length];
StringBuilder sb = new StringBuilder();
sb.append("UPDATE ");
sb.append(CONFLICT_VALUES[i]);
sb.append(table);
sb.append(" SET ");
int i2 = 0;
for (String str2 : values.keySet()) {
sb.append(i2 > 0 ? "," : "");
sb.append(str2);
objArr2[i2] = values.get(str2);
sb.append("=?");
i2++;
}
if (objArr != null) {
for (int i3 = size; i3 < length; i3++) {
objArr2[i3] = objArr[i3 - size];
}
}
if (!TextUtils.isEmpty(str)) {
sb.append(" WHERE ");
sb.append(str);
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()");
SupportSQLiteStatement compileStatement = compileStatement(sb2);
SimpleSQLiteQuery.Companion.bind(compileStatement, objArr2);
return compileStatement.executeUpdateDelete();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void execSQL(String sql) throws SQLException {
Intrinsics.checkNotNullParameter(sql, "sql");
this.delegate.execSQL(sql);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void execSQL(String sql, Object[] bindArgs) throws SQLException {
Intrinsics.checkNotNullParameter(sql, "sql");
Intrinsics.checkNotNullParameter(bindArgs, "bindArgs");
this.delegate.execSQL(sql, bindArgs);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean isReadOnly() {
return this.delegate.isReadOnly();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean isOpen() {
return this.delegate.isOpen();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean needUpgrade(int i) {
return this.delegate.needUpgrade(i);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public String getPath() {
return this.delegate.getPath();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void setLocale(Locale locale) {
Intrinsics.checkNotNullParameter(locale, "locale");
this.delegate.setLocale(locale);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public void setMaxSqlCacheSize(int i) {
this.delegate.setMaxSqlCacheSize(i);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
@RequiresApi(api = 16)
public void setForeignKeyConstraintsEnabled(boolean z) {
SupportSQLiteCompat.Api16Impl.setForeignKeyConstraintsEnabled(this.delegate, z);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean enableWriteAheadLogging() {
return this.delegate.enableWriteAheadLogging();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
@RequiresApi(api = 16)
public void disableWriteAheadLogging() {
SupportSQLiteCompat.Api16Impl.disableWriteAheadLogging(this.delegate);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
@RequiresApi(api = 16)
public boolean isWriteAheadLoggingEnabled() {
return SupportSQLiteCompat.Api16Impl.isWriteAheadLoggingEnabled(this.delegate);
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public List<Pair<String, String>> getAttachedDbs() {
return this.delegate.getAttachedDbs();
}
@Override // androidx.sqlite.db.SupportSQLiteDatabase
public boolean isDatabaseIntegrityOk() {
return this.delegate.isDatabaseIntegrityOk();
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
this.delegate.close();
}
public final boolean isDelegate(SQLiteDatabase sqLiteDatabase) {
Intrinsics.checkNotNullParameter(sqLiteDatabase, "sqLiteDatabase");
return Intrinsics.areEqual(this.delegate, sqLiteDatabase);
}
@RequiresApi(30)
public static final class Api30Impl {
public static final Api30Impl INSTANCE = new Api30Impl();
private Api30Impl() {
}
@DoNotInline
public final void execPerConnectionSQL(SQLiteDatabase sQLiteDatabase, String sql, Object[] objArr) {
Intrinsics.checkNotNullParameter(sQLiteDatabase, "sQLiteDatabase");
Intrinsics.checkNotNullParameter(sql, "sql");
sQLiteDatabase.execPerConnectionSQL(sql, objArr);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,480 @@
package androidx.sqlite.db.framework;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import androidx.annotation.RequiresApi;
import androidx.sqlite.db.SupportSQLiteCompat;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper;
import androidx.sqlite.util.ProcessLock;
import java.io.File;
import java.util.UUID;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
/* loaded from: classes.dex */
public final class FrameworkSQLiteOpenHelper implements SupportSQLiteOpenHelper {
public static final Companion Companion = new Companion(null);
private static final String TAG = "SupportSQLite";
private final boolean allowDataLossOnRecovery;
private final SupportSQLiteOpenHelper.Callback callback;
private final Context context;
private final Lazy lazyDelegate;
private final String name;
private final boolean useNoBackupDirectory;
private boolean writeAheadLoggingEnabled;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public FrameworkSQLiteOpenHelper(Context context, String str, SupportSQLiteOpenHelper.Callback callback) {
this(context, str, callback, false, false, 24, null);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(callback, "callback");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public FrameworkSQLiteOpenHelper(Context context, String str, SupportSQLiteOpenHelper.Callback callback, boolean z) {
this(context, str, callback, z, false, 16, null);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(callback, "callback");
}
@Override // androidx.sqlite.db.SupportSQLiteOpenHelper
public String getDatabaseName() {
return this.name;
}
public FrameworkSQLiteOpenHelper(Context context, String str, SupportSQLiteOpenHelper.Callback callback, boolean z, boolean z2) {
Lazy lazy;
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(callback, "callback");
this.context = context;
this.name = str;
this.callback = callback;
this.useNoBackupDirectory = z;
this.allowDataLossOnRecovery = z2;
lazy = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$lazyDelegate$1
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final FrameworkSQLiteOpenHelper.OpenHelper invoke() {
String str2;
FrameworkSQLiteOpenHelper.OpenHelper openHelper;
Context context2;
String str3;
SupportSQLiteOpenHelper.Callback callback2;
boolean z3;
boolean z4;
boolean z5;
Context context3;
String str4;
Context context4;
SupportSQLiteOpenHelper.Callback callback3;
boolean z6;
str2 = FrameworkSQLiteOpenHelper.this.name;
if (str2 != null) {
z5 = FrameworkSQLiteOpenHelper.this.useNoBackupDirectory;
if (z5) {
context3 = FrameworkSQLiteOpenHelper.this.context;
File noBackupFilesDir = SupportSQLiteCompat.Api21Impl.getNoBackupFilesDir(context3);
str4 = FrameworkSQLiteOpenHelper.this.name;
File file = new File(noBackupFilesDir, str4);
context4 = FrameworkSQLiteOpenHelper.this.context;
String absolutePath = file.getAbsolutePath();
FrameworkSQLiteOpenHelper.DBRefHolder dBRefHolder = new FrameworkSQLiteOpenHelper.DBRefHolder(null);
callback3 = FrameworkSQLiteOpenHelper.this.callback;
z6 = FrameworkSQLiteOpenHelper.this.allowDataLossOnRecovery;
openHelper = new FrameworkSQLiteOpenHelper.OpenHelper(context4, absolutePath, dBRefHolder, callback3, z6);
z4 = FrameworkSQLiteOpenHelper.this.writeAheadLoggingEnabled;
SupportSQLiteCompat.Api16Impl.setWriteAheadLoggingEnabled(openHelper, z4);
return openHelper;
}
}
context2 = FrameworkSQLiteOpenHelper.this.context;
str3 = FrameworkSQLiteOpenHelper.this.name;
FrameworkSQLiteOpenHelper.DBRefHolder dBRefHolder2 = new FrameworkSQLiteOpenHelper.DBRefHolder(null);
callback2 = FrameworkSQLiteOpenHelper.this.callback;
z3 = FrameworkSQLiteOpenHelper.this.allowDataLossOnRecovery;
openHelper = new FrameworkSQLiteOpenHelper.OpenHelper(context2, str3, dBRefHolder2, callback2, z3);
z4 = FrameworkSQLiteOpenHelper.this.writeAheadLoggingEnabled;
SupportSQLiteCompat.Api16Impl.setWriteAheadLoggingEnabled(openHelper, z4);
return openHelper;
}
});
this.lazyDelegate = lazy;
}
public /* synthetic */ FrameworkSQLiteOpenHelper(Context context, String str, SupportSQLiteOpenHelper.Callback callback, boolean z, boolean z2, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(context, str, callback, (i & 8) != 0 ? false : z, (i & 16) != 0 ? false : z2);
}
private final OpenHelper getDelegate() {
return (OpenHelper) this.lazyDelegate.getValue();
}
@Override // androidx.sqlite.db.SupportSQLiteOpenHelper
@RequiresApi(api = 16)
public void setWriteAheadLoggingEnabled(boolean z) {
if (this.lazyDelegate.isInitialized()) {
SupportSQLiteCompat.Api16Impl.setWriteAheadLoggingEnabled(getDelegate(), z);
}
this.writeAheadLoggingEnabled = z;
}
@Override // androidx.sqlite.db.SupportSQLiteOpenHelper
public SupportSQLiteDatabase getWritableDatabase() {
return getDelegate().getSupportDatabase(true);
}
@Override // androidx.sqlite.db.SupportSQLiteOpenHelper
public SupportSQLiteDatabase getReadableDatabase() {
return getDelegate().getSupportDatabase(false);
}
@Override // androidx.sqlite.db.SupportSQLiteOpenHelper, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (this.lazyDelegate.isInitialized()) {
getDelegate().close();
}
}
public static final class OpenHelper extends SQLiteOpenHelper {
public static final Companion Companion = new Companion(null);
private final boolean allowDataLossOnRecovery;
private final SupportSQLiteOpenHelper.Callback callback;
private final Context context;
private final DBRefHolder dbRef;
private final ProcessLock lock;
private boolean migrated;
private boolean opened;
public enum CallbackName {
ON_CONFIGURE,
ON_CREATE,
ON_UPGRADE,
ON_DOWNGRADE,
ON_OPEN
}
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[CallbackName.values().length];
try {
iArr[CallbackName.ON_CONFIGURE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[CallbackName.ON_CREATE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[CallbackName.ON_UPGRADE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[CallbackName.ON_DOWNGRADE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
iArr[CallbackName.ON_OPEN.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
$EnumSwitchMapping$0 = iArr;
}
}
public final boolean getAllowDataLossOnRecovery() {
return this.allowDataLossOnRecovery;
}
public final SupportSQLiteOpenHelper.Callback getCallback() {
return this.callback;
}
public final Context getContext() {
return this.context;
}
public final DBRefHolder getDbRef() {
return this.dbRef;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public OpenHelper(Context context, String str, final DBRefHolder dbRef, final SupportSQLiteOpenHelper.Callback callback, boolean z) {
super(context, str, null, callback.version, new DatabaseErrorHandler() { // from class: androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper$$ExternalSyntheticLambda0
@Override // android.database.DatabaseErrorHandler
public final void onCorruption(SQLiteDatabase sQLiteDatabase) {
FrameworkSQLiteOpenHelper.OpenHelper._init_$lambda$0(SupportSQLiteOpenHelper.Callback.this, dbRef, sQLiteDatabase);
}
});
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(dbRef, "dbRef");
Intrinsics.checkNotNullParameter(callback, "callback");
this.context = context;
this.dbRef = dbRef;
this.callback = callback;
this.allowDataLossOnRecovery = z;
if (str == null) {
str = UUID.randomUUID().toString();
Intrinsics.checkNotNullExpressionValue(str, "randomUUID().toString()");
}
this.lock = new ProcessLock(str, context.getCacheDir(), false);
}
/* JADX INFO: Access modifiers changed from: private */
public static final void _init_$lambda$0(SupportSQLiteOpenHelper.Callback callback, DBRefHolder dbRef, SQLiteDatabase dbObj) {
Intrinsics.checkNotNullParameter(callback, "$callback");
Intrinsics.checkNotNullParameter(dbRef, "$dbRef");
Companion companion = Companion;
Intrinsics.checkNotNullExpressionValue(dbObj, "dbObj");
callback.onCorruption(companion.getWrappedDb(dbRef, dbObj));
}
public final SupportSQLiteDatabase getSupportDatabase(boolean z) {
try {
this.lock.lock((this.opened || getDatabaseName() == null) ? false : true);
this.migrated = false;
SQLiteDatabase innerGetDatabase = innerGetDatabase(z);
if (this.migrated) {
close();
SupportSQLiteDatabase supportDatabase = getSupportDatabase(z);
this.lock.unlock();
return supportDatabase;
}
FrameworkSQLiteDatabase wrappedDb = getWrappedDb(innerGetDatabase);
this.lock.unlock();
return wrappedDb;
} catch (Throwable th) {
this.lock.unlock();
throw th;
}
}
private final SQLiteDatabase innerGetDatabase(boolean z) {
File parentFile;
String databaseName = getDatabaseName();
boolean z2 = this.opened;
if (databaseName != null && !z2 && (parentFile = this.context.getDatabasePath(databaseName).getParentFile()) != null) {
parentFile.mkdirs();
if (!parentFile.isDirectory()) {
Log.w(FrameworkSQLiteOpenHelper.TAG, "Invalid database parent file, not a directory: " + parentFile);
}
}
try {
return getWritableOrReadableDatabase(z);
} catch (Throwable unused) {
super.close();
try {
Thread.sleep(500L);
} catch (InterruptedException unused2) {
}
try {
return getWritableOrReadableDatabase(z);
} catch (Throwable th) {
super.close();
if (th instanceof CallbackException) {
CallbackException callbackException = th;
Throwable cause = callbackException.getCause();
int i = WhenMappings.$EnumSwitchMapping$0[callbackException.getCallbackName().ordinal()];
if (i == 1) {
throw cause;
}
if (i == 2) {
throw cause;
}
if (i == 3) {
throw cause;
}
if (i == 4) {
throw cause;
}
if (!(cause instanceof SQLiteException)) {
throw cause;
}
} else {
if (!(th instanceof SQLiteException)) {
throw th;
}
if (databaseName == null || !this.allowDataLossOnRecovery) {
throw th;
}
}
this.context.deleteDatabase(databaseName);
try {
return getWritableOrReadableDatabase(z);
} catch (CallbackException e) {
throw e.getCause();
}
}
}
}
private final SQLiteDatabase getWritableOrReadableDatabase(boolean z) {
if (z) {
SQLiteDatabase writableDatabase = super.getWritableDatabase();
Intrinsics.checkNotNullExpressionValue(writableDatabase, "{\n super.…eDatabase()\n }");
return writableDatabase;
}
SQLiteDatabase readableDatabase = super.getReadableDatabase();
Intrinsics.checkNotNullExpressionValue(readableDatabase, "{\n super.…eDatabase()\n }");
return readableDatabase;
}
public final FrameworkSQLiteDatabase getWrappedDb(SQLiteDatabase sqLiteDatabase) {
Intrinsics.checkNotNullParameter(sqLiteDatabase, "sqLiteDatabase");
return Companion.getWrappedDb(this.dbRef, sqLiteDatabase);
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onCreate(SQLiteDatabase sqLiteDatabase) {
Intrinsics.checkNotNullParameter(sqLiteDatabase, "sqLiteDatabase");
try {
this.callback.onCreate(getWrappedDb(sqLiteDatabase));
} catch (Throwable th) {
throw new CallbackException(CallbackName.ON_CREATE, th);
}
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i2) {
Intrinsics.checkNotNullParameter(sqLiteDatabase, "sqLiteDatabase");
this.migrated = true;
try {
this.callback.onUpgrade(getWrappedDb(sqLiteDatabase), i, i2);
} catch (Throwable th) {
throw new CallbackException(CallbackName.ON_UPGRADE, th);
}
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onConfigure(SQLiteDatabase db) {
Intrinsics.checkNotNullParameter(db, "db");
if (!this.migrated && this.callback.version != db.getVersion()) {
db.setMaxSqlCacheSize(1);
}
try {
this.callback.onConfigure(getWrappedDb(db));
} catch (Throwable th) {
throw new CallbackException(CallbackName.ON_CONFIGURE, th);
}
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onDowngrade(SQLiteDatabase db, int i, int i2) {
Intrinsics.checkNotNullParameter(db, "db");
this.migrated = true;
try {
this.callback.onDowngrade(getWrappedDb(db), i, i2);
} catch (Throwable th) {
throw new CallbackException(CallbackName.ON_DOWNGRADE, th);
}
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onOpen(SQLiteDatabase db) {
Intrinsics.checkNotNullParameter(db, "db");
if (!this.migrated) {
try {
this.callback.onOpen(getWrappedDb(db));
} catch (Throwable th) {
throw new CallbackException(CallbackName.ON_OPEN, th);
}
}
this.opened = true;
}
@Override // android.database.sqlite.SQLiteOpenHelper, java.lang.AutoCloseable
public void close() {
try {
ProcessLock.lock$default(this.lock, false, 1, null);
super.close();
this.dbRef.setDb(null);
this.opened = false;
} finally {
this.lock.unlock();
}
}
public static final class CallbackException extends RuntimeException {
private final CallbackName callbackName;
private final Throwable cause;
public final CallbackName getCallbackName() {
return this.callbackName;
}
@Override // java.lang.Throwable
public Throwable getCause() {
return this.cause;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CallbackException(CallbackName callbackName, Throwable cause) {
super(cause);
Intrinsics.checkNotNullParameter(callbackName, "callbackName");
Intrinsics.checkNotNullParameter(cause, "cause");
this.callbackName = callbackName;
this.cause = cause;
}
}
@SourceDebugExtension({"SMAP\nFrameworkSQLiteOpenHelper.kt\nKotlin\n*S Kotlin\n*F\n+ 1 FrameworkSQLiteOpenHelper.kt\nandroidx/sqlite/db/framework/FrameworkSQLiteOpenHelper$OpenHelper$Companion\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,342:1\n1#2:343\n*E\n"})
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final FrameworkSQLiteDatabase getWrappedDb(DBRefHolder refHolder, SQLiteDatabase sqLiteDatabase) {
Intrinsics.checkNotNullParameter(refHolder, "refHolder");
Intrinsics.checkNotNullParameter(sqLiteDatabase, "sqLiteDatabase");
FrameworkSQLiteDatabase db = refHolder.getDb();
if (db != null && db.isDelegate(sqLiteDatabase)) {
return db;
}
FrameworkSQLiteDatabase frameworkSQLiteDatabase = new FrameworkSQLiteDatabase(sqLiteDatabase);
refHolder.setDb(frameworkSQLiteDatabase);
return frameworkSQLiteDatabase;
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public static final class DBRefHolder {
private FrameworkSQLiteDatabase db;
public final FrameworkSQLiteDatabase getDb() {
return this.db;
}
public final void setDb(FrameworkSQLiteDatabase frameworkSQLiteDatabase) {
this.db = frameworkSQLiteDatabase;
}
public DBRefHolder(FrameworkSQLiteDatabase frameworkSQLiteDatabase) {
this.db = frameworkSQLiteDatabase;
}
}
}

View File

@@ -0,0 +1,13 @@
package androidx.sqlite.db.framework;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class FrameworkSQLiteOpenHelperFactory implements SupportSQLiteOpenHelper.Factory {
@Override // androidx.sqlite.db.SupportSQLiteOpenHelper.Factory
public SupportSQLiteOpenHelper create(SupportSQLiteOpenHelper.Configuration configuration) {
Intrinsics.checkNotNullParameter(configuration, "configuration");
return new FrameworkSQLiteOpenHelper(configuration.context, configuration.name, configuration.callback, configuration.useNoBackupDirectory, configuration.allowDataLossOnRecovery);
}
}

View File

@@ -0,0 +1,52 @@
package androidx.sqlite.db.framework;
import android.database.sqlite.SQLiteProgram;
import androidx.sqlite.db.SupportSQLiteProgram;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class FrameworkSQLiteProgram implements SupportSQLiteProgram {
private final SQLiteProgram delegate;
public FrameworkSQLiteProgram(SQLiteProgram delegate) {
Intrinsics.checkNotNullParameter(delegate, "delegate");
this.delegate = delegate;
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindNull(int i) {
this.delegate.bindNull(i);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindLong(int i, long j) {
this.delegate.bindLong(i, j);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindDouble(int i, double d) {
this.delegate.bindDouble(i, d);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindString(int i, String value) {
Intrinsics.checkNotNullParameter(value, "value");
this.delegate.bindString(i, value);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void bindBlob(int i, byte[] value) {
Intrinsics.checkNotNullParameter(value, "value");
this.delegate.bindBlob(i, value);
}
@Override // androidx.sqlite.db.SupportSQLiteProgram
public void clearBindings() {
this.delegate.clearBindings();
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
this.delegate.close();
}
}

View File

@@ -0,0 +1,42 @@
package androidx.sqlite.db.framework;
import android.database.sqlite.SQLiteStatement;
import androidx.sqlite.db.SupportSQLiteStatement;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class FrameworkSQLiteStatement extends FrameworkSQLiteProgram implements SupportSQLiteStatement {
private final SQLiteStatement delegate;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public FrameworkSQLiteStatement(SQLiteStatement delegate) {
super(delegate);
Intrinsics.checkNotNullParameter(delegate, "delegate");
this.delegate = delegate;
}
@Override // androidx.sqlite.db.SupportSQLiteStatement
public void execute() {
this.delegate.execute();
}
@Override // androidx.sqlite.db.SupportSQLiteStatement
public int executeUpdateDelete() {
return this.delegate.executeUpdateDelete();
}
@Override // androidx.sqlite.db.SupportSQLiteStatement
public long executeInsert() {
return this.delegate.executeInsert();
}
@Override // androidx.sqlite.db.SupportSQLiteStatement
public long simpleQueryForLong() {
return this.delegate.simpleQueryForLong();
}
@Override // androidx.sqlite.db.SupportSQLiteStatement
public String simpleQueryForString() {
return this.delegate.simpleQueryForString();
}
}

View File

@@ -0,0 +1,7 @@
package androidx.sqlite.db.framework;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,110 @@
package androidx.sqlite.util;
import android.util.Log;
import androidx.annotation.RestrictTo;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
@SourceDebugExtension({"SMAP\nProcessLock.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ProcessLock.kt\nandroidx/sqlite/util/ProcessLock\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,103:1\n1#2:104\n*E\n"})
/* loaded from: classes.dex */
public final class ProcessLock {
private static final String TAG = "SupportSQLiteLock";
private FileChannel lockChannel;
private final File lockFile;
private final boolean processLock;
private final Lock threadLock;
public static final Companion Companion = new Companion(null);
private static final Map<String, Lock> threadLocksMap = new HashMap();
public ProcessLock(String name, File file, boolean z) {
File file2;
Intrinsics.checkNotNullParameter(name, "name");
this.processLock = z;
if (file != null) {
file2 = new File(file, name + ".lck");
} else {
file2 = null;
}
this.lockFile = file2;
this.threadLock = Companion.getThreadLock(name);
}
public static /* synthetic */ void lock$default(ProcessLock processLock, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = processLock.processLock;
}
processLock.lock(z);
}
public final void lock(boolean z) {
this.threadLock.lock();
if (z) {
try {
File file = this.lockFile;
if (file == null) {
throw new IOException("No lock directory was provided.");
}
File parentFile = file.getParentFile();
if (parentFile != null) {
parentFile.mkdirs();
}
FileChannel channel = new FileOutputStream(this.lockFile).getChannel();
channel.lock();
this.lockChannel = channel;
} catch (IOException e) {
this.lockChannel = null;
Log.w(TAG, "Unable to grab file lock.", e);
}
}
}
public final void unlock() {
try {
FileChannel fileChannel = this.lockChannel;
if (fileChannel != null) {
fileChannel.close();
}
} catch (IOException unused) {
}
this.threadLock.unlock();
}
@SourceDebugExtension({"SMAP\nProcessLock.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ProcessLock.kt\nandroidx/sqlite/util/ProcessLock$Companion\n+ 2 Maps.kt\nkotlin/collections/MapsKt__MapsKt\n*L\n1#1,103:1\n361#2,7:104\n*S KotlinDebug\n*F\n+ 1 ProcessLock.kt\nandroidx/sqlite/util/ProcessLock$Companion\n*L\n99#1:104,7\n*E\n"})
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
/* JADX INFO: Access modifiers changed from: private */
public final Lock getThreadLock(String str) {
Lock lock;
synchronized (ProcessLock.threadLocksMap) {
try {
Map map = ProcessLock.threadLocksMap;
Object obj = map.get(str);
if (obj == null) {
obj = new ReentrantLock();
map.put(str, obj);
}
lock = (Lock) obj;
} catch (Throwable th) {
throw th;
}
}
return lock;
}
}
}