Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
         
       
     
  
  
  
  
  
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
FridaUtils
  public
  
  
  
  class
  FridaUtils
  
    extends Object
  
  
  
  
  
      implements
      
        AutoCloseable
      
  
  
  
    
    | java.lang.Object
     | 
  
  
  
    
      |    ↳ | 
    
    com.android.sts.common.FridaUtils
     | 
  
  
  
    
  AutoCloseable that downloads and push frida and scripts to device and cleans up when done 
Summary
Public methods | 
  
  
  
    
        
        
        
        
        
        void
     | 
  
    
      
      close()
      
      
     | 
  
  
  
  
  
    
        
        
        static
        
        
        FridaUtils
     | 
  
    
      
      withFrida(ITestDevice device, IBuildInfo buildInfo)
      
      
        Find out which Frida binary we need and download it if needed.
        
    
 
      
     | 
  
  
  
  
  
    
        
        
        
        
        
        ByteArrayOutputStream
     | 
  
    
      
      withFridaScript(String fridaJsScriptContent, int pid)
      
      
        Upload and run frida script on given process.
        
    
 
      
     | 
  
  
Public methods
    close
    
public void close ()
    
    
    
  
      
      | Throws | 
        
          DeviceNotAvailableException | 
           | 
        
        
          TimeoutException | 
           | 
        
      
  
 
    withFrida
    
public static FridaUtils withFrida (ITestDevice device, 
                IBuildInfo buildInfo)
    
    
    
  Find out which Frida binary we need and download it if needed.
    
    | Parameters | 
      
        device | 
        
          ITestDevice: device to use Frida on | 
      
      
        buildInfo | 
        
          IBuildInfo: test device build info (from test.getBuild()) | 
      
    
    
      | Returns | 
      
        FridaUtils | 
        an AutoCloseable FridaUtils object that can be used to run Frida scripts with
 | 
      
    
      
      | Throws | 
        
          DeviceNotAvailableException | 
           | 
        
        
          UnsupportedOperationException | 
           | 
        
        
          IOException | 
           | 
        
      
  
 
    withFridaScript
    
public ByteArrayOutputStream withFridaScript (String fridaJsScriptContent, 
                int pid)
    
    
    
  Upload and run frida script on given process.
    
    | Parameters | 
      
        fridaJsScriptContent | 
        
          String: Content of the Frida JS script. Note: this is not a file name | 
      
      
        pid | 
        
          int: PID of the process to attach Frida to | 
      
    
    
      | Returns | 
      
        ByteArrayOutputStream | 
        ByteArrayOutputStream containing stdout and stderr of frida command
 | 
      
    
      
      | Throws | 
        
          DeviceNotAvailableException | 
           | 
        
        
          FileNotFoundException | 
           | 
        
        
          IOException | 
           | 
        
        
          TimeoutException | 
           | 
        
        
          InterruptedException | 
           | 
        
      
  
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2022-11-18 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-11-18 UTC."],[],[]]