Make SQLiteOpenHelper thread safe
Concurrent SQLiteOpenHelper instances is a common anti-pattern that leads to SQLiteDatabase exceptions. The specific problem occurs when a database upgrade is triggered automatically inside the open helper. This creates a lock for every database file managed by a SQLiteOpenHelper. The lock guards the code that opens a database and optionally upgrades it. This does not protect against code that might access the database outside of a SQLiteOpenHelper. Flag: android.database.sqlite.concurrent_open_helper Bug: 335904370 Test: atest * CtsDatabaseTestCases * FrameworksCoreTests:android.database Change-Id: I4d79375c44ca3170495fce6cd9d682cf21e62e2f
Loading
Please register or sign in to comment