class PerfettoHandshake


Handshake implementation allowing to enable Perfetto SDK tracing in an app that enables it.

Summary

Public constructors

PerfettoHandshake(
    targetPackage: String,
    parseJsonMap: (jsonString: String) -> Map<StringString>,
    executeShellCommand: (command: String) -> String
)

Public functions

PerfettoHandshake.EnableTracingResponse

Requests that tracing is enabled in the target app.

Public constructors

PerfettoHandshake

PerfettoHandshake(
    targetPackage: String,
    parseJsonMap: (jsonString: String) -> Map<StringString>,
    executeShellCommand: (command: String) -> String
)
Parameters
targetPackage: String

package name of the target app

parseJsonMap: (jsonString: String) -> Map<StringString>

function parsing a flat map in a JSON format into a Map<String, String> e.g. "{ 'key 1': 'value 1', 'key 2': 'value 2' }" ->mapOf("key 1" to "value 1", "key 2" to "value 2")

executeShellCommand: (command: String) -> String

function allowing to execute adb shell commands on the target device

For error handling, note that parseJsonMap and executeShellCommand will be called on the same thread as enableTracing.

Public functions

enableTracing

fun enableTracing(
    libraryProvider: PerfettoHandshake.ExternalLibraryProvider? = null
): PerfettoHandshake.EnableTracingResponse

Requests that tracing is enabled in the target app.

Parameters
libraryProvider: PerfettoHandshake.ExternalLibraryProvider? = null

optional provider of Perfetto SDK binaries allowing to sideload them if not already present in the target app