Revert "turn off sqlite WAL until bugs bug:3024421 and bug:3353077 are fixed"

This reverts commit d67dbeeb322eac08681fab5be09d30f9663cc128.

This reenables WAL in the framework.  We are tracking down the cause of
the problems with WAL
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 891a5d9..2e43eef 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -2354,39 +2354,37 @@
      * @return true if write-ahead-logging is set. false otherwise
      */
     public boolean enableWriteAheadLogging() {
-        // turn off WAL until lockingprotocolerror bug and diskIO bug are fixed
-        return false;
-//        // make sure the database is not READONLY. WAL doesn't make sense for readonly-databases.
-//        if (isReadOnly()) {
-//            return false;
-//        }
-//        // acquire lock - no that no other thread is enabling WAL at the same time
-//        lock();
-//        try {
-//            if (mConnectionPool != null) {
-//                // already enabled
-//                return true;
-//            }
-//            if (mPath.equalsIgnoreCase(MEMORY_DB_PATH)) {
-//                Log.i(TAG, "can't enable WAL for memory databases.");
-//                return false;
-//            }
-//
-//            // make sure this database has NO attached databases because sqlite's write-ahead-logging
-//            // doesn't work for databases with attached databases
-//            if (mHasAttachedDbs) {
-//                if (Log.isLoggable(TAG, Log.DEBUG)) {
-//                    Log.d(TAG,
-//                            "this database: " + mPath + " has attached databases. can't  enable WAL.");
-//                }
-//                return false;
-//            }
-//            mConnectionPool = new DatabaseConnectionPool(this);
-//            setJournalMode(mPath, "WAL");
-//            return true;
-//        } finally {
-//            unlock();
-//        }
+        // make sure the database is not READONLY. WAL doesn't make sense for readonly-databases.
+        if (isReadOnly()) {
+            return false;
+        }
+        // acquire lock - no that no other thread is enabling WAL at the same time
+        lock();
+        try {
+            if (mConnectionPool != null) {
+                // already enabled
+                return true;
+            }
+            if (mPath.equalsIgnoreCase(MEMORY_DB_PATH)) {
+                Log.i(TAG, "can't enable WAL for memory databases.");
+                return false;
+            }
+
+            // make sure this database has NO attached databases because sqlite's write-ahead-logging
+            // doesn't work for databases with attached databases
+            if (mHasAttachedDbs) {
+                if (Log.isLoggable(TAG, Log.DEBUG)) {
+                    Log.d(TAG,
+                            "this database: " + mPath + " has attached databases. can't  enable WAL.");
+                }
+                return false;
+            }
+            mConnectionPool = new DatabaseConnectionPool(this);
+            setJournalMode(mPath, "WAL");
+            return true;
+        } finally {
+            unlock();
+        }
     }
 
     /**
@@ -2394,20 +2392,19 @@
      * @hide
      */
     public void disableWriteAheadLogging() {
-        return;
-//        // grab database lock so that writeAheadLogging is not disabled from 2 different threads
-//        // at the same time
-//        lock();
-//        try {
-//            if (mConnectionPool == null) {
-//                return; // already disabled
-//            }
-//            mConnectionPool.close();
-//            setJournalMode(mPath, "TRUNCATE");
-//            mConnectionPool = null;
-//        } finally {
-//            unlock();
-//        }
+        // grab database lock so that writeAheadLogging is not disabled from 2 different threads
+        // at the same time
+        lock();
+        try {
+            if (mConnectionPool == null) {
+                return; // already disabled
+            }
+            mConnectionPool.close();
+            setJournalMode(mPath, "TRUNCATE");
+            mConnectionPool = null;
+        } finally {
+            unlock();
+        }
     }
 
     /* package */ SQLiteDatabase getDatabaseHandle(String sql) {