Class NativeDeps


  • public final class NativeDeps
    extends java.lang.Object
    Class for getting native libraries dependencies for a DSO. Dependencies are read either from a file specifying all dependencies, or from the ELF file itself.
    • Constructor Summary

      Constructors 
      Constructor Description
      NativeDeps()  
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String[] getDependencies​(java.lang.String soName, ElfByteChannel bc)  
      static java.lang.String[] getDependencies​(java.lang.String soName, java.io.File elfFile)  
      static boolean useDepsFile​(android.content.Context context, boolean async, boolean extractToDisk)
      Enables fetching dependencies from a deps file expected to be in the APK.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NativeDeps

        public NativeDeps()
    • Method Detail

      • getDependencies

        public static java.lang.String[] getDependencies​(java.lang.String soName,
                                                         java.io.File elfFile)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • getDependencies

        public static java.lang.String[] getDependencies​(java.lang.String soName,
                                                         ElfByteChannel bc)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • useDepsFile

        public static boolean useDepsFile​(android.content.Context context,
                                          boolean async,
                                          boolean extractToDisk)
        Enables fetching dependencies from a deps file expected to be in the APK. If enabled, dependencies will be looked up in the deps file instead of extracting them from the ELF file. The file is read only once when getDependencies is first called. If dependencies for a specific library are not found or the file is corrupt, we fall back to extracting the dependencies from the ELF file.
        Parameters:
        context - Application context, used to find apk file and data directory.
        async - If true, native deps file initialization will be performed in a background thread, and fetching dependencies will wait for initialization to complete. If false, initialization is performed synchronously on this call.
        extractToDisk - Whether the dependency file got extracted into disk.
        Returns:
        true if initialization succeeded, false otherwise. If async, always returns true.