Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 475726f

Browse files
author
hideki
committed
Crash when running with SQLCipher - Multiple SQLite connections with SQLCipher could cause crashes in the native codes. - We decided to use single connection with Android API version 20 or lower, And use multiple connections with API 21 or higher.
1 parent 1d9fed9 commit 475726f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/com/couchbase/lite/android/AndroidSQLiteStorageEngine.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package com.couchbase.lite.android;
1717

18+
import android.os.Build;
1819
import android.os.Looper;
1920

2021
import com.couchbase.lite.internal.database.DatabasePlatformSupport;
@@ -46,4 +47,14 @@ public boolean isMainThread() {
4647
protected String getICUDatabasePath() {
4748
return ICUUtils.getICUDatabasePath(context);
4849
}
50+
51+
@Override
52+
protected int getWALConnectionPoolSize() {
53+
// Crash when running with SQLCipher
54+
// https://github.com/couchbase/couchbase-lite-java-core/issues/1352
55+
// We observed SQLCipher crashes with multiple connections on Android API 19 (x86).
56+
// Android 5.x (LOLLIPOP/API21) or higher uses multiple connections.
57+
// Android 4.x (API 20) or lower uses single connection mode.
58+
return Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? 1 : 4;
59+
}
4960
}

0 commit comments

Comments
 (0)