@@ -181,19 +181,54 @@ private static void loadICUData(Context context, File workingDir) {
181
181
}
182
182
}
183
183
184
- /**
185
- * Loads the native SQLCipher library into the application process.
186
- */
184
+ /**
185
+ * Implement this interface to provide custom strategy for loading jni libraries.
186
+ */
187
+ public interface LibraryLoader {
188
+ /**
189
+ * Load jni libraries by given names.
190
+ * Straightforward implementation will be calling {@link System#loadLibrary(String name)}
191
+ * for every provided library name.
192
+ *
193
+ * @param libNames library names that sqlcipher need to load
194
+ */
195
+ void loadLibraries (String ... libNames );
196
+ }
197
+
198
+ /**
199
+ * Loads the native SQLCipher library into the application process.
200
+ */
187
201
public static synchronized void loadLibs (Context context ) {
188
202
loadLibs (context , context .getFilesDir ());
189
203
}
190
204
191
- /**
192
- * Loads the native SQLCipher library into the application process.
193
- */
205
+ /**
206
+ * Loads the native SQLCipher library into the application process.
207
+ */
194
208
public static synchronized void loadLibs (Context context , File workingDir ) {
195
- System .loadLibrary ("sqlcipher" );
196
-
209
+ loadLibs (context , workingDir , new LibraryLoader () {
210
+ @ Override
211
+ public void loadLibraries (String ... libNames ) {
212
+ for (String libName : libNames ) {
213
+ System .loadLibrary (libName );
214
+ }
215
+ }
216
+ });
217
+ }
218
+
219
+ /**
220
+ * Loads the native SQLCipher library into the application process.
221
+ */
222
+ public static synchronized void loadLibs (Context context , LibraryLoader libraryLoader ) {
223
+ loadLibs (context , context .getFilesDir (), libraryLoader );
224
+ }
225
+
226
+ /**
227
+ * Loads the native SQLCipher library into the application process.
228
+ */
229
+ public static synchronized void loadLibs (Context context , File workingDir , LibraryLoader libraryLoader ) {
230
+ libraryLoader .loadLibraries ("sqlcipher" );
231
+
197
232
// System.loadLibrary("stlport_shared");
198
233
// System.loadLibrary("sqlcipher_android");
199
234
// System.loadLibrary("database_sqlcipher");
0 commit comments