Merge "Revert "Add an open() overload that receives open flags to bundled driver."" into androidx-main am: 45d98ad557

Original change: https://android-review.googlesource.com/c/platform/frameworks/support/+/3110024

Change-Id: Ia97b40229c8bb3b400b1de804f94a8e936807dbc
Signed-off-by: Automerger Merge Worker 
diff --git a/sqlite/integration-tests/driver-conformance-test/build.gradle b/sqlite/integration-tests/driver-conformance-test/build.gradle
index fd7b912..cd02e2c 100644
--- a/sqlite/integration-tests/driver-conformance-test/build.gradle
+++ b/sqlite/integration-tests/driver-conformance-test/build.gradle
@@ -40,10 +40,8 @@
         commonTest {
             dependencies {
                 implementation(project(":sqlite:sqlite"))
-                implementation(project(":sqlite:sqlite-bundled"))
                 implementation(libs.kotlinStdlib)
                 implementation(libs.kotlinTest)
-                implementation(libs.kotlinCoroutinesTest)
                 implementation(project(":kruth:kruth"))
             }
         }
@@ -51,6 +49,8 @@
             dependsOn(commonTest)
             dependencies {
                 implementation(project(":sqlite:sqlite-framework"))
+                implementation(project(":sqlite:sqlite-bundled"))
+
                 implementation(libs.kotlinTestJunit)
                 implementation(libs.testRunner)
                 implementation(libs.testCore)
@@ -59,6 +59,8 @@
         jvmTest {
             dependsOn(commonTest)
             dependencies {
+                implementation(project(":sqlite:sqlite-bundled"))
+
                 implementation(libs.kotlinTestJunit)
             }
         }
@@ -66,6 +68,7 @@
             dependsOn(commonTest)
             dependencies {
                 implementation(project(":sqlite:sqlite-framework"))
+                implementation(project(":sqlite:sqlite-bundled"))
             }
         }
         targets.configureEach { target ->
diff --git a/sqlite/integration-tests/driver-conformance-test/src/androidInstrumentedTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt b/sqlite/integration-tests/driver-conformance-test/src/androidInstrumentedTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
index fca79a9..1772073 100644
--- a/sqlite/integration-tests/driver-conformance-test/src/androidInstrumentedTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
+++ b/sqlite/integration-tests/driver-conformance-test/src/androidInstrumentedTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
@@ -16,38 +16,14 @@
 
 package androidx.sqlite.driver.test
 
-import androidx.kruth.assertThat
+import androidx.sqlite.SQLiteDriver
 import androidx.sqlite.driver.bundled.BundledSQLiteDriver
-import androidx.test.platform.app.InstrumentationRegistry
-import kotlin.test.AfterTest
-import kotlin.test.BeforeTest
 
 class BundledSQLiteDriverTest : BaseBundledConformanceTest() {
 
-    private val instrumentation = InstrumentationRegistry.getInstrumentation()
-    private val file = instrumentation.targetContext.getDatabasePath("test.db")
-
     override val driverType = TestDriverType.BUNDLED
 
-    override fun getDatabaseFileName(): String = file.path
-
-    override fun getDriver(): BundledSQLiteDriver {
+    override fun getDriver(): SQLiteDriver {
         return BundledSQLiteDriver()
     }
-
-    @BeforeTest
-    fun before() {
-        assertThat(file).isNotNull()
-        file.parentFile?.mkdirs()
-        deleteDatabaseFile()
-    }
-
-    @AfterTest
-    fun after() {
-        deleteDatabaseFile()
-    }
-
-    private fun deleteDatabaseFile() {
-        instrumentation.targetContext.deleteDatabase(file.name)
-    }
 }
diff --git a/sqlite/integration-tests/driver-conformance-test/src/commonTest/kotlin/androidx/sqlite/driver/test/BaseBundledConformanceTest.kt b/sqlite/integration-tests/driver-conformance-test/src/commonTest/kotlin/androidx/sqlite/driver/test/BaseBundledConformanceTest.kt
index be8bf32..d7b5dcd7 100644
--- a/sqlite/integration-tests/driver-conformance-test/src/commonTest/kotlin/androidx/sqlite/driver/test/BaseBundledConformanceTest.kt
+++ b/sqlite/integration-tests/driver-conformance-test/src/commonTest/kotlin/androidx/sqlite/driver/test/BaseBundledConformanceTest.kt
@@ -17,25 +17,11 @@
 package androidx.sqlite.driver.test
 
 import androidx.kruth.assertThat
-import androidx.sqlite.driver.bundled.BundledSQLiteDriver
-import androidx.sqlite.driver.bundled.SQLITE_OPEN_CREATE
-import androidx.sqlite.driver.bundled.SQLITE_OPEN_FULLMUTEX
-import androidx.sqlite.driver.bundled.SQLITE_OPEN_READWRITE
-import androidx.sqlite.execSQL
 import androidx.sqlite.use
 import kotlin.test.Test
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.IO
-import kotlinx.coroutines.coroutineScope
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.test.runTest
 
 abstract class BaseBundledConformanceTest : BaseConformanceTest() {
 
-    abstract fun getDatabaseFileName(): String
-
-    abstract override fun getDriver(): BundledSQLiteDriver
-
     @Test
     fun readSQLiteVersion() {
         val connection = getDriver().open(":memory:")
@@ -51,35 +37,6 @@
         }
     }
 
-    @Test
-    fun openWithFullMutexFlag() = runTest {
-        val connection = getDriver().open(
-            fileName = getDatabaseFileName(),
-            flags = SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE or SQLITE_OPEN_FULLMUTEX
-        )
-        connection.execSQL("CREATE TABLE Test (col)")
-        // Concurrently use the connection, due to being opened with the full mutex flag, it should
-        // be safe.
-        coroutineScope {
-            repeat(20) { i ->
-                launch(Dispatchers.IO) {
-                    connection.prepare("INSERT INTO Test (col) VALUES (?)").use {
-                        it.bindInt(1, i)
-                        it.step()
-                    }
-                }
-            }
-        }
-        connection.close()
-    }
-
-    @Test
-    fun threadSafeMode() {
-        // Validate bundled SQLite is compiled with SQLITE_THREADSAFE = 2
-        val driver = BundledSQLiteDriver()
-        assertThat(driver.threadingMode).isEqualTo(2)
-    }
-
     companion object {
         const val EXPECTED_SQLITE_VERSION = "3.42.0"
     }
diff --git a/sqlite/integration-tests/driver-conformance-test/src/jvmTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt b/sqlite/integration-tests/driver-conformance-test/src/jvmTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
index d134a65..1772073 100644
--- a/sqlite/integration-tests/driver-conformance-test/src/jvmTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
+++ b/sqlite/integration-tests/driver-conformance-test/src/jvmTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
@@ -16,19 +16,14 @@
 
 package androidx.sqlite.driver.test
 
+import androidx.sqlite.SQLiteDriver
 import androidx.sqlite.driver.bundled.BundledSQLiteDriver
-import kotlin.io.path.createTempFile
-import kotlin.io.path.pathString
 
 class BundledSQLiteDriverTest : BaseBundledConformanceTest() {
 
     override val driverType = TestDriverType.BUNDLED
 
-    override fun getDatabaseFileName(): String {
-        return createTempFile("test.db").also { it.toFile().deleteOnExit() }.pathString
-    }
-
-    override fun getDriver(): BundledSQLiteDriver {
+    override fun getDriver(): SQLiteDriver {
         return BundledSQLiteDriver()
     }
 }
diff --git a/sqlite/integration-tests/driver-conformance-test/src/nativeTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt b/sqlite/integration-tests/driver-conformance-test/src/nativeTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
index e34f6dc..1772073 100644
--- a/sqlite/integration-tests/driver-conformance-test/src/nativeTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
+++ b/sqlite/integration-tests/driver-conformance-test/src/nativeTest/kotlin/androidx/sqlite/driver/test/BundledSQLiteDriverTest.kt
@@ -16,37 +16,14 @@
 
 package androidx.sqlite.driver.test
 
+import androidx.sqlite.SQLiteDriver
 import androidx.sqlite.driver.bundled.BundledSQLiteDriver
-import kotlin.random.Random
-import kotlin.test.AfterTest
-import kotlin.test.BeforeTest
-import platform.posix.remove
 
 class BundledSQLiteDriverTest : BaseBundledConformanceTest() {
 
-    private val filename = "/tmp/test-${Random.nextInt()}.db"
-
     override val driverType = TestDriverType.BUNDLED
 
-    override fun getDatabaseFileName(): String = filename
-
-    override fun getDriver(): BundledSQLiteDriver {
+    override fun getDriver(): SQLiteDriver {
         return BundledSQLiteDriver()
     }
-
-    @BeforeTest
-    fun before() {
-        deleteDatabaseFile()
-    }
-
-    @AfterTest
-    fun after() {
-        deleteDatabaseFile()
-    }
-
-    private fun deleteDatabaseFile() {
-        remove(filename)
-        remove("$filename-wal")
-        remove("$filename-shm")
-    }
 }
diff --git a/sqlite/sqlite-bundled/api/api_lint.ignore b/sqlite/sqlite-bundled/api/api_lint.ignore
index 499ebfc..2f12705f 100644
--- a/sqlite/sqlite-bundled/api/api_lint.ignore
+++ b/sqlite/sqlite-bundled/api/api_lint.ignore
@@ -1,5 +1,3 @@
 // Baseline format: 1.0
 AcronymName: androidx.sqlite.driver.bundled.BundledSQLiteDriver:
     Acronyms should not be capitalized in class names: was `BundledSQLiteDriver`, should this be `BundledSqLiteDriver`?
-AcronymName: androidx.sqlite.driver.bundled.BundledSQLiteKt:
-    Acronyms should not be capitalized in class names: was `BundledSQLiteKt`, should this be `BundledSqLiteKt`?
diff --git a/sqlite/sqlite-bundled/api/current.txt b/sqlite/sqlite-bundled/api/current.txt
index e7dfc96..a0f2650 100644
--- a/sqlite/sqlite-bundled/api/current.txt
+++ b/sqlite/sqlite-bundled/api/current.txt
@@ -4,18 +4,6 @@
   public final class BundledSQLiteDriver implements androidx.sqlite.SQLiteDriver {
     ctor public BundledSQLiteDriver();
     method public androidx.sqlite.SQLiteConnection open(String fileName);
-    method public androidx.sqlite.SQLiteConnection open(String fileName, int flags);
-  }
-
-  public final class BundledSQLiteKt {
-    field public static final int SQLITE_OPEN_CREATE = 4; // 0x4
-    field public static final int SQLITE_OPEN_FULLMUTEX = 65536; // 0x10000
-    field public static final int SQLITE_OPEN_MEMORY = 128; // 0x80
-    field public static final int SQLITE_OPEN_NOFOLLOW = 16777216; // 0x1000000
-    field public static final int SQLITE_OPEN_NOMUTEX = 32768; // 0x8000
-    field public static final int SQLITE_OPEN_READONLY = 1; // 0x1
-    field public static final int SQLITE_OPEN_READWRITE = 2; // 0x2
-    field public static final int SQLITE_OPEN_URI = 64; // 0x40
   }
 
 }
diff --git a/sqlite/sqlite-bundled/api/restricted_current.txt b/sqlite/sqlite-bundled/api/restricted_current.txt
index da05ac9..a0f2650 100644
--- a/sqlite/sqlite-bundled/api/restricted_current.txt
+++ b/sqlite/sqlite-bundled/api/restricted_current.txt
@@ -3,21 +3,7 @@
 
   public final class BundledSQLiteDriver implements androidx.sqlite.SQLiteDriver {
     ctor public BundledSQLiteDriver();
-    method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public int getThreadingMode();
     method public androidx.sqlite.SQLiteConnection open(String fileName);
-    method public androidx.sqlite.SQLiteConnection open(String fileName, int flags);
-    property @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final int threadingMode;
-  }
-
-  public final class BundledSQLiteKt {
-    field public static final int SQLITE_OPEN_CREATE = 4; // 0x4
-    field public static final int SQLITE_OPEN_FULLMUTEX = 65536; // 0x10000
-    field public static final int SQLITE_OPEN_MEMORY = 128; // 0x80
-    field public static final int SQLITE_OPEN_NOFOLLOW = 16777216; // 0x1000000
-    field public static final int SQLITE_OPEN_NOMUTEX = 32768; // 0x8000
-    field public static final int SQLITE_OPEN_READONLY = 1; // 0x1
-    field public static final int SQLITE_OPEN_READWRITE = 2; // 0x2
-    field public static final int SQLITE_OPEN_URI = 64; // 0x40
   }
 
 }
diff --git a/sqlite/sqlite-bundled/src/androidJvmCommonMain/jni/sqlite_bindings.cpp b/sqlite/sqlite-bundled/src/androidJvmCommonMain/jni/sqlite_bindings.cpp
index ffc8b89..da884f2 100644
--- a/sqlite/sqlite-bundled/src/androidJvmCommonMain/jni/sqlite_bindings.cpp
+++ b/sqlite/sqlite-bundled/src/androidJvmCommonMain/jni/sqlite_bindings.cpp
@@ -41,21 +41,14 @@
     return false;
 }
 
-extern "C" JNIEXPORT jint JNICALL
-Java_androidx_sqlite_driver_bundled_BundledSQLiteDriverKt_nativeThreadSafeMode(
-        JNIEnv* env,
-        jclass clazz) {
-    return sqlite3_threadsafe();
-}
-
 extern "C" JNIEXPORT jlong JNICALL
 Java_androidx_sqlite_driver_bundled_BundledSQLiteDriverKt_nativeOpen(
         JNIEnv* env,
         jclass clazz,
-        jstring name,
-        int openFlags) {
+        jstring name) {
     const char *path = env->GetStringUTFChars(name, nullptr);
     sqlite3 *db;
+    int openFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
     int rc = sqlite3_open_v2(path, &db, openFlags, nullptr);
     env->ReleaseStringUTFChars(name, path);
     if (rc != SQLITE_OK) {
diff --git a/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.androidJvmCommon.kt b/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.androidJvmCommon.kt
index 4ec65dc..7708fba 100644
--- a/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.androidJvmCommon.kt
+++ b/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.androidJvmCommon.kt
@@ -16,28 +16,6 @@
 
 package androidx.sqlite.driver.bundled
 
-import androidx.annotation.IntDef
-import androidx.annotation.RestrictTo
-
-/**
- * The flags constant that can be used with [BundledSQLiteDriver.open].
- */
-@IntDef(
-    flag = true,
-    value = [
-        SQLITE_OPEN_READONLY,
-        SQLITE_OPEN_READWRITE,
-        SQLITE_OPEN_CREATE,
-        SQLITE_OPEN_URI,
-        SQLITE_OPEN_MEMORY,
-        SQLITE_OPEN_NOMUTEX,
-        SQLITE_OPEN_FULLMUTEX,
-        SQLITE_OPEN_NOFOLLOW
-    ])
-@Retention(AnnotationRetention.SOURCE)
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-actual annotation class OpenFlag
-
 internal object ResultCode {
     const val SQLITE_MISUSE = 21
 }
diff --git a/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.androidJvmCommon.kt b/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.androidJvmCommon.kt
index 1f1bebd..22b981a 100644
--- a/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.androidJvmCommon.kt
+++ b/sqlite/sqlite-bundled/src/androidJvmCommonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.androidJvmCommon.kt
@@ -17,7 +17,6 @@
 
 package androidx.sqlite.driver.bundled
 
-import androidx.annotation.RestrictTo
 import androidx.sqlite.SQLiteConnection
 import androidx.sqlite.SQLiteDriver
 
@@ -27,31 +26,8 @@
  */
 // TODO(b/313895287): Explore usability of @FastNative and @CriticalNative for the external functions.
 actual class BundledSQLiteDriver : SQLiteDriver {
-
-    /**
-     * The thread safe mode SQLite was compiled with.
-     *
-     * See also [SQLite In Multi-Threaded Applications](https://www.sqlite.org/threadsafe.html)
-     */
-    @get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
-    actual val threadingMode: Int
-        get() = nativeThreadSafeMode()
-
     override fun open(fileName: String): SQLiteConnection {
-        return open(fileName, SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE)
-    }
-
-    /**
-     * Opens a new database connection.
-     *
-     * See also [Opening A New Database Connection](https://www.sqlite.org/c3ref/open.html)
-     *
-     * @param fileName Name of the database file.
-     * @param flags Connection open flags.
-     * @return the database connection.
-     */
-    actual fun open(fileName: String, @OpenFlag flags: Int): SQLiteConnection {
-        val address = nativeOpen(fileName, flags)
+        val address = nativeOpen(fileName)
         return BundledSQLiteConnection(address)
     }
 
@@ -62,5 +38,4 @@
     }
 }
 
-private external fun nativeThreadSafeMode(): Int
-private external fun nativeOpen(name: String, openFlags: Int): Long
+private external fun nativeOpen(name: String): Long
diff --git a/sqlite/sqlite-bundled/src/commonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.kt b/sqlite/sqlite-bundled/src/commonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.kt
deleted file mode 100644
index 5229a68..0000000
--- a/sqlite/sqlite-bundled/src/commonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2023 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.driver.bundled
-
-import androidx.annotation.IntDef
-import androidx.annotation.RestrictTo
-
-const val SQLITE_OPEN_READONLY = 0x00000001
-const val SQLITE_OPEN_READWRITE = 0x00000002
-const val SQLITE_OPEN_CREATE = 0x00000004
-const val SQLITE_OPEN_URI = 0x00000040
-const val SQLITE_OPEN_MEMORY = 0x00000080
-const val SQLITE_OPEN_NOMUTEX = 0x00008000
-const val SQLITE_OPEN_FULLMUTEX = 0x00010000
-const val SQLITE_OPEN_NOFOLLOW = 0x01000000
-
-/**
- * The flags constant that can be used with [BundledSQLiteDriver.open].
- */
-@IntDef(
-    flag = true,
-    value = [
-        SQLITE_OPEN_READONLY,
-        SQLITE_OPEN_READWRITE,
-        SQLITE_OPEN_CREATE,
-        SQLITE_OPEN_URI,
-        SQLITE_OPEN_MEMORY,
-        SQLITE_OPEN_NOMUTEX,
-        SQLITE_OPEN_FULLMUTEX,
-        SQLITE_OPEN_NOFOLLOW
-    ])
-@Retention(AnnotationRetention.SOURCE)
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-expect annotation class OpenFlag()
diff --git a/sqlite/sqlite-bundled/src/commonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.kt b/sqlite/sqlite-bundled/src/commonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.kt
index 3d64cfc..86e016cf 100644
--- a/sqlite/sqlite-bundled/src/commonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.kt
+++ b/sqlite/sqlite-bundled/src/commonMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteDriver.kt
@@ -16,32 +16,10 @@
 
 package androidx.sqlite.driver.bundled
 
-import androidx.annotation.RestrictTo
-import androidx.sqlite.SQLiteConnection
 import androidx.sqlite.SQLiteDriver
 
 /**
  * A [SQLiteDriver] that uses a bundled version of SQLite included as a native component of this
  * library.
  */
-expect class BundledSQLiteDriver() : SQLiteDriver {
-
-    /**
-     * The thread safe mode SQLite was compiled with.
-     *
-     * See also [SQLite In Multi-Threaded Applications](https://www.sqlite.org/threadsafe.html)
-     */
-    @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
-    val threadingMode: Int
-
-    /**
-     * Opens a new database connection.
-     *
-     * See also [Opening A New Database Connection](https://www.sqlite.org/c3ref/open.html)
-     *
-     * @param fileName Name of the database file.
-     * @param flags Connection open flags.
-     * @return the database connection.
-     */
-    fun open(fileName: String, @OpenFlag flags: Int): SQLiteConnection
-}
+expect class BundledSQLiteDriver() : SQLiteDriver
diff --git a/sqlite/sqlite-bundled/src/nativeMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.nativeCommon.kt b/sqlite/sqlite-bundled/src/nativeMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.nativeCommon.kt
deleted file mode 100644
index d3d1d5d..0000000
--- a/sqlite/sqlite-bundled/src/nativeMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLite.nativeCommon.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2023 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.driver.bundled
-
-actual typealias OpenFlag = androidx.sqlite.driver.OpenFlag
diff --git a/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLite.kt b/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLite.kt
index 9cd765d..6a7177f 100644
--- a/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLite.kt
+++ b/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLite.kt
@@ -18,43 +18,13 @@
 
 package androidx.sqlite.driver
 
-import androidx.annotation.IntDef
-import androidx.annotation.RestrictTo
 import cnames.structs.sqlite3
 import kotlinx.cinterop.CPointer
 import kotlinx.cinterop.UShortVar
 import kotlinx.cinterop.reinterpret
 import kotlinx.cinterop.toKStringFromUtf16
-import sqlite3.SQLITE_OPEN_CREATE
-import sqlite3.SQLITE_OPEN_FULLMUTEX
-import sqlite3.SQLITE_OPEN_MEMORY
-import sqlite3.SQLITE_OPEN_NOFOLLOW
-import sqlite3.SQLITE_OPEN_NOMUTEX
-import sqlite3.SQLITE_OPEN_READONLY
-import sqlite3.SQLITE_OPEN_READWRITE
-import sqlite3.SQLITE_OPEN_URI
 import sqlite3.sqlite3_errmsg16
 
-/**
- * The flags constant that can be used with [NativeSQLiteDriver.open].
- */
-@IntDef(
-    flag = true,
-    value = [
-        SQLITE_OPEN_READONLY,
-        SQLITE_OPEN_READWRITE,
-        SQLITE_OPEN_CREATE,
-        SQLITE_OPEN_URI,
-        SQLITE_OPEN_MEMORY,
-        SQLITE_OPEN_NOMUTEX,
-        SQLITE_OPEN_FULLMUTEX,
-        SQLITE_OPEN_NOFOLLOW
-    ],
-)
-@Retention(AnnotationRetention.SOURCE)
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-annotation class OpenFlag
-
 internal fun CPointer.getErrorMsg(): String? {
     return sqlite3_errmsg16(this)?.reinterpret()?.toKStringFromUtf16()
 }
diff --git a/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLiteDriver.kt b/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLiteDriver.kt
index 42d331c..4bd45ed 100644
--- a/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLiteDriver.kt
+++ b/sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLiteDriver.kt
@@ -16,7 +16,6 @@
 
 package androidx.sqlite.driver
 
-import androidx.annotation.RestrictTo
 import androidx.sqlite.SQLiteConnection
 import androidx.sqlite.SQLiteDriver
 import androidx.sqlite.throwSQLiteException
@@ -29,7 +28,6 @@
 import sqlite3.SQLITE_OPEN_CREATE
 import sqlite3.SQLITE_OPEN_READWRITE
 import sqlite3.sqlite3_open_v2
-import sqlite3.sqlite3_threadsafe
 
 /**
  * A [SQLiteDriver] that uses a version of SQLite included with the host operating system.
@@ -37,38 +35,16 @@
  * Usage of this driver expects that `libsqlite` can be found in the shared library path.
  */
 // TODO:
+//    (b/307917398) more open flags
 //    (b/304295573) busy handler registering
 @OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
 class NativeSQLiteDriver : SQLiteDriver {
-
-    /**
-     * The thread safe mode SQLite was compiled with.
-     *
-     * See also [SQLite In Multi-Threaded Applications](https://www.sqlite.org/threadsafe.html)
-     */
-    @get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
-    val threadingMode: Int
-        get() = sqlite3_threadsafe()
-
-    override fun open(fileName: String): SQLiteConnection {
-        return open(fileName, SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE)
-    }
-
-    /**
-     * Opens a new database connection.
-     *
-     * See also [Opening A New Database Connection](https://www.sqlite.org/c3ref/open.html)
-     *
-     * @param fileName Name of the database file.
-     * @param flags Connection open flags.
-     * @return the database connection.
-     */
-    fun open(fileName: String, @OpenFlag flags: Int): SQLiteConnection = memScoped {
+    override fun open(fileName: String): SQLiteConnection = memScoped {
         val dbPointer = allocPointerTo()
         val resultCode = sqlite3_open_v2(
             filename = fileName,
             ppDb = dbPointer.ptr,
-            flags = flags,
+            flags = SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE,
             zVfs = null
         )
         if (resultCode != SQLITE_OK) {