Class ApplicationSoSource


  • public class ApplicationSoSource
    extends SoSource
    SoSource that wraps a DirectorySoSource for the application's nativeLibraryDir.
    • Constructor Detail

      • ApplicationSoSource

        public ApplicationSoSource​(android.content.Context context,
                                   int flags)
    • Method Detail

      • checkAndMaybeUpdate

        public boolean checkAndMaybeUpdate()
                                    throws java.io.IOException
        check to make sure there haven't been any changes to the nativeLibraryDir since the last check, if there have been changes, update the context and soSource
        Returns:
        true if the nativeLibraryDir was updated
        Throws:
        java.io.IOException - IOException
      • getUpdatedContext

        public android.content.Context getUpdatedContext()
      • getNativeLibDirFromContext

        public static java.io.File getNativeLibDirFromContext​(android.content.Context context)
      • loadLibrary

        public int loadLibrary​(java.lang.String soName,
                               int loadFlags,
                               android.os.StrictMode.ThreadPolicy threadPolicy)
                        throws java.io.IOException
        Description copied from class: SoSource
        Load a shared library library into this process. This routine is independent of SoSource.loadLibrary(java.lang.String, int, android.os.StrictMode.ThreadPolicy).
        Specified by:
        loadLibrary in class SoSource
        Parameters:
        soName - Name of library to load
        loadFlags - Zero or more of the LOAD_FLAG_XXX constants.
        threadPolicy - Strict Mode policy
        Returns:
        One of the LOAD_RESULT_XXX constants.
        Throws:
        java.io.IOException - IOException
      • getSoFileByName

        @Nullable
        public java.io.File getSoFileByName​(java.lang.String soName)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getLibraryPath

        @Nullable
        public java.lang.String getLibraryPath​(java.lang.String soName)
                                        throws java.io.IOException
        Description copied from class: SoSource
        Gets the full path of a library if it is found on this SoSource.
        Overrides:
        getLibraryPath in class SoSource
        Parameters:
        soName - the full file name of the library
        Returns:
        the full path of a library if it is found on this SoSource, null otherwise.
        Throws:
        java.io.IOException - if there is an error calculating soFileName's canonical path
      • getLibraryDependencies

        @Nullable
        public java.lang.String[] getLibraryDependencies​(java.lang.String soName)
                                                  throws java.io.IOException
        Description copied from class: SoSource
        Gets the dependencies of a library if it is found on this SoSource
        Overrides:
        getLibraryDependencies in class SoSource
        Parameters:
        soName - Name of library to inspect
        Returns:
        An array of library names upon which soName needs for linking
        Throws:
        java.io.IOException - if soName is found but there is an error reading it
      • addToLdLibraryPath

        public void addToLdLibraryPath​(java.util.Collection<java.lang.String> paths)
        Description copied from class: SoSource
        Add an element to an LD_LIBRARY_PATH under construction.
        Overrides:
        addToLdLibraryPath in class SoSource
        Parameters:
        paths - Collection of paths to which to add
      • toString

        public java.lang.String toString()
        Description copied from class: SoSource
        Return the class name of the actual instance. Useful for debugging.
        Overrides:
        toString in class SoSource
        Returns:
        the instance class name