# LaunchPerformanceBase

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# LaunchPerformanceBase

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/test/LaunchPerformanceBase "View this page in Java")  

```
open class LaunchPerformanceBase : Instrumentation
```

|---|---|--------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                              |||
| ↳ | [android.app.Instrumentation](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#)             ||
|   | ↳ | [android.test.LaunchPerformanceBase](https://developer.android.com/reference/kotlin/android/test/LaunchPerformanceBase#) |

*** ** * ** ***

| **This class was deprecated in API level 31.**
|
| Deprecated in Java.

Base class for all launch performance Instrumentation classes.

## Summary

| Inherited constants ||
|---|---|
| From class[Instrumentation](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#) |----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [REPORT_KEY_IDENTIFIER](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#REPORT_KEY_IDENTIFIER:kotlin.String) <br /> If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies the class that is writing the report. This can be used to provide more structured logging or reporting capabilities in the IInstrumentationWatcher. <br />                                                                                                                                                                                                 | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [REPORT_KEY_STREAMRESULT](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#REPORT_KEY_STREAMRESULT:kotlin.String) <br /> If included in the status or final bundle sent to an IInstrumentationWatcher, this key identifies a string which can simply be printed to the output stream. Using these streams provides a "pretty printer" version of the status \& final packets. Any bundles including this key should also include the complete set of raw key/value pairs, so that the instrumentation can also be launched, and results collected, by an automated system. <br /> | ||

|                                                               Public constructors                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|---|
| [LaunchPerformanceBase](https://developer.android.com/reference/kotlin/android/test/LaunchPerformanceBase#LaunchPerformanceBase())`()` <br /> |

|                                                                                                                   Protected methods                                                                                                                    ||
|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [LaunchApp](https://developer.android.com/reference/kotlin/android/test/LaunchPerformanceBase#LaunchApp())`()` Launches intent, and waits for idle before returning. |

| Inherited functions ||
|---|---|
| From class[Instrumentation](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#) |--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [TestLooperManager](https://developer.android.com/reference/kotlin/android/os/TestLooperManager.html#)!                              | [acquireLooperManager](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#acquireLooperManager(android.os.Looper))`(`looper:` `[Looper](https://developer.android.com/reference/kotlin/android/os/Looper.html#)!`)` <br /> Takes control of the execution of messages on the specified looper until[TestLooperManager.release](https://developer.android.com/reference/kotlin/android/os/TestLooperManager.html#release())is called. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [addMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#addMonitor(android.app.Instrumentation.ActivityMonitor))`(`monitor:` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)!`)` <br /> Add a new[ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)that will be checked whenever an activity is started. The monitor is added after any existing ones; the monitor will be hit only if none of the existing monitors can themselves handle the Intent. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Instrumentation.ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)! | [addMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#addMonitor(android.content.IntentFilter,%20android.app.Instrumentation.ActivityResult,%20kotlin.Boolean))`(`filter:` `[IntentFilter](https://developer.android.com/reference/kotlin/android/content/IntentFilter.html#)!`, `result:` `[Instrumentation.ActivityResult](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityResult.html#)!`, `block:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> A convenience wrapper for[addMonitor(android.app.Instrumentation.ActivityMonitor)](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#addMonitor(android.app.Instrumentation.ActivityMonitor))that creates an intent filter matching[ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)for you and returns it. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Instrumentation.ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)! | [addMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#addMonitor(kotlin.String,%20android.app.Instrumentation.ActivityResult,%20kotlin.Boolean))`(`cls:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `result:` `[Instrumentation.ActivityResult](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityResult.html#)!`, `block:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> A convenience wrapper for[addMonitor(android.app.Instrumentation.ActivityMonitor)](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#addMonitor(android.app.Instrumentation.ActivityMonitor))that creates a class matching[ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)for you and returns it. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [addResults](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#addResults(android.os.Bundle))`(`results:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` <br /> Report some results in the middle of instrumentation execution. Later results (including those provided by[finish](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#finish(kotlin.Int,%20android.os.Bundle))) will be combined with android.os.Bundle#putAll. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnCreate](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnCreate(android.app.Activity,%20android.os.Bundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`, `icicle:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` <br /> Perform calling of an activity's android.app.Activity#onCreate method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnCreate](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnCreate(android.app.Activity,%20android.os.Bundle,%20android.os.PersistableBundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`, `icicle:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`, `persistentState:` `[PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)!`)` <br /> Perform calling of an activity's android.app.Activity#onCreate method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnDestroy](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnDestroy(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`)` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnNewIntent](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnNewIntent(android.app.Activity,%20android.content.Intent))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`, `intent:` `[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)!`)` <br /> Perform calling of an activity's android.app.Activity#onNewIntent method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnNewIntent](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnNewIntent(android.app.Activity,%20android.content.Intent,%20android.app.ComponentCaller))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`, `intent:` `[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)`, `caller:` `[ComponentCaller](https://developer.android.com/reference/kotlin/android/app/ComponentCaller.html#)`)` <br /> Same as[callActivityOnNewIntent(android.app.Activity,android.content.Intent)](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnNewIntent(android.app.Activity,%20android.content.Intent)), but with an extra parameter for the[ComponentCaller](https://developer.android.com/reference/kotlin/android/app/ComponentCaller.html#)instance associated with the app that sent the intent. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnPause](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnPause(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`)` <br /> Perform calling of an activity's[Activity.onPause](https://developer.android.com/reference/kotlin/android/app/Activity.html#onPause())method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnPictureInPictureRequested](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnPictureInPictureRequested(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`)` <br /> Perform calling of an activity's[Activity.onPictureInPictureRequested](https://developer.android.com/reference/kotlin/android/app/Activity.html#onPictureInPictureRequested())method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnPostCreate](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnPostCreate(android.app.Activity,%20android.os.Bundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`, `savedInstanceState:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`)` <br /> Perform calling of an activity's android.app.Activity#onPostCreate method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnPostCreate](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnPostCreate(android.app.Activity,%20android.os.Bundle,%20android.os.PersistableBundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`, `savedInstanceState:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`, `persistentState:` `[PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)?`)` <br /> Perform calling of an activity's android.app.Activity#onPostCreate method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnRestart](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnRestart(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`)` <br /> Perform calling of an activity's[Activity.onRestart](https://developer.android.com/reference/kotlin/android/app/Activity.html#onRestart())method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnRestoreInstanceState](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnRestoreInstanceState(android.app.Activity,%20android.os.Bundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`, `savedInstanceState:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)`)` <br /> Perform calling of an activity's android.app.Activity#onRestoreInstanceState method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnRestoreInstanceState](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnRestoreInstanceState(android.app.Activity,%20android.os.Bundle,%20android.os.PersistableBundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`, `savedInstanceState:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`, `persistentState:` `[PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)?`)` <br /> Perform calling of an activity's android.app.Activity#onRestoreInstanceState method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnResume](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnResume(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`)` <br /> Perform calling of an activity's[Activity.onResume](https://developer.android.com/reference/kotlin/android/app/Activity.html#onResume())method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnSaveInstanceState](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnSaveInstanceState(android.app.Activity,%20android.os.Bundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`, `outState:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)`)` <br /> Perform calling of an activity's android.app.Activity#onSaveInstanceState method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnSaveInstanceState](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnSaveInstanceState(android.app.Activity,%20android.os.Bundle,%20android.os.PersistableBundle))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)`, `outState:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)`, `outPersistentState:` `[PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)`)` <br /> Perform calling of an activity's android.app.Activity#onSaveInstanceState method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnStart](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnStart(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`)` <br /> Perform calling of an activity's[Activity.onStart](https://developer.android.com/reference/kotlin/android/app/Activity.html#onStart())method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnStop](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnStop(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`)` <br /> Perform calling of an activity's[Activity.onStop](https://developer.android.com/reference/kotlin/android/app/Activity.html#onStop())method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callActivityOnUserLeaving](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callActivityOnUserLeaving(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`)` <br /> Perform calling of an activity's[Activity.onUserLeaveHint](https://developer.android.com/reference/kotlin/android/app/Activity.html#onUserLeaveHint())method. The default implementation simply calls through to that method. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [callApplicationOnCreate](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#callApplicationOnCreate(android.app.Application))`(`app:` `[Application](https://developer.android.com/reference/kotlin/android/app/Application.html#)!`)` <br /> Perform calling of the application's[Application.onCreate](https://developer.android.com/reference/kotlin/android/app/Application.html#onCreate())method. The default implementation simply calls through to that method. Note: This method will be called immediately after[onCreate(android.os.Bundle)](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#onCreate(android.os.Bundle)). Often instrumentation tests start their test thread in onCreate(); you need to be careful of races between these. (Well between it and everything else, but let's start here.) <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                   | [checkMonitorHit](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#checkMonitorHit(android.app.Instrumentation.ActivityMonitor,%20kotlin.Int))`(`monitor:` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)!`, `minHits:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Test whether an existing[ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)has been hit. If the monitor has been hit at least minHits times, then it will be removed from the activity monitor list and true returned. Otherwise it is left as-is and false is returned. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [endPerformanceSnapshot](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#endPerformanceSnapshot())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [finish](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#finish(kotlin.Int,%20android.os.Bundle))`(`resultCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `results:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` <br /> Terminate instrumentation of the application. This will cause the application process to exit, removing this instrumentation from the next time the application is started. If multiple processes are currently running for this instrumentation, all of those processes will be killed. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!                                                    | [getAllocCounts](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getAllocCounts())`()` <br /> Returns a bundle with the current results from the allocation counting. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!                                                    | [getBinderCounts](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getBinderCounts())`()` <br /> Returns a bundle with the counts for various binder counts for this process. Currently the only two that are reported are the number of send and the number of received transactions. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)!                                 | [getComponentName](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getComponentName())`()` <br /> Returns complete component name of this instrumentation. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!                                             | [getContext](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getContext())`()` <br /> Return the Context of this instrumentation's package. Note that this is often different than the Context of the application being instrumentated, since the instrumentation code often lives is a different package than that of the application it is running against. See[getTargetContext](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getTargetContext())to retrieve a Context for the target application. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!                                                    | [getProcessName](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getProcessName())`()` <br /> Return the name of the process this instrumentation is running in. Note this should only be used for testing and debugging. If you are thinking about using this to, for example, conditionalize what is initialized in an Application class, it is strongly recommended to instead use lazy initialization (such as a getter for the state that only creates it when requested). This can greatly reduce the work your process does when created for secondary things, such as to receive a broadcast. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!                                             | [getTargetContext](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getTargetContext())`()` <br /> Return a Context for the target application being instrumented. Note that this is often different than the Context of the instrumentation code, since the instrumentation code often lives is a different package than that of the application it is running against. See[getContext](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getContext())to retrieve a Context for the instrumentation code. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | [UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)!                                       | [getUiAutomation](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getUiAutomation())`()` <br /> Gets the[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)instance with no flags set. **Note:** The APIs exposed via the returned[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)work across application boundaries while the APIs exposed by the instrumentation do not. For example,[Instrumentation.sendPointerSync(MotionEvent)](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendPointerSync(android.view.MotionEvent))will not allow you to inject the event in an app different from the instrumentation target, while[UiAutomation.injectInputEvent(android.view.InputEvent, boolean)](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#injectInputEvent(android.view.InputEvent,%20kotlin.Boolean))will work regardless of the current application. A typical test case should be using either the[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)or[Instrumentation](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#)APIs. Using both APIs at the same time is not a mistake by itself but a client has to be aware of the APIs limitations. Equivalent to`getUiAutomation(0)`. If a[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)exists with different flags, the flags on that instance will be changed, and then it will be returned. Compatibility mode: This method is infallible for apps targeted for[Build.VERSION_CODES.R](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int)and earlier versions; for apps targeted for later versions, it will return null if[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)fails to connect. The caller can check the return value and retry on error. <br />                                                          | | [UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)!                                       | [getUiAutomation](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getUiAutomation(kotlin.Int))`(`flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Gets the[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)instance with flags set. **Note:** The APIs exposed via the returned[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)work across application boundaries while the APIs exposed by the instrumentation do not. For example,[Instrumentation.sendPointerSync(MotionEvent)](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendPointerSync(android.view.MotionEvent))will not allow you to inject the event in an app different from the instrumentation target, while[UiAutomation.injectInputEvent(android.view.InputEvent, boolean)](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#injectInputEvent(android.view.InputEvent,%20kotlin.Boolean))will work regardless of the current application. A typical test case should be using either the[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)or[Instrumentation](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#)APIs. Using both APIs at the same time is not a mistake by itself but a client has to be aware of the APIs limitations. If a[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)exists with different flags, the flags on that instance will be changed, and then it will be returned. Compatibility mode: This method is infallible for apps targeted for[Build.VERSION_CODES.R](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int)and earlier versions; for apps targeted for later versions, it will return null if[UiAutomation](https://developer.android.com/reference/kotlin/android/app/UiAutomation.html#)fails to connect. The caller can check the return value and retry on error. <br /> | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                   | [invokeContextMenuAction](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#invokeContextMenuAction(android.app.Activity,%20kotlin.Int,%20kotlin.Int))`(`targetActivity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`, `id:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `flag:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Show the context menu for the currently focused view and executes a particular context menu item. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                   | [invokeMenuActionSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#invokeMenuActionSync(android.app.Activity,%20kotlin.Int,%20kotlin.Int))`(`targetActivity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`, `id:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `flag:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Execute a particular menu item. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                   | [isProfiling](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#isProfiling())`()` <br /> Check whether this instrumentation was started with profiling enabled. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!                                               | [newActivity](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#newActivity(java.lang.Class,%20android.content.Context,%20android.os.IBinder,%20android.app.Application,%20android.content.Intent,%20android.content.pm.ActivityInfo,%20kotlin.CharSequence,%20android.app.Activity,%20kotlin.String,%20kotlin.Any))`(`clazz:` `[Class](https://developer.android.com/reference/kotlin/java/lang/Class.html#)<*>!`, `context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!`, `token:` `[IBinder](https://developer.android.com/reference/kotlin/android/os/IBinder.html#)!`, `application:` `[Application](https://developer.android.com/reference/kotlin/android/app/Application.html#)!`, `intent:` `[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)!`, `info:` `[ActivityInfo](https://developer.android.com/reference/kotlin/android/content/pm/ActivityInfo.html#)!`, `title:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`, `parent:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!`, `id:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `lastNonConfigurationInstance:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`)` <br /> Perform instantiation of an[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)object. This method is intended for use with unit tests, such as android.test.ActivityUnitTestCase. The activity will be useable locally but will be missing some of the linkages necessary for use within the system. <br />                                                                                                                                                                                                                                                                                                                                                                                                                  | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!                                               | [newActivity](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#newActivity(java.lang.ClassLoader,%20kotlin.String,%20android.content.Intent))`(`cl:` `[ClassLoader](https://developer.android.com/reference/kotlin/java/lang/ClassLoader.html#)!`, `className:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `intent:` `[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)!`)` <br /> Perform instantiation of the process's[Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)object. The default implementation provides the normal system behavior. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Application](https://developer.android.com/reference/kotlin/android/app/Application.html#)!                                         | [newApplication](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#newApplication(java.lang.ClassLoader,%20kotlin.String,%20android.content.Context))`(`cl:` `[ClassLoader](https://developer.android.com/reference/kotlin/java/lang/ClassLoader.html#)!`, `className:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!`)` <br /> Perform instantiation of the process's[Application](https://developer.android.com/reference/kotlin/android/app/Application.html#)object. The default implementation provides the normal system behavior. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Application](https://developer.android.com/reference/kotlin/android/app/Application.html#)!                                         | [newApplication](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#newApplication(java.lang.Class,%20android.content.Context))`(`clazz:` `[Class](https://developer.android.com/reference/kotlin/java/lang/Class.html#)<*>!`, `context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!`)` <br /> Perform instantiation of the process's[Application](https://developer.android.com/reference/kotlin/android/app/Application.html#)object. The default implementation provides the normal system behavior. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [onCreate](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#onCreate(android.os.Bundle))`(`arguments:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` <br /> Called when the instrumentation is starting, before any application code has been loaded. Usually this will be implemented to simply call[start](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#start())to begin the instrumentation thread, which will then continue execution in[onStart](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#onStart()). If you do not need your own thread -- that is you are writing your instrumentation to be completely asynchronous (returning to the event loop so that the application can run), you can simply begin your instrumentation here, for example call android.content.Context#startActivity to begin the appropriate first activity of the application. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [onDestroy](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#onDestroy())`()` <br /> Called when the instrumented application is stopping, after all of the normal application cleanup has occurred. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                   | [onException](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#onException(kotlin.Any,%20kotlin.Throwable))`(`obj:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`, `e:` `[Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)!`)` <br /> This is called whenever the system captures an unhandled exception that was thrown by the application. The default implementation simply returns false, allowing normal system handling of the exception to take place. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [onStart](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#onStart())`()` <br /> Method where the instrumentation thread enters execution. This allows you to run your instrumentation code in a separate thread than the application, so that it can perform blocking operation such as[sendKeySync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendKeySync(android.view.KeyEvent))or #startActivitySync. You will typically want to call finish() when this function is done, to end your instrumentation. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [removeMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#removeMonitor(android.app.Instrumentation.ActivityMonitor))`(`monitor:` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)!`)` <br /> Remove an[ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)that was previously added with #addMonitor. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [resetInTouchMode](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#resetInTouchMode())`()` <br /> Resets the[touch mode](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#setInTouchMode(kotlin.Boolean))to the device default. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [runOnMainSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#runOnMainSync(java.lang.Runnable))`(`runner:` `[Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#)!`)` <br /> Execute a call on the application's main thread, blocking until it is complete. Useful for doing things that are not thread-safe, such as looking at or modifying the view hierarchy. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [sendCharacterSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendCharacterSync(kotlin.Int))`(`keyCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Sends up and down key events with the given key code to the currently focused window, and waits for it to be processed. Equivalent to[sendKeyDownUpSync(int)](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendKeyDownUpSync(kotlin.Int)). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [sendKeyDownUpSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendKeyDownUpSync(kotlin.Int))`(`keyCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Sends up and down key events with the given key code to the currently focused window, and waits for it to be processed. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [sendKeySync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendKeySync(android.view.KeyEvent))`(`event:` `[KeyEvent](https://developer.android.com/reference/kotlin/android/view/KeyEvent.html#)!`)` <br /> Sends a key event to the currently focused window, and waits for it to be processed. This method blocks until the recipient has finished handling the event. Note that the recipient may*not*have completely finished reacting from the event when this method returns. For example, it may still be in the process of updating its display or UI contents upon reacting to the injected event. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [sendPointerSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendPointerSync(android.view.MotionEvent))`(`event:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent.html#)!`)` <br /> Dispatches a pointer event into a window owned by the instrumented application, and waits for it to be processed. If the motion event being injected is targeted at a window that is not owned by the instrumented application, the input injection will fail. See[getUiAutomation()](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#getUiAutomation())for injecting events into all windows. This method blocks until the recipient has finished handling the event. Note that the recipient may*not*have completely finished reacting from the event when this method returns. For example, it may still be in the process of updating its display or UI contents upon reacting to the injected event. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [sendStatus](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendStatus(kotlin.Int,%20android.os.Bundle))`(`resultCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `results:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` <br /> Provide a status report about the application. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [sendStringSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendStringSync(kotlin.String))`(`text:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> Sends the key events that result in the given text being typed into the currently focused window, and waits for it to be processed. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [sendTrackballEventSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#sendTrackballEventSync(android.view.MotionEvent))`(`event:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent.html#)!`)` <br /> Dispatches a trackball event into the currently focused window, and waits for it to be processed. This method blocks until the recipient has finished handling the event. Note that the recipient may*not*have completely finished reacting from the event when this method returns. For example, it may still be in the process of updating its display or UI contents upon reacting to the injected event. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [setAutomaticPerformanceSnapshots](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#setAutomaticPerformanceSnapshots())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [setInTouchMode](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#setInTouchMode(kotlin.Boolean))`(`inTouch:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Force the global system in or out of touch mode. This can be used if your instrumentation relies on the UI being in one more or the other when it starts. **Note:** Starting from Android[Build.VERSION_CODES.TIRAMISU](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int), this method will only take effect if the instrumentation was sourced from a process with`MODIFY_TOUCH_MODE_STATE`internal permission granted (shell already have it). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [start](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#start())`()` <br /> Create and start a new thread in which to run instrumentation. This new thread will call to[onStart](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#onStart())where you can implement the instrumentation. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!                                               | [startActivitySync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#startActivitySync(android.content.Intent))`(`intent:` `[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)!`)` <br /> Start a new activity and wait for it to begin running before returning. In addition to being synchronous, this method as some semantic differences from the standard android.content.Context#startActivity call: the activity component is resolved before talking with the activity manager (its class name is specified in the Intent that this method ultimately starts), and it does not allow you to start activities that run in a different process. In addition, if the given Intent resolves to multiple activities, instead of displaying a dialog for the user to select an activity, an exception will be thrown. The function returns as soon as the activity goes idle following the call to its android.app.Activity#onCreate. Generally this means it has gone through the full initialization including[Activity.onResume](https://developer.android.com/reference/kotlin/android/app/Activity.html#onResume())and drawn and displayed its initial window. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)                                                | [startActivitySync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#startActivitySync(android.content.Intent,%20android.os.Bundle))`(`intent:` `[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)`, `options:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`)` <br /> Start a new activity and wait for it to begin running before returning. In addition to being synchronous, this method as some semantic differences from the standard android.content.Context#startActivity call: the activity component is resolved before talking with the activity manager (its class name is specified in the Intent that this method ultimately starts), and it does not allow you to start activities that run in a different process. In addition, if the given Intent resolves to multiple activities, instead of displaying a dialog for the user to select an activity, an exception will be thrown. The function returns as soon as the activity goes idle following the call to its android.app.Activity#onCreate. Generally this means it has gone through the full initialization including[Activity.onResume](https://developer.android.com/reference/kotlin/android/app/Activity.html#onResume())and drawn and displayed its initial window. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [startAllocCounting](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#startAllocCounting())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [startPerformanceSnapshot](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#startPerformanceSnapshot())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [startProfiling](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#startProfiling())`()` <br /> This method will start profiling if isProfiling() returns true. You should only call this method if you set the handleProfiling attribute in the manifest file for this Instrumentation to true. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [stopAllocCounting](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#stopAllocCounting())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [stopProfiling](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#stopProfiling())`()` <br /> Stops profiling if isProfiling() returns true. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [waitForIdle](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#waitForIdle(java.lang.Runnable))`(`recipient:` `[Runnable](https://developer.android.com/reference/kotlin/java/lang/Runnable.html#)!`)` <br /> Schedule a callback for when the application's main thread goes idle (has no more events to process). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                         | [waitForIdleSync](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#waitForIdleSync())`()` <br /> Synchronously wait for the application to be idle. Can not be called from the main application thread -- use[start](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#start())to execute instrumentation in its own thread. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!                                               | [waitForMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#waitForMonitor(android.app.Instrumentation.ActivityMonitor))`(`monitor:` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)!`)` <br /> Wait for an existing[ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)to be hit. Once the monitor has been hit, it is removed from the activity monitor list and the first created Activity object that matched it is returned. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)!                                               | [waitForMonitorWithTimeout](https://developer.android.com/reference/kotlin/android/app/Instrumentation.html#waitForMonitorWithTimeout(android.app.Instrumentation.ActivityMonitor,%20kotlin.Long))`(`monitor:` `[Instrumentation.ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)!`, `timeOut:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` <br /> Wait for an existing[ActivityMonitor](https://developer.android.com/reference/kotlin/android/app/Instrumentation.ActivityMonitor.html#)to be hit till the timeout expires. Once the monitor has been hit, it is removed from the activity monitor list and the first created Activity object that matched it is returned. If the timeout expires, a null object is returned. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | ||

|                                                                                                         Properties                                                                                                         ||
|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| [Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)! | [mIntent](https://developer.android.com/reference/kotlin/android/test/LaunchPerformanceBase#mIntent:android.content.Intent) <br /> |
| [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!      | [mResults](https://developer.android.com/reference/kotlin/android/test/LaunchPerformanceBase#mResults:android.os.Bundle) <br />    |

## Public constructors

### LaunchPerformanceBase

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
LaunchPerformanceBase()
```

## Protected methods

### LaunchApp

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
protected open fun LaunchApp(): Unit
```

**Deprecated:** *Deprecated in Java.*

Launches intent, and waits for idle before returning.

## Properties

### mIntent

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
protected var mIntent: Intent!
```

**Deprecated:** *Deprecated in Java.*  

### mResults

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
protected var mResults: Bundle!
```

**Deprecated:** *Deprecated in Java.*