Package com.getkeepsafe.relinker
Class ReLinkerInstance
- java.lang.Object
-
- com.getkeepsafe.relinker.ReLinkerInstance
-
public class ReLinkerInstance extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanforceprotected ReLinker.LibraryInstallerlibraryInstallerprotected ReLinker.LibraryLoaderlibraryLoaderprotected Set<String>loadedLibrariesprotected ReLinker.Loggerloggerprotected booleanrecursive
-
Constructor Summary
Constructors Modifier Constructor Description protectedReLinkerInstance()protectedReLinkerInstance(ReLinker.LibraryLoader libraryLoader, ReLinker.LibraryInstaller libraryInstaller)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanupOldLibFiles(Context context, String library, String currentVersion)Cleans up any other versions of thelibrary.ReLinkerInstanceforce()Forces any previously extracted / re-linked libraries to be cleaned up before loadingprotected FilegetWorkaroundLibDir(Context context)protected FilegetWorkaroundLibFile(Context context, String library, String version)voidloadLibrary(Context context, String library)Utilizes the regular system call to attempt to load a native library.voidloadLibrary(Context context, String library, ReLinker.LoadListener listener)The same call asloadLibrary(Context, String), however if aReLinker.LoadListeneris provided, the function is executed asynchronously.voidloadLibrary(Context context, String library, String version)The same call asloadLibrary(Context, String), however if aversionis provided, then that specific version of the given library is loaded.voidloadLibrary(Context context, String library, String version, ReLinker.LoadListener listener)Attemps to load the given library normally.ReLinkerInstancelog(ReLinker.Logger logger)Logs debugging related information to theReLinker.Loggerinstance givenvoidlog(String message)voidlog(String format, Object... args)ReLinkerInstancerecursively()Enables recursive library loading to resolve and load shared object -> shared object defined dependencies
-
-
-
Field Detail
-
libraryLoader
protected final ReLinker.LibraryLoader libraryLoader
-
libraryInstaller
protected final ReLinker.LibraryInstaller libraryInstaller
-
force
protected boolean force
-
recursive
protected boolean recursive
-
logger
protected ReLinker.Logger logger
-
-
Constructor Detail
-
ReLinkerInstance
protected ReLinkerInstance()
-
ReLinkerInstance
protected ReLinkerInstance(ReLinker.LibraryLoader libraryLoader, ReLinker.LibraryInstaller libraryInstaller)
-
-
Method Detail
-
log
public ReLinkerInstance log(ReLinker.Logger logger)
Logs debugging related information to theReLinker.Loggerinstance given
-
force
public ReLinkerInstance force()
Forces any previously extracted / re-linked libraries to be cleaned up before loading
-
recursively
public ReLinkerInstance recursively()
Enables recursive library loading to resolve and load shared object -> shared object defined dependencies
-
loadLibrary
public void loadLibrary(Context context, String library)
Utilizes the regular system call to attempt to load a native library. If a failure occurs, then the function extracts native .so library out of the app's APK and attempts to load it.Note: This is a synchronous operation
-
loadLibrary
public void loadLibrary(Context context, String library, String version)
The same call asloadLibrary(Context, String), however if aversionis provided, then that specific version of the given library is loaded.
-
loadLibrary
public void loadLibrary(Context context, String library, ReLinker.LoadListener listener)
The same call asloadLibrary(Context, String), however if aReLinker.LoadListeneris provided, the function is executed asynchronously.
-
loadLibrary
public void loadLibrary(Context context, String library, String version, ReLinker.LoadListener listener)
Attemps to load the given library normally. If that fails, it loads the library utilizing a workaround.- Parameters:
context- TheContextto get a workaround directory fromlibrary- The library you wish to loadversion- The version of the library you wish to load, ornulllistener-ReLinker.LoadListenerto listen for async execution, ornull
-
getWorkaroundLibFile
protected File getWorkaroundLibFile(Context context, String library, String version)
-
cleanupOldLibFiles
protected void cleanupOldLibFiles(Context context, String library, String currentVersion)
Cleans up any other versions of thelibrary. Ifforceis used, all versions of thelibraryare deleted- Parameters:
context-Contextto retrieve the workaround directory fromlibrary- The name of the library to loadcurrentVersion- The version of the library to keep, all other versions will be deleted. This parameter is ignored ifforceis used.
-
log
public void log(String message)
-
-