diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-03-22 19:13:11 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-03-23 13:26:26 -0700 |
commit | 47847f3f4dcf2a0dbea0bc0e4f02528e21d37a88 (patch) | |
tree | 95198c432b05cef99e38a09165c2686906dc48bb /packages/SettingsProvider | |
parent | 3c4da3cad04ca878a4a37fcca3f3e2ff51d03fcb (diff) | |
download | frameworks_base-47847f3f4dcf2a0dbea0bc0e4f02528e21d37a88.zip frameworks_base-47847f3f4dcf2a0dbea0bc0e4f02528e21d37a88.tar.gz frameworks_base-47847f3f4dcf2a0dbea0bc0e4f02528e21d37a88.tar.bz2 |
Support enabling WAL using a flag when DB is opened.
Using enableWriteAheadLogging() to enable WAL is inefficient because
we previously disabled WAL mode when the database was opened.
Switching from WAL to PERSIST then back to WAL is inefficient
and could slow down application launch time. It would be better
to leave the database in WAL mode when we open it to begin with.
To do that, we need to know ahead of time whether we will want to
have WAL enabled for the newly opened database.
Using this flag also reduces the chance that we will encounter
an error enabling WAL mode due to there being other open connections
to the database.
Bug: 6124556
Change-Id: I38ec7a528baeda9f1ef77e25e88b3ca4b6296200
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 1 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 1 |
2 files changed, 1 insertions, 1 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 330a189..abf713b 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -84,6 +84,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); mContext = context; + setWriteAheadLoggingEnabled(true); } public static boolean isValidTable(String name) { diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 95fd62d..1fa3695 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -260,7 +260,6 @@ public class SettingsProvider extends ContentProvider { // Watch for external modifications to the database file, // keeping our cache in sync. SQLiteDatabase db = mOpenHelper.getWritableDatabase(); - db.enableWriteAheadLogging(); sObserverInstance = new SettingsFileObserver(db.getPath()); sObserverInstance.startWatching(); startAsyncCachePopulation(); |