Skip to content

LibrariesManager

Jordan Samhi edited this page Aug 22, 2023 · 1 revision

LibrariesManager 📚

LibrariesManager is a class designed to load and manage the list of known library packages within an Android application. It extends the FileLoader abstract class to load the list from a file and applies the Singleton pattern.

Table of Contents

Overview

LibrariesManager ensures that library packages are properly identified and distinguished within an Android application. It utilizes the Soot framework and leverages the Singleton design pattern.

Methods

v()

Returns the singleton instance of LibrariesManager.

getFile()

Returns the libraries file path.

isLibrary(SootClass sc)

Checks whether a given SootClass belongs to a library.

  • Parameters: sc - the SootClass to check.
  • Return Value: true if the SootClass belongs to a library, false otherwise.

Usage

Example 1: Getting Instance

LibrariesManager manager = LibrariesManager.v();

Example 2: Checking a Class

SootClass sootClass = // Retrieve a SootClass instance
boolean isLibrary = manager.isLibrary(sootClass);

if (isLibrary) {
    System.out.println("The class is a library.");
} else {
    System.out.println("The class is not a library.");
}

These examples demonstrate how to use LibrariesManager to manage and identify libraries within an Android application. By leveraging Soot, it provides a concise way to handle library packages and load them from a specified file at startup.