RecompositionTracingReceiver

class RecompositionTracingReceiver : BroadcastReceiver


Receives broadcast intents to start and stop the RecompositionTracer.

RecompositionTracer is a higher overhead debugging tool that collects information about state reads and writes that affect composition into a Perfetto trace.

This receiver can be started at any point of time to start and stop the tracing. The RecompositionTracer will automatically find all existing compositions and start observations from there.

Supported actions:

Result codes:

This receiver is generally not expected to be called directly by the user and should only be used by surrounding tooling (e.g. macrobenchmarks) to actually start and stop the tracing.

To start the receiver, use:

 adb shell am broadcast \
-a androidx.compose.tracing.action.START_RECOMPOSE_TRACING \
$
package/androidx.compose.runtime.tracing.RecompositionTracingReceiver

To stop the receiver, use:

adb shell am broadcast \
-a androidx.compose.tracing.action.STOP_RECOMPOSE_TRACING \
$
package/androidx.compose.runtime.tracing.RecompositionTracingReceiver

Where $package is your application's package name.

Note that enabled / disabled state for recomposition tracing is persisted until app reinstall.

Summary

Constants

const String

Start recomposition tracing.

const String

Stop recomposition tracing.

const Int

Did not start recomposition tracing.

const Int

Failed to start or stop recomposition tracing.

const Int

Successfully started or stopped recomposition tracing.

Public constructors

Public functions

open Unit
onReceive(context: Context?, intent: Intent?)

Handles broadcast intents for starting or stopping recomposition tracing.

Constants

ACTION_START

const val ACTION_START: String

Start recomposition tracing.

ACTION_STOP

const val ACTION_STOP: String

Stop recomposition tracing.

RESULT_CODE_ALREADY_IN_PROGRESS

const val RESULT_CODE_ALREADY_IN_PROGRESS = 2: Int

Did not start recomposition tracing. Tracing is already in progress.

RESULT_CODE_FAILURE

const val RESULT_CODE_FAILURE = 3: Int

Failed to start or stop recomposition tracing.

RESULT_CODE_SUCCESS

const val RESULT_CODE_SUCCESS = 1: Int

Successfully started or stopped recomposition tracing.

Public constructors

RecompositionTracingReceiver

Added in 1.13.0-beta01
RecompositionTracingReceiver()

Public functions

onReceive

Added in 1.13.0-beta01
open fun onReceive(context: Context?, intent: Intent?): Unit

Handles broadcast intents for starting or stopping recomposition tracing.