Class NativeDeps

java.lang.Object
com.facebook.soloader.NativeDeps

public final class NativeDeps extends 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 Details

    • NativeDeps

      public NativeDeps()
  • Method Details

    • loadDependencies

      public static void loadDependencies(String soName, ElfByteChannel bc, int loadFlags, android.os.StrictMode.ThreadPolicy threadPolicy) throws IOException
      Throws:
      IOException
    • getDependencies

      public static String[] getDependencies(String soName, ElfByteChannel bc) throws IOException
      Throws:
      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.