Revert "Fix suppressed lint checks for "ClassVerificationFailure"."
This reverts commit bb9e12e40a6569b7e1489d368382e2997f95d506.
Reason for revert: Breaks RoomIncrementalAnnotationProcessingTest, see: https://android-build.googleplex.com/builds/7402105/branches/aosp-androidx-main/targets/androidx/cls?end=7401209
Change-Id: I11f811dbbecbb9dfe8e9f0df2068c0edfa7b2ac8
diff --git a/room/guava/lint-baseline.xml b/room/guava/lint-baseline.xml
index 0f84c67..e3459e6 100644
--- a/room/guava/lint-baseline.xml
+++ b/room/guava/lint-baseline.xml
@@ -2,6 +2,17 @@
<issues format="6" by="lint 7.0.0-alpha15" type="baseline" client="cli" name="Lint" variant="all" version="7.0.0-alpha15">
<issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class null is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" cancellationSignal.cancel();"
+ errorLine2=" ~~~~~~">
+ <location
+ file="src/main/java/androidx/room/guava/GuavaRoom.java"
+ line="125"
+ column="44"/>
+ </issue>
+
+ <issue
id="LambdaLast"
message="Functional interface parameters (such as parameter 1, "callable", in androidx.room.guava.GuavaRoom.createListenableFuture) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions"
errorLine1=" final boolean releaseQuery) {"
diff --git a/room/guava/src/main/java/androidx/room/guava/GuavaRoom.java b/room/guava/src/main/java/androidx/room/guava/GuavaRoom.java
index 97e8e91..5993cfe 100644
--- a/room/guava/src/main/java/androidx/room/guava/GuavaRoom.java
+++ b/room/guava/src/main/java/androidx/room/guava/GuavaRoom.java
@@ -26,7 +26,6 @@
import androidx.concurrent.futures.ResolvableFuture;
import androidx.room.RoomDatabase;
import androidx.room.RoomSQLiteQuery;
-import androidx.sqlite.db.SupportSQLiteCompat;
import com.google.common.util.concurrent.ListenableFuture;
@@ -123,7 +122,7 @@
@Override
public void run() {
if (future.isCancelled()) {
- SupportSQLiteCompat.Api16Impl.cancel(cancellationSignal);
+ cancellationSignal.cancel();
}
}
}, sDirectExecutor);
diff --git a/room/ktx/lint-baseline.xml b/room/ktx/lint-baseline.xml
index 42a176b..17243415 100644
--- a/room/ktx/lint-baseline.xml
+++ b/room/ktx/lint-baseline.xml
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 7.0.0-alpha15" type="baseline" client="cli" name="Lint" variant="all" version="7.0.0-alpha15">
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.room.CoroutinesRoom is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" cancellationSignal.cancel()"
+ errorLine2=" ~~~~~~">
+ <location
+ file="src/main/java/androidx/room/CoroutinesRoom.kt"
+ line="93"
+ column="44"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.room.CoroutinesRoom.Companion is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" cancellationSignal.cancel()"
+ errorLine2=" ~~~~~~">
+ <location
+ file="src/main/java/androidx/room/CoroutinesRoom.kt"
+ line="93"
+ column="44"/>
+ </issue>
+
</issues>
diff --git a/room/ktx/src/main/java/androidx/room/CoroutinesRoom.kt b/room/ktx/src/main/java/androidx/room/CoroutinesRoom.kt
index 8a71fe9..f45d8e5 100644
--- a/room/ktx/src/main/java/androidx/room/CoroutinesRoom.kt
+++ b/room/ktx/src/main/java/androidx/room/CoroutinesRoom.kt
@@ -19,7 +19,6 @@
import android.os.Build
import android.os.CancellationSignal
import androidx.annotation.RestrictTo
-import androidx.sqlite.db.SupportSQLiteCompat
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.asCoroutineDispatcher
@@ -91,7 +90,7 @@
}
continuation.invokeOnCancellation {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- SupportSQLiteCompat.Api16Impl.cancel(cancellationSignal)
+ cancellationSignal.cancel()
}
job.cancel()
}
diff --git a/room/runtime/build.gradle b/room/runtime/build.gradle
index a1c2f8a..1740d3c 100644
--- a/room/runtime/build.gradle
+++ b/room/runtime/build.gradle
@@ -37,8 +37,8 @@
dependencies {
api(project(":room:room-common"))
- api(project(":sqlite:sqlite-framework"))
- api(project(":sqlite:sqlite"))
+ api("androidx.sqlite:sqlite-framework:2.1.0")
+ api("androidx.sqlite:sqlite:2.1.0")
implementation("androidx.arch.core:core-runtime:2.0.1")
compileOnly("androidx.paging:paging-common:2.0.0")
compileOnly("androidx.lifecycle:lifecycle-livedata-core:2.0.0")
diff --git a/room/runtime/lint-baseline.xml b/room/runtime/lint-baseline.xml
index cd534ae..32d1bdf 100644
--- a/room/runtime/lint-baseline.xml
+++ b/room/runtime/lint-baseline.xml
@@ -57,6 +57,72 @@
</issue>
<issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 29; however, the containing class androidx.room.AutoClosingRoomOpenHelper.KeepAliveCursor is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" mDelegate.setNotificationUris(cr, uris);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/room/AutoClosingRoomOpenHelper.java"
+ line="706"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 19; however, the containing class androidx.room.AutoClosingRoomOpenHelper.KeepAliveCursor is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" return mDelegate.getNotificationUri();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/room/AutoClosingRoomOpenHelper.java"
+ line="713"
+ column="30"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 29; however, the containing class androidx.room.AutoClosingRoomOpenHelper.KeepAliveCursor is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" return mDelegate.getNotificationUris();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/room/AutoClosingRoomOpenHelper.java"
+ line="721"
+ column="30"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 23; however, the containing class androidx.room.AutoClosingRoomOpenHelper.KeepAliveCursor is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" mDelegate.setExtras(extras);"
+ errorLine2=" ~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/room/AutoClosingRoomOpenHelper.java"
+ line="733"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.room.util.DBUtil is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" return new CancellationSignal();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/room/util/DBUtil.java"
+ line="168"
+ column="20"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 19; however, the containing class androidx.room.RoomDatabase.JournalMode is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" return activityManager.isLowRamDevice();"
+ errorLine2=" ~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/room/RoomDatabase.java"
+ line="782"
+ column="40"/>
+ </issue>
+
+ <issue
id="PrivateConstructorForUtilityClass"
message="Utility class is missing private constructor"
errorLine1="public class Room {"
diff --git a/room/runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.java b/room/runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.java
index 430df67..b3a3853 100644
--- a/room/runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.java
+++ b/room/runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.java
@@ -36,7 +36,6 @@
import androidx.annotation.RequiresApi;
import androidx.arch.core.util.Function;
import androidx.room.util.SneakyThrow;
-import androidx.sqlite.db.SupportSQLiteCompat;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import androidx.sqlite.db.SupportSQLiteQuery;
@@ -704,14 +703,14 @@
@Override
public void setNotificationUris(@NonNull ContentResolver cr,
@NonNull List<Uri> uris) {
- SupportSQLiteCompat.Api29Impl.setNotificationUris(mDelegate, cr, uris);
+ mDelegate.setNotificationUris(cr, uris);
}
@SuppressLint("UnsafeNewApiCall")
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public Uri getNotificationUri() {
- return SupportSQLiteCompat.Api19Impl.getNotificationUri(mDelegate);
+ return mDelegate.getNotificationUri();
}
@SuppressLint("UnsafeNewApiCall")
@@ -719,7 +718,7 @@
@Nullable
@Override
public List<Uri> getNotificationUris() {
- return SupportSQLiteCompat.Api29Impl.getNotificationUris(mDelegate);
+ return mDelegate.getNotificationUris();
}
@Override
@@ -731,7 +730,7 @@
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void setExtras(Bundle extras) {
- SupportSQLiteCompat.Api23Impl.setExtras(mDelegate, extras);
+ mDelegate.setExtras(extras);
}
@Override
diff --git a/room/runtime/src/main/java/androidx/room/RoomDatabase.java b/room/runtime/src/main/java/androidx/room/RoomDatabase.java
index 0de4563..3c79716 100644
--- a/room/runtime/src/main/java/androidx/room/RoomDatabase.java
+++ b/room/runtime/src/main/java/androidx/room/RoomDatabase.java
@@ -37,7 +37,6 @@
import androidx.room.migration.Migration;
import androidx.room.util.SneakyThrow;
import androidx.sqlite.db.SimpleSQLiteQuery;
-import androidx.sqlite.db.SupportSQLiteCompat;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import androidx.sqlite.db.SupportSQLiteQuery;
@@ -735,7 +734,7 @@
/**
* Journal modes for SQLite database.
*
- * @see Builder#setJournalMode(JournalMode)
+ * @see RoomDatabase.Builder#setJournalMode(JournalMode)
*/
public enum JournalMode {
@@ -780,7 +779,7 @@
private static boolean isLowRamDevice(@NonNull ActivityManager activityManager) {
if (Build.VERSION.SDK_INT >= 19) {
- return SupportSQLiteCompat.Api19Impl.isLowRamDevice(activityManager);
+ return activityManager.isLowRamDevice();
}
return false;
}
diff --git a/room/runtime/src/main/java/androidx/room/util/DBUtil.java b/room/runtime/src/main/java/androidx/room/util/DBUtil.java
index c5014ae..1b9b866 100644
--- a/room/runtime/src/main/java/androidx/room/util/DBUtil.java
+++ b/room/runtime/src/main/java/androidx/room/util/DBUtil.java
@@ -25,7 +25,6 @@
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.room.RoomDatabase;
-import androidx.sqlite.db.SupportSQLiteCompat;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteQuery;
@@ -166,7 +165,7 @@
@Nullable
public static CancellationSignal createCancellationSignal() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- return SupportSQLiteCompat.Api16Impl.createCancellationSignal();
+ return new CancellationSignal();
}
return null;
}
diff --git a/sqlite/sqlite-framework/lint-baseline.xml b/sqlite/sqlite-framework/lint-baseline.xml
index 6603aec..06f5edc 100644
--- a/sqlite/sqlite-framework/lint-baseline.xml
+++ b/sqlite/sqlite-framework/lint-baseline.xml
@@ -34,4 +34,81 @@
column="9"/>
</issue>
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.sqlite.db.framework.FrameworkSQLiteDatabase is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" return mDelegate.rawQueryWithFactory(new SQLiteDatabase.CursorFactory() {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java"
+ line="195"
+ column="26"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.sqlite.db.framework.FrameworkSQLiteDatabase is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" mDelegate.setForeignKeyConstraintsEnabled(enable);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java"
+ line="303"
+ column="19"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.sqlite.db.framework.FrameworkSQLiteDatabase is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" mDelegate.disableWriteAheadLogging();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java"
+ line="314"
+ column="19"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.sqlite.db.framework.FrameworkSQLiteDatabase is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" return mDelegate.isWriteAheadLoggingEnabled();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java"
+ line="320"
+ column="26"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 21; however, the containing class androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" File file = new File(mContext.getNoBackupFilesDir(), mName);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.java"
+ line="75"
+ column="51"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" mDelegate.setWriteAheadLoggingEnabled(mWriteAheadLoggingEnabled);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.java"
+ line="81"
+ column="31"/>
+ </issue>
+
+ <issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" mDelegate.setWriteAheadLoggingEnabled(enabled);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.java"
+ line="98"
+ column="27"/>
+ </issue>
+
</issues>
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java
index 7e14997..c75894e 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.java
@@ -32,9 +32,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-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;
@@ -191,18 +189,17 @@
}
@Override
- @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+ @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public Cursor query(final SupportSQLiteQuery supportQuery,
CancellationSignal cancellationSignal) {
- return SupportSQLiteCompat.Api16Impl.rawQueryWithFactory(mDelegate, supportQuery.getSql(),
- EMPTY_STRING_ARRAY, null, cancellationSignal, new SQLiteDatabase.CursorFactory() {
- @Override
- public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery,
- String editTable, SQLiteQuery query) {
- supportQuery.bindTo(new FrameworkSQLiteProgram(query));
- return new SQLiteCursor(masterQuery, editTable, query);
- }
- });
+ return mDelegate.rawQueryWithFactory(new SQLiteDatabase.CursorFactory() {
+ @Override
+ public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery,
+ String editTable, SQLiteQuery query) {
+ supportQuery.bindTo(new FrameworkSQLiteProgram(query));
+ return new SQLiteCursor(masterQuery, editTable, query);
+ }
+ }, supportQuery.getSql(), EMPTY_STRING_ARRAY, null, cancellationSignal);
}
@Override
@@ -301,9 +298,9 @@
}
@Override
- @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+ @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public void setForeignKeyConstraintsEnabled(boolean enable) {
- SupportSQLiteCompat.Api16Impl.setForeignKeyConstraintsEnabled(mDelegate, enable);
+ mDelegate.setForeignKeyConstraintsEnabled(enable);
}
@Override
@@ -312,15 +309,15 @@
}
@Override
- @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+ @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public void disableWriteAheadLogging() {
- SupportSQLiteCompat.Api16Impl.disableWriteAheadLogging(mDelegate);
+ mDelegate.disableWriteAheadLogging();
}
@Override
- @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+ @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public boolean isWriteAheadLoggingEnabled() {
- return SupportSQLiteCompat.Api16Impl.isWriteAheadLoggingEnabled(mDelegate);
+ return mDelegate.isWriteAheadLoggingEnabled();
}
@Override
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.java b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.java
index cc9415b..a457b14 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.java
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.java
@@ -22,8 +22,6 @@
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Build;
-import androidx.annotation.RequiresApi;
-import androidx.sqlite.db.SupportSQLiteCompat;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
@@ -74,17 +72,13 @@
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& mName != null
&& mUseNoBackupDirectory) {
- File file = new File(
- SupportSQLiteCompat.Api21Impl.getNoBackupFilesDir(mContext),
- mName
- );
+ File file = new File(mContext.getNoBackupFilesDir(), mName);
mDelegate = new OpenHelper(mContext, file.getAbsolutePath(), dbRef, mCallback);
} else {
mDelegate = new OpenHelper(mContext, mName, dbRef, mCallback);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- SupportSQLiteCompat.Api16Impl.setWriteAheadLoggingEnabled(mDelegate,
- mWriteAheadLoggingEnabled);
+ mDelegate.setWriteAheadLoggingEnabled(mWriteAheadLoggingEnabled);
}
}
return mDelegate;
@@ -97,11 +91,11 @@
}
@Override
- @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+ @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public void setWriteAheadLoggingEnabled(boolean enabled) {
synchronized (mLock) {
if (mDelegate != null) {
- SupportSQLiteCompat.Api16Impl.setWriteAheadLoggingEnabled(mDelegate, enabled);
+ mDelegate.setWriteAheadLoggingEnabled(enabled);
}
mWriteAheadLoggingEnabled = enabled;
}
diff --git a/sqlite/sqlite/lint-baseline.xml b/sqlite/sqlite/lint-baseline.xml
index 1c02a16..f4df559 100644
--- a/sqlite/sqlite/lint-baseline.xml
+++ b/sqlite/sqlite/lint-baseline.xml
@@ -2,6 +2,17 @@
<issues format="6" by="lint 7.0.0-alpha15" type="baseline" client="cli" name="Lint" variant="all" version="7.0.0-alpha15">
<issue
+ id="ClassVerificationFailure"
+ message="This call references a method added in API level 16; however, the containing class androidx.sqlite.db.SupportSQLiteOpenHelper.Callback is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" SQLiteDatabase.deleteDatabase(new File(fileName));"
+ errorLine2=" ~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.java"
+ line="284"
+ column="36"/>
+ </issue>
+
+ <issue
id="UnknownNullness"
message="Unknown nullability; explicitly declare as `@Nullable` or `@NonNull` to improve Kotlin interoperability; see https://android.github.io/kotlin-guides/interop.html#nullability-annotations"
errorLine1=" public SimpleSQLiteQuery(String query, @Nullable Object[] bindArgs) {"
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.java b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.java
deleted file mode 100644
index 286d449..0000000
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.sqlite.db;
-
-import android.app.ActivityManager;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.database.ContentObserver;
-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 android.os.OperationCanceledException;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.RequiresApi;
-import androidx.annotation.RestrictTo;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * Helper for accessing features in {@link SupportSQLiteOpenHelper}.
- *
- * @hide
- */
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-public final class SupportSQLiteCompat {
- private SupportSQLiteCompat() { }
- /**
- * Class for accessing functions that require SDK version 16 and higher.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @RequiresApi(16)
- public static final class Api16Impl {
-
- /**
- * Cancels the operation and signals the cancellation listener. If the operation has not yet
- * started, then it will be canceled as soon as it does.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static void cancel(@NonNull CancellationSignal cancellationSignal) {
- cancellationSignal.cancel();
- }
-
- /**
- * Creates a cancellation signal, initially not canceled.
- *
- * @return a new cancellation signal
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @NonNull
- public static CancellationSignal createCancellationSignal() {
- return new CancellationSignal();
- }
-
- /**
- * Deletes a database including its journal file and other auxiliary files
- * that may have been created by the database engine.
- *
- * @param file The database file path.
- * @return True if the database was successfully deleted.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @SuppressWarnings("StreamFiles")
- public static boolean deleteDatabase(@NonNull File file) {
- return SQLiteDatabase.deleteDatabase(file);
- }
-
- /**
- * Runs the provided SQL and returns a cursor over the result set.
- *
- * @param sql the SQL query. The SQL string must not be ; terminated
- * @param selectionArgs You may include ?s in where clause in the query,
- * which will be replaced by the values from selectionArgs. The
- * values will be bound as Strings.
- * @param editTable the name of the first table, which is editable
- * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
- * If the operation is canceled, then {@link OperationCanceledException} will be thrown
- * when the query is executed.
- * @param cursorFactory the cursor factory to use, or null for the default factory
- * @return A {@link Cursor} object, which is positioned before the first entry. Note that
- * {@link Cursor}s are not synchronized, see the documentation for more details.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @NonNull
- public static Cursor rawQueryWithFactory(@NonNull SQLiteDatabase sQLiteDatabase,
- @NonNull String sql, @NonNull String[] selectionArgs,
- @NonNull String editTable, @NonNull CancellationSignal cancellationSignal,
- @NonNull SQLiteDatabase.CursorFactory cursorFactory) {
- return sQLiteDatabase.rawQueryWithFactory(cursorFactory, sql, selectionArgs, editTable,
- cancellationSignal);
- }
-
- /**
- * Sets whether foreign key constraints are enabled for the database.
- *
- * @param enable True to enable foreign key constraints, false to disable them.
- *
- * @throws IllegalStateException if the are transactions is in progress
- * when this method is called.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static void setForeignKeyConstraintsEnabled(@NonNull SQLiteDatabase sQLiteDatabase,
- boolean enable) {
- sQLiteDatabase.setForeignKeyConstraintsEnabled(enable);
- }
-
- /**
- * This method disables the features enabled by
- * {@link SQLiteDatabase#enableWriteAheadLogging()}.
- *
- * @throws IllegalStateException if there are transactions in progress at the
- * time this method is called. WAL mode can only be changed when there are no
- * transactions in progress.
- *
- * @see SQLiteDatabase#enableWriteAheadLogging
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static void disableWriteAheadLogging(@NonNull SQLiteDatabase sQLiteDatabase) {
- sQLiteDatabase.disableWriteAheadLogging();
- }
-
- /**
- * Returns true if write-ahead logging has been enabled for this database.
- *
- * @return True if write-ahead logging has been enabled for this database.
- *
- * @see SQLiteDatabase#enableWriteAheadLogging
- * @see SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static boolean isWriteAheadLoggingEnabled(@NonNull SQLiteDatabase sQLiteDatabase) {
- return sQLiteDatabase.isWriteAheadLoggingEnabled();
- }
-
- /**
- * Sets {@link SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING} flag if {@code enabled} is {@code
- * true}, unsets otherwise.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static void setWriteAheadLoggingEnabled(@NonNull SQLiteOpenHelper sQLiteOpenHelper,
- boolean enabled) {
- sQLiteOpenHelper.setWriteAheadLoggingEnabled(enabled);
- }
-
- private Api16Impl() {}
- }
-
- /**
- * Helper for accessing functions that require SDK version 19 and higher.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @RequiresApi(19)
- public static final class Api19Impl {
- /**
- * Return the URI at which notifications of changes in this Cursor's data
- * will be delivered.
- *
- * @return Returns a URI that can be used with
- * {@link ContentResolver#registerContentObserver(android.net.Uri, boolean, ContentObserver)
- * ContentResolver.registerContentObserver} to find out about changes to this Cursor's
- * data. May be null if no notification URI has been set.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @NonNull
- public static Uri getNotificationUri(@NonNull Cursor cursor) {
- return cursor.getNotificationUri();
- }
-
-
- /**
- * Returns true if this is a low-RAM device. Exactly whether a device is low-RAM
- * is ultimately up to the device configuration, but currently it generally means
- * something with 1GB or less of RAM. This is mostly intended to be used by apps
- * to determine whether they should turn off certain features that require more RAM.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static boolean isLowRamDevice(@NonNull ActivityManager activityManager) {
- return activityManager.isLowRamDevice();
- }
-
- private Api19Impl() {}
- }
-
- /**
- * Helper for accessing functions that require SDK version 21 and higher.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @RequiresApi(21)
- public static final class Api21Impl {
-
- /**
- * Returns the absolute path to the directory on the filesystem.
- *
- * @return The path of the directory holding application files that will not
- * be automatically backed up to remote storage.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @NonNull
- public static File getNoBackupFilesDir(@NonNull Context context) {
- return context.getNoBackupFilesDir();
- }
-
- private Api21Impl() {}
- }
-
- /**
- * Helper for accessing functions that require SDK version 23 and higher.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @RequiresApi(23)
- public static final class Api23Impl {
-
- /**
- * Sets a {@link Bundle} that will be returned by {@link Cursor#getExtras()}.
- *
- * @param extras {@link Bundle} to set, or null to set an empty bundle.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static void setExtras(@NonNull Cursor cursor, @NonNull Bundle extras) {
- cursor.setExtras(extras);
- }
-
- private Api23Impl() {}
- }
-
- /**
- * Helper for accessing functions that require SDK version 29 and higher.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @RequiresApi(29)
- public static final class Api29Impl {
-
- /**
- * Similar to {@link Cursor#setNotificationUri(ContentResolver, Uri)}, except this version
- * allows to watch multiple content URIs for changes.
- *
- * @param cr The content resolver from the caller's context. The listener attached to
- * this resolver will be notified.
- * @param uris The content URIs to watch.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- public static void setNotificationUris(@NonNull Cursor cursor, @NonNull ContentResolver cr,
- @NonNull List<Uri> uris) {
- cursor.setNotificationUris(cr, uris);
- }
-
- /**
- * Return the URIs at which notifications of changes in this Cursor's data
- * will be delivered, as previously set by {@link #setNotificationUris}.
- *
- * @return Returns URIs that can be used with
- * {@link ContentResolver#registerContentObserver(android.net.Uri, boolean, ContentObserver)
- * ContentResolver.registerContentObserver} to find out about changes to this Cursor's
- * data. May be null if no notification URI has been set.
- *
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- @NonNull
- public static List<Uri> getNotificationUris(@NonNull Cursor cursor) {
- return cursor.getNotificationUris();
- }
-
- private Api29Impl() {}
- }
-
-}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.java b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.java
index 0123606..f39b07c 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.java
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.java
@@ -17,8 +17,8 @@
package androidx.sqlite.db;
import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
-import android.database.sqlite.SQLiteOpenHelper;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
@@ -109,16 +109,16 @@
/**
* Handles various lifecycle events for the SQLite connection, similar to
- * {@link SQLiteOpenHelper}.
+ * {@link android.database.sqlite.SQLiteOpenHelper}.
*/
@SuppressWarnings({"unused", "WeakerAccess"})
abstract class Callback {
private static final String TAG = "SupportSQLite";
/**
* Version number of the database (starting at 1); if the database is older,
- * {@link Callback#onUpgrade(SupportSQLiteDatabase, int, int)}
+ * {@link SupportSQLiteOpenHelper.Callback#onUpgrade(SupportSQLiteDatabase, int, int)}
* will be used to upgrade the database; if the database is newer,
- * {@link Callback#onDowngrade(SupportSQLiteDatabase, int, int)}
+ * {@link SupportSQLiteOpenHelper.Callback#onDowngrade(SupportSQLiteDatabase, int, int)}
* will be used to downgrade the database.
*/
public final int version;
@@ -281,7 +281,7 @@
Log.w(TAG, "deleting the database file: " + fileName);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- SupportSQLiteCompat.Api16Impl.deleteDatabase(new File(fileName));
+ SQLiteDatabase.deleteDatabase(new File(fileName));
} else {
try {
final boolean deleted = new File(fileName).delete();