In system_server, it should be deactivated until InstallSystemProviders
is finished.
Test: SQLiteCompatibilityWalFlagsTest
Test: setting put global ... + verify that dumpsys dbinfo has the new flag
Bug: 70226732
Bug: 70517616
Change-Id: Iec6a5e61a5d7e4cc0ac602f2b630357c54bb4456
Added Settings.Global.SQLITE_COMPATIBILITY_WAL_FLAGS -
configuration flags for SQLite Compatibility WAL. Encoded as a key-value
list, separated by commas. E.g.:
compatibility_wal_supported=true, wal_syncmode=OFF
SQLiteCompatibilityWalFlags caches the value of
SQLITE_COMPATIBILITY_WAL_FLAGS on first access and keeps it through
the lifetime of the process for consistent behavior across all
connections.
Test: SQLiteCompatibilityWalFlagsTest
Test: setting put global ... + verify that dumpsys dbinfo has the new flag
Bug: 70226732
Bug: 70517616
Change-Id: Ifacbf5908c83351ebe5dea676eeb716af039fb14
If DDL statement is executed on one connection, the schema change is
not always visible to other connections due to sqlite3_column_count()
API limitation. We have to close secondary connections to prevent the
issue.
Test: cts/SQLiteOpenHelperTest
Bug: 33695159
Change-Id: I862da71ecec5b1edc880dbfadf22efb2274ca10a
The android.database.sqlite package summary page now mentions the
versions of SQLite that are available on Android devices running Oreo
(API level 26) and API level 27.
Test: make ds-docs -j16
Bug: 69106585
Change-Id: I77a323c58343fa978ade5397d613566ba25f00c2
Added setJournalMode/setSynchronousMode. These methods control
journal/syncrhonous mode when ENABLE_WRITE_AHEAD_LOGGING flag is not set
Bug: 33044236
Test: manual + CtsDatabaseTestCases
Change-Id: Iffef75f6941030aae5ab3e239cd65550515f5fe0
In this mode, only database journal mode will be changed, connection pool
size will still be limited to a single connection.
If enabled, compatibility WAL mode will be used if an app hasn't explicitly
requested journal mode, by calling disable/enableWriteAheadLogging.
Compatibility WAL mode is controlled by debug.sqlite.use_compatibility_wal
property and db_use_compatibility_wal config resource.
Impact on write performance:
On ext4, with WAL, there is approx 300% increase in speed of update operations
On f2fs, with WAL, there is approx 5% increase in speed of update operations
Impact on number of writes:
On ext4, switching to WAL reduces the number of writes by approx 50%.
On f2fs, switching to WAL increases the number of writes by approx 15%.
Test: CtsDatabaseTestCases
Test: manual, running device
Bug: 33044236
Change-Id: Iaffb5651df39d8c9f710d7dbbe174f9c0d8a3186
Otherwise it can cause issues in apps depending on transient state.
Test: manual
Bug: 63398887
Bug: 65220630
Change-Id: I0806693e05e2e61035aee0b108e31f8bcc8b1a0b
The former aborts the current transaction, the latter restores the
state to a specified savepoint.
Test: CtsDatabaseTestCases
Test: DatabaseGeneralTest
Bug: 36957161
Change-Id: Ia0b189e8aac4687f10d8fbc07143a452f5f719c9
Internal compatibility testing didn't reveal any issues related to it.
Rationale to not make it specific to low-ram:
1) Consistent behavior from app perspective. close_idle_connections
is a behavioural change and may affect apps relying on undocumented
behavior of connection pooling. Developers can detect problems
without testing on low-ram device
2) Closing idle connections is especially important in WAL mode.
Disabling this feature would become an issue if more apps are
switching to WAL and we would need to re-enable this optimization.
Test: n/a
Bug: 63398887
Change-Id: I1b431f44daa2d337aad7f12f8e1409ae3143ded0
SQLiteDatabase openDatabase -- should take File for first parameter
instead of a String path
SQLiteDatabase.OpenParams.Builder -- make sure the javadocs says what
the default openFlags is and default idle connection timeout
SQLiteDatabase createInMemory -- throw if it has trouble instead of
returning null.
Test: cts/SQLiteDatabaseTest
Bug: 64331777
Bug: 64331778
Bug: 64330914
Change-Id: Ibecf4f4a6498795f9a5d12b94b77481e5745b523
It allows apps to set time SQLite connection is allowed to be idle
before it is closed and removed from the pool.
Test: manual + DatabaseGeneralTest
Bug: 63398887
Change-Id: Ie09eeb4dc2b9e52ba67d9355b1f9bd869b148613
Otherwise it's not clear what is causing the issue (e.g. no columns,
case sensitivity issue or a table prefix etc.)
Bug: 62431773
Test: manual
Change-Id: I81d1f420b70a2248a9b132147cda72c2417dc46b
We should always keep pool size of 1 for in-memory databases since every
:memory: db is separate from another.
Test: com.android.providers.contacts.util.UserUtilsTest
Bug: 64039907
Change-Id: If85af3eacfb5625036e29d44f88c1bebb338f46b
Idle connections are now closed 30 seconds after being returned to the
pool. In-memory databases and databased with attached databases
are exempt from closing idle connections.
The new behavior is enabled on all devices (temporarily).
Use "setprop persist.debug.sqlite.close_idle_connections 0" to disable
Test: manual - devices boots, no app crashes, auth(accounts.db) works
Test: database CTS tests + SQLiteConnectionPoolTest + run_newdb_perf_test.sh
Bug: 63398887
Change-Id: Idc11e49149292d219a15502c1707c40ef27e3ddb
This reverts commit 2df4e144a9.
It was causing failures in packages/apps/DocumentsUI tests
Bug: 63638102
Bug: 63154326
Change-Id: I51fb54f705f58f159f4fcc30bfed41ababcba950
Also dump lookaside config if it's different from the default.
Test: adb shell setprop debug.force_low_ram 1
adb shell stop/start
adb shell dumpsys meminfo system // no lookaside allocations
Bug: 62877322
Change-Id: I152dae9714e7e55f93af3311b7387a6ac816e8f6
[Cause of Defect]
In the ContentObserver callback procedure, the binder thread
has no sync mechanism with handler thread.
The ContentObserver#onChange method can get called after
ContentResolver#unregisterContentObserver called in the
very low probability.
Bug: https://issuetracker.google.com/issues/63154326
Test: manual - check https://github.com/nanjingdaqi/ContentObserverDemo
Change-Id: I0e3831eba7a9cc1a5bf0d30abe5dd0ec8259b0d4
Signed-off-by: daqi <daqi@xiaomi.com>
Modified SQLiteDatabase to allow passing lookaside configuration to its
static initializer. Encapsulated config in OpenParams and added an
overloaded version of openDatabase with the new parameter.
Configuration is changed in SQLiteConnection::nativeOpen, immediately
after opening the database since lookaside memory configuration can only
be changed when no connection is using it.
Added SQLiteOpenHelper.setLookasideConfig method that is called from
the constructor of the subclass.
Test: bit FrameworksCoreTests:android.database.DatabaseGeneralTest
Test: bit FrameworksCoreTests:android.database.SQLiteOpenHelperTest
Bug: 38499845
Change-Id: Ifb761229b43c89c090939030fc25b8c480b9b9e2
Auto-paging of cursors is being removed in favor of a support lib component.
Rationale:
1) Auto-paging as implemented has potential to negatively impact system health.
2) Similar functionality w/o system health concerns can be provided
specific to RecyclerView.
Test: Removed. CTS coverage updated.
Bug: 30927484
Change-Id: I43e62181d8ceeeba6265d44536967a2102751320
(cherry picked from commit 4677c2b7f0)
Auto-paging of cursors is being removed in favor of a support lib component.
Rationale:
1) Auto-paging as implemented has potential to negatively impact system health.
2) Similar functionality w/o system health concerns can be provided
specific to RecyclerView.
Test: Removed. CTS coverage updated.
Bug: 30927484
Change-Id: I43e62181d8ceeeba6265d44536967a2102751320
StatFs.restat() and the StatFs constructor can throw
IllegalArgumentException. This was not previously documented;
not all callers took this into account, for example:
http://r.android.com/251290
This CL adds documentation to those methods. It also adds
comments to two of the callers.
Separately from this CL, we may in addition consider adding
new API StatFs.checkedRestat() and StatFs.checkedCreate()
or similar that throw IOException; we cannot change the
existing constructor and method since they are public.
Test: Checked that "make" still completed successfully.
Change-Id: I6a0b3cb7718939408937c61de7c3b000b948fa59