Package com.facebook.soloader
Class SoSource
java.lang.Object
com.facebook.soloader.SoSource
- Direct Known Subclasses:
ApplicationSoSource,DirectApkSoSource,DirectorySoSource,DirectSplitSoSource,NoopSoSource,SystemLoadWrapperSoSource
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAllow loadLibrary to implicitly provide the library instead of actually loading it.static final intDeprecated.static final intMin flag that can be used in customizedSoFileLoader.load(String, int)implementation.static final intThis SoSource did not load the library, but verified that the system loader will load it if some other library depends on it.static final intThis SoSource loaded the given library.static final intThis SoSource doesn't know how to provide the given library.static final intAllow prepare to spawn threads to do background work.static final intDisable so file fsync job.static final intForce prepare to refresh libs.static final intSkip preparing backup so source. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToLdLibraryPath(Collection<String> paths) Add an element to an LD_LIBRARY_PATH under construction.String[]getLibraryDependencies(String soName) Gets the dependencies of a library if it is found on this SoSourcegetLibraryPath(String soFileName) Gets the full path of a library if it is found on this SoSource.abstract StringgetName()String[]Return an array of ABIs handled by this SoSource.abstract intloadLibrary(String soName, int loadFlags, android.os.StrictMode.ThreadPolicy threadPolicy) Load a shared library library into this process.toString()Return the class name of the actual instance.abstract FileunpackLibrary(String soName) Ensure that a shared library exists on disk somewhere.
-
Field Details
-
LOAD_RESULT_NOT_FOUND
public static final int LOAD_RESULT_NOT_FOUNDThis SoSource doesn't know how to provide the given library.- See Also:
-
LOAD_RESULT_LOADED
public static final int LOAD_RESULT_LOADEDThis SoSource loaded the given library.- See Also:
-
LOAD_RESULT_IMPLICITLY_PROVIDED
public static final int LOAD_RESULT_IMPLICITLY_PROVIDEDThis SoSource did not load the library, but verified that the system loader will load it if some other library depends on it. Returned only if LOAD_FLAG_ALLOW_IMPLICIT_PROVISION is provided to loadLibrary.- See Also:
-
LOAD_FLAG_ALLOW_IMPLICIT_PROVISION
public static final int LOAD_FLAG_ALLOW_IMPLICIT_PROVISIONAllow loadLibrary to implicitly provide the library instead of actually loading it.- See Also:
-
LOAD_FLAG_ALLOW_SOURCE_CHANGE
Deprecated.Allow loadLibrary to reparse the so sources directories.- See Also:
-
LOAD_FLAG_MIN_CUSTOM_FLAG
public static final int LOAD_FLAG_MIN_CUSTOM_FLAGMin flag that can be used in customizedSoFileLoader.load(String, int)implementation. The custom flag value has to be greater than this.- See Also:
-
PREPARE_FLAG_ALLOW_ASYNC_INIT
public static final int PREPARE_FLAG_ALLOW_ASYNC_INITAllow prepare to spawn threads to do background work.- See Also:
-
PREPARE_FLAG_FORCE_REFRESH
public static final int PREPARE_FLAG_FORCE_REFRESHForce prepare to refresh libs.- See Also:
-
PREPARE_FLAG_DISABLE_FS_SYNC_JOB
public static final int PREPARE_FLAG_DISABLE_FS_SYNC_JOBDisable so file fsync job.- See Also:
-
PREPARE_FLAG_SKIP_BACKUP_SO_SOURCE
public static final int PREPARE_FLAG_SKIP_BACKUP_SO_SOURCESkip preparing backup so source.- See Also:
-
-
Constructor Details
-
SoSource
public SoSource()
-
-
Method Details
-
loadLibrary
public abstract int loadLibrary(String soName, int loadFlags, android.os.StrictMode.ThreadPolicy threadPolicy) throws IOException Load a shared library library into this process. This routine is independent ofloadLibrary(java.lang.String, int, android.os.StrictMode.ThreadPolicy).- Parameters:
soName- Name of library to loadloadFlags- Zero or more of the LOAD_FLAG_XXX constants.threadPolicy- Strict Mode policy- Returns:
- One of the LOAD_RESULT_XXX constants.
- Throws:
IOException- IOException
-
unpackLibrary
Ensure that a shared library exists on disk somewhere. This routine is independent ofloadLibrary(java.lang.String, int, android.os.StrictMode.ThreadPolicy).- Parameters:
soName- Name of library to load- Returns:
- File if library found;
nullif not. - Throws:
IOException- IOException
-
getLibraryPath
Gets the full path of a library if it is found on this SoSource.- Parameters:
soFileName- the full file name of the library- Returns:
- the full path of a library if it is found on this SoSource, null otherwise.
- Throws:
IOException- if there is an error calculatingsoFileName's canonical path
-
getLibraryDependencies
Gets the dependencies of a library if it is found on this SoSource- Parameters:
soName- Name of library to inspect- Returns:
- An array of library names upon which
soNameneeds for linking - Throws:
IOException- ifsoNameis found but there is an error reading it
-
addToLdLibraryPath
Add an element to an LD_LIBRARY_PATH under construction.- Parameters:
paths- Collection of paths to which to add
-
getSoSourceAbis
Return an array of ABIs handled by this SoSource.- Returns:
- ABIs supported by this SoSource
-
getName
- Returns:
- the name of this SoSource for logging purposes
-
toString
Return the class name of the actual instance. Useful for debugging.
-