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