diff --git a/README.md b/README.md index 184f9e9..84939f8 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ SQLCipher for Android may also integrate with the Room API via the `SupportOpenH System.loadLibrary("sqlcipher"); String password = "Password1!"; File databaseFile = context.getDatabasePath("demo.db"); -SupportOpenHelperFactory factory = new SupportOpenHelperFactory("password.getBytes(StandardCharsets.UTF_8)); +SupportOpenHelperFactory factory = new SupportOpenHelperFactory(password.getBytes(StandardCharsets.UTF_8)); db = Room.databaseBuilder(context, AppDatabase.class, databaseFile.getAbsolutePath()) .openHelperFactory(factory).build(); ``` diff --git a/README.md.template b/README.md.template index 1a215f0..7d38363 100644 --- a/README.md.template +++ b/README.md.template @@ -71,7 +71,7 @@ SQLCipher for Android may also integrate with the Room API via the `SupportOpenH System.loadLibrary("sqlcipher"); String password = "Password1!"; File databaseFile = context.getDatabasePath("demo.db"); -SupportOpenHelperFactory factory = new SupportOpenHelperFactory("password.getBytes(StandardCharsets.UTF_8)); +SupportOpenHelperFactory factory = new SupportOpenHelperFactory(password.getBytes(StandardCharsets.UTF_8)); db = Room.databaseBuilder(context, AppDatabase.class, databaseFile.getAbsolutePath()) .openHelperFactory(factory).build(); ``` diff --git a/sqlcipher/build.gradle b/sqlcipher/build.gradle index 9732cc5..9fb5fdf 100644 --- a/sqlcipher/build.gradle +++ b/sqlcipher/build.gradle @@ -99,18 +99,8 @@ def isReleaseBuild() { return mavenVersionName.contains("SNAPSHOT") == false } -def getReleaseRepositoryUrl() { - return hasProperty('mavenReleaseRepositoryUrl') ? mavenReleaseRepositoryUrl - : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} - -def getSnapshotRepositoryUrl() { - if(hasProperty('mavenLocalRepositoryPrefix')) { - return "${mavenLocalRepositoryPrefix}${buildDir}/${mavenSnapshotRepositoryUrl}" - } else { - return hasProperty('mavenSnapshotRepositoryUrl') ? mavenSnapshotRepositoryUrl - : "https://oss.sonatype.org/content/repositories/snapshots/" - } +static def getReleaseRepositoryUrl() { + return "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" } def getRepositoryUsername() { @@ -166,9 +156,7 @@ afterEvaluate { repositories { maven { - def repoUrl = isReleaseBuild() - ? getReleaseRepositoryUrl() - : getSnapshotRepositoryUrl() + def repoUrl = getReleaseRepositoryUrl() url = repoUrl credentials { username = getRepositoryUsername() @@ -180,7 +168,7 @@ afterEvaluate { } signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("publish") } + required { gradle.taskGraph.hasTask("publish") } sign publishing.publications.mavenJava } } diff --git a/sqlcipher/src/main/jni/sqlcipher/Android.mk b/sqlcipher/src/main/jni/sqlcipher/Android.mk index 6ed942b..fe08844 100644 --- a/sqlcipher/src/main/jni/sqlcipher/Android.mk +++ b/sqlcipher/src/main/jni/sqlcipher/Android.mk @@ -12,7 +12,8 @@ LOCAL_CFLAGS += -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_TEMP_STOR -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_MAX_VARIABLE_NUMBER=99999 \ -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 -DSQLITE_ENABLE_SESSION \ - -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_DBSTAT_VTAB + -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_DBSTAT_VTAB \ + -DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown endif LOCAL_CPPFLAGS += -Wno-conversion-null diff --git a/sqlcipher/src/main/jni/sqlcipher/android_database_SQLiteConnection.cpp b/sqlcipher/src/main/jni/sqlcipher/android_database_SQLiteConnection.cpp index fe82135..2ae8e81 100644 --- a/sqlcipher/src/main/jni/sqlcipher/android_database_SQLiteConnection.cpp +++ b/sqlcipher/src/main/jni/sqlcipher/android_database_SQLiteConnection.cpp @@ -157,7 +157,7 @@ static jint nativeKey(JNIEnv* env, jclass clazz, jlong connectionPtr, jbyteArray } if (rc != SQLITE_OK) { ALOGE("sqlite3_key(%p) failed: %d", connection->db, rc); - throw_sqlite3_exception(env, connection->db, "Could not key db."); + throw_sqlite3_exception_errcode(env, rc, "Could not key db."); } return rc; } @@ -178,7 +178,7 @@ static jint nativeKey(JNIEnv* env, jclass clazz, jlong connectionPtr, jbyteArray } if (rc != SQLITE_OK) { ALOGE("sqlite3_rekey(%p) failed: %d", connection->db, rc); - throw_sqlite3_exception(env, connection->db, "Could not rekey db."); + throw_sqlite3_exception_errcode(env, rc, "Could not rekey db."); } return rc; } @@ -230,6 +230,9 @@ static jlong nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFla return 0; } + // Enable extension loading + sqlite3_enable_load_extension(db, 1); + // Create wrapper object. auto* connection = new SQLiteConnection(db, openFlags, path, label);