com.getkeepsafe.relinker.ReLinker Java Examples

The following examples show how to use com.getkeepsafe.relinker.ReLinker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DB.java    From FairEmail with GNU General Public License v3.0 5 votes vote down vote up
private static RoomDatabase.Builder<DB> getBuilder(Context context) {
    try {
        ReLinker.log(new ReLinker.Logger() {
            @Override
            public void log(String message) {
                Log.i("Relinker: " + message);
            }
        }).loadLibrary(context, "sqlite3x");
    } catch (Throwable ex) {
        Log.e(ex);
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    int threads = prefs.getInt("query_threads", 4); // AndroidX default thread count: 4
    Log.i("Query threads=" + threads);
    ExecutorService executor = Helper.getBackgroundExecutor(threads, "query");

    return Room
            .databaseBuilder(context, DB.class, DB_NAME)
            .openHelperFactory(new RequerySQLiteOpenHelperFactory())
            .setQueryExecutor(executor)
            .setJournalMode(JournalMode.WRITE_AHEAD_LOGGING) // using the latest sqlite
            .addCallback(new Callback() {
                @Override
                public void onOpen(@NonNull SupportSQLiteDatabase db) {
                    Log.i("Database version=" + db.getVersion());

                    createTriggers(db);
                }
            });
}
 
Example #2
Source File: Os.java    From SafeContentResolver with Apache License 2.0 5 votes vote down vote up
private static void loadLibrary() {
    libraryNeedsLoading = false;
    try {
        ReLinker.loadLibrary(context, LIBRARY_NAME);
    } catch (MissingLibraryException | UnsatisfiedLinkError e) {
        loadFailedException = new UnsupportedOperationException("Failed to load native library " + LIBRARY_NAME, e);
        throw loadFailedException;
    }
}
 
Example #3
Source File: AlchemySQLite4aTest.java    From alchemy with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void loadJni() {
    ReLinker.loadLibrary(InstrumentationRegistry.getContext(), SQLite.JNI_LIB);
}
 
Example #4
Source File: RgbYuvConverter.java    From CameraCompat with MIT License 4 votes vote down vote up
public static void loadLibrary(Context context) {
    ReLinker.loadLibrary(context, "rgb-yuv-converter-library");
}