@@ -165,14 +165,41 @@ private static void loadICUData(Context context, File workingDir) {
165165 }
166166 }
167167
168+ /**
169+ * Implement this interface to provide custom strategy for loading jni libraries.
170+ */
171+ public interface LibraryLoader {
172+ /**
173+ * Load jni libraries by given names.
174+ * Straightforward implementation will be calling {@link System#loadLibrary(String name)}
175+ * for every provided library name.
176+ *
177+ * @param libNames library names that sqlcipher need to load
178+ */
179+ void loadLibraries (String ... libNames );
180+ }
181+
168182 public static synchronized void loadLibs (Context context ) {
169183 loadLibs (context , context .getFilesDir ());
170184 }
171185
172186 public static synchronized void loadLibs (Context context , File workingDir ) {
173- System .loadLibrary ("stlport_shared" );
174- System .loadLibrary ("sqlcipher_android" );
175- System .loadLibrary ("database_sqlcipher" );
187+ loadLibs (context , workingDir , new LibraryLoader () {
188+ @ Override
189+ public void loadLibraries (String ... libNames ) {
190+ for (String libName : libNames ) {
191+ System .loadLibrary (libName );
192+ }
193+ }
194+ });
195+ }
196+
197+ public static synchronized void loadLibs (Context context , LibraryLoader libraryLoader ) {
198+ loadLibs (context , context .getFilesDir (), libraryLoader );
199+ }
200+
201+ public static synchronized void loadLibs (Context context , File workingDir , LibraryLoader libraryLoader ) {
202+ libraryLoader .loadLibraries ("stlport_shared" , "sqlcipher_android" , "database_sqlcipher" );
176203
177204 boolean systemICUFileExists = new File ("/system/usr/icu/icudt46l.dat" ).exists ();
178205
0 commit comments