Merge "Fix suppressed lint checks for "ClassVerificationFailure"." into androidx-main
diff --git a/room/guava/lint-baseline.xml b/room/guava/lint-baseline.xml
index e3459e6..0f84c67 100644
--- a/room/guava/lint-baseline.xml
+++ b/room/guava/lint-baseline.xml
@@ -2,17 +2,6 @@
 <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, &quot;callable&quot;, 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 5993cfe..97e8e91 100644
--- a/room/guava/src/main/java/androidx/room/guava/GuavaRoom.java
+++ b/room/guava/src/main/java/androidx/room/guava/GuavaRoom.java
@@ -26,6 +26,7 @@
 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;
 
@@ -122,7 +123,7 @@
                 @Override
                 public void run() {
                     if (future.isCancelled()) {
-                        cancellationSignal.cancel();
+                        SupportSQLiteCompat.Api16Impl.cancel(cancellationSignal);
                     }
                 }
             }, sDirectExecutor);
diff --git a/room/ktx/lint-baseline.xml b/room/ktx/lint-baseline.xml
index 17243415..42a176b 100644
--- a/room/ktx/lint-baseline.xml
+++ b/room/ktx/lint-baseline.xml
@@ -1,26 +1,4 @@
 <?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 f45d8e5..8a71fe9 100644
--- a/room/ktx/src/main/java/androidx/room/CoroutinesRoom.kt
+++ b/room/ktx/src/main/java/androidx/room/CoroutinesRoom.kt
@@ -19,6 +19,7 @@
 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
@@ -90,7 +91,7 @@
                 }
                 continuation.invokeOnCancellation {
                     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
-                        cancellationSignal.cancel()
+                        SupportSQLiteCompat.Api16Impl.cancel(cancellationSignal)
                     }
                     job.cancel()
                 }
diff --git a/room/runtime/build.gradle b/room/runtime/build.gradle
index 1740d3c..a1c2f8a 100644
--- a/room/runtime/build.gradle
+++ b/room/runtime/build.gradle
@@ -37,8 +37,8 @@
 
 dependencies {
     api(project(":room:room-common"))
-    api("androidx.sqlite:sqlite-framework:2.1.0")
-    api("androidx.sqlite:sqlite:2.1.0")
+    api(project(":sqlite:sqlite-framework"))
+    api(project(":sqlite:sqlite"))
     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 32d1bdf..cd534ae 100644
--- a/room/runtime/lint-baseline.xml
+++ b/room/runtime/lint-baseline.xml
@@ -57,72 +57,6 @@
     </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 b3a3853..430df67 100644
--- a/room/runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.java
+++ b/room/runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.java
@@ -36,6 +36,7 @@
 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;
@@ -703,14 +704,14 @@
         @Override
         public void setNotificationUris(@NonNull ContentResolver cr,
                 @NonNull List<Uri> uris) {
-            mDelegate.setNotificationUris(cr, uris);
+            SupportSQLiteCompat.Api29Impl.setNotificationUris(mDelegate, cr, uris);
         }
 
         @SuppressLint("UnsafeNewApiCall")
         @RequiresApi(api = Build.VERSION_CODES.KITKAT)
         @Override
         public Uri getNotificationUri() {
-            return mDelegate.getNotificationUri();
+            return SupportSQLiteCompat.Api19Impl.getNotificationUri(mDelegate);
         }
 
         @SuppressLint("UnsafeNewApiCall")
@@ -718,7 +719,7 @@
         @Nullable
         @Override
         public List<Uri> getNotificationUris() {
-            return mDelegate.getNotificationUris();
+            return SupportSQLiteCompat.Api29Impl.getNotificationUris(mDelegate);
         }
 
         @Override
@@ -730,7 +731,7 @@
         @RequiresApi(api = Build.VERSION_CODES.M)
         @Override
         public void setExtras(Bundle extras) {
-            mDelegate.setExtras(extras);
+            SupportSQLiteCompat.Api23Impl.setExtras(mDelegate, 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 3c79716..0de4563 100644
--- a/room/runtime/src/main/java/androidx/room/RoomDatabase.java
+++ b/room/runtime/src/main/java/androidx/room/RoomDatabase.java
@@ -37,6 +37,7 @@
 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;
@@ -734,7 +735,7 @@
     /**
      * Journal modes for SQLite database.
      *
-     * @see RoomDatabase.Builder#setJournalMode(JournalMode)
+     * @see Builder#setJournalMode(JournalMode)
      */
     public enum JournalMode {
 
@@ -779,7 +780,7 @@
 
         private static boolean isLowRamDevice(@NonNull ActivityManager activityManager) {
             if (Build.VERSION.SDK_INT >= 19) {
-                return activityManager.isLowRamDevice();
+                return SupportSQLiteCompat.Api19Impl.isLowRamDevice(activityManager);
             }
             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 1b9b866..c5014ae 100644
--- a/room/runtime/src/main/java/androidx/room/util/DBUtil.java
+++ b/room/runtime/src/main/java/androidx/room/util/DBUtil.java
@@ -25,6 +25,7 @@
 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;
 
@@ -165,7 +166,7 @@
     @Nullable
     public static CancellationSignal createCancellationSignal() {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
-            return new CancellationSignal();
+            return SupportSQLiteCompat.Api16Impl.createCancellationSignal();
         }
         return null;
     }
diff --git a/sqlite/sqlite-framework/lint-baseline.xml b/sqlite/sqlite-framework/lint-baseline.xml
index 06f5edc..6603aec 100644
--- a/sqlite/sqlite-framework/lint-baseline.xml
+++ b/sqlite/sqlite-framework/lint-baseline.xml
@@ -34,81 +34,4 @@
             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 c75894e..7e14997 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,7 +32,9 @@
 
 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;
@@ -189,17 +191,18 @@
     }
 
     @Override
-    @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
     public Cursor query(final SupportSQLiteQuery supportQuery,
             CancellationSignal cancellationSignal) {
-        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);
+        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);
+                    }
+                });
     }
 
     @Override
@@ -298,9 +301,9 @@
     }
 
     @Override
-    @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
     public void setForeignKeyConstraintsEnabled(boolean enable) {
-        mDelegate.setForeignKeyConstraintsEnabled(enable);
+        SupportSQLiteCompat.Api16Impl.setForeignKeyConstraintsEnabled(mDelegate, enable);
     }
 
     @Override
@@ -309,15 +312,15 @@
     }
 
     @Override
-    @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
     public void disableWriteAheadLogging() {
-        mDelegate.disableWriteAheadLogging();
+        SupportSQLiteCompat.Api16Impl.disableWriteAheadLogging(mDelegate);
     }
 
     @Override
-    @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
     public boolean isWriteAheadLoggingEnabled() {
-        return mDelegate.isWriteAheadLoggingEnabled();
+        return SupportSQLiteCompat.Api16Impl.isWriteAheadLoggingEnabled(mDelegate);
     }
 
     @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 a457b14..cc9415b 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,6 +22,8 @@
 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;
 
@@ -72,13 +74,17 @@
                 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
                         && mName != null
                         && mUseNoBackupDirectory) {
-                    File file = new File(mContext.getNoBackupFilesDir(), mName);
+                    File file = new File(
+                            SupportSQLiteCompat.Api21Impl.getNoBackupFilesDir(mContext),
+                            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) {
-                    mDelegate.setWriteAheadLoggingEnabled(mWriteAheadLoggingEnabled);
+                    SupportSQLiteCompat.Api16Impl.setWriteAheadLoggingEnabled(mDelegate,
+                            mWriteAheadLoggingEnabled);
                 }
             }
             return mDelegate;
@@ -91,11 +97,11 @@
     }
 
     @Override
-    @androidx.annotation.RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
+    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
     public void setWriteAheadLoggingEnabled(boolean enabled) {
         synchronized (mLock) {
             if (mDelegate != null) {
-                mDelegate.setWriteAheadLoggingEnabled(enabled);
+                SupportSQLiteCompat.Api16Impl.setWriteAheadLoggingEnabled(mDelegate, enabled);
             }
             mWriteAheadLoggingEnabled = enabled;
         }
diff --git a/sqlite/sqlite/lint-baseline.xml b/sqlite/sqlite/lint-baseline.xml
index f4df559..1c02a16 100644
--- a/sqlite/sqlite/lint-baseline.xml
+++ b/sqlite/sqlite/lint-baseline.xml
@@ -2,17 +2,6 @@
 <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
new file mode 100644
index 0000000..286d449
--- /dev/null
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.java
@@ -0,0 +1,321 @@
+/*
+ * 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 f39b07c..0123606 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 android.database.sqlite.SQLiteOpenHelper}.
+     * {@link 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 SupportSQLiteOpenHelper.Callback#onUpgrade(SupportSQLiteDatabase, int, int)}
+         * {@link Callback#onUpgrade(SupportSQLiteDatabase, int, int)}
          * will be used to upgrade the database; if the database is newer,
-         * {@link SupportSQLiteOpenHelper.Callback#onDowngrade(SupportSQLiteDatabase, int, int)}
+         * {@link 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) {
-                    SQLiteDatabase.deleteDatabase(new File(fileName));
+                    SupportSQLiteCompat.Api16Impl.deleteDatabase(new File(fileName));
                 } else {
                     try {
                         final boolean deleted = new File(fileName).delete();