| java.lang.Object | |||
| ↳ | android.app.Instrumentation | ||
| ↳ | android.support.test.internal.runner.hidden.ExposedInstrumentationApi | ||
| ↳ | android.support.test.runner.MonitoringInstrumentation | ||
Known Direct Subclasses
|
An instrumentation that enables several advanced features and makes some hard guarantees about the state of the application under instrumentation.
A short list of these capabilities:| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| MonitoringInstrumentation.ActivityFinisher | Loops through all the activities that have not yet finished and explicitly calls finish on them. | ||||||||||
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Instrumentation
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
This API was added in Android API 23 (M)
| |||||||||||
This API was added in Android API 17 (JELLY_BEAN_MR1)
| |||||||||||
Ensures all activities launched in this instrumentation are finished before the
instrumentation exits.
| |||||||||||
Use the given InterceptingActivityFactory to create Activity instance in
newActivity(ClassLoader, String, Intent).
| |||||||||||
Sets up lifecycle monitoring, and argument registry.
| |||||||||||
This implementation of onStart() will guarantee that the Application's onCreate method
has completed when it returns.
| |||||||||||
Use default mechanism of creating activity instance in
newActivity(ClassLoader, String, Intent)
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Ensures we've onStopped() all activities which were onStarted().
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| From class android.support.test.internal.runner.hidden.ExposedInstrumentationApi | |||||||||||
From class
android.app.Instrumentation
| |||||||||||
From class
java.lang.Object
| |||||||||||
This API was added in Android API 23 (M)
This API was added in Android API 17 (JELLY_BEAN_MR1)
Ensures all activities launched in this instrumentation are finished before the instrumentation exits.
Subclasses who override this method should do their finish processing and then call super.finish to invoke this logic. Not waiting for all activities to finish() before exiting can cause device wide instability.
Use the given InterceptingActivityFactory to create Activity instance in
newActivity(ClassLoader, String, Intent). This can be used to override default
behavior of activity in tests e.g. mocking startService() method in Activity under test,
to avoid starting the real service and instead verifying that a particular service was
started.
| interceptingActivityFactory | InterceptingActivityFactory to be used for creating
activity instance in newActivity(ClassLoader, String, Intent)
|
|---|
| InstantiationException | |
|---|---|
| IllegalAccessException | |
| ClassNotFoundException |
| InstantiationException | |
|---|---|
| IllegalAccessException |
Sets up lifecycle monitoring, and argument registry.
Subclasses must call up to onCreate(). This onCreate method does not call start() it is the subclasses responsibility to call start if it desires.
This implementation of onStart() will guarantee that the Application's onCreate method has completed when it returns.
Subclasses should call super.onStart() before executing any code that touches the application and it's state.
Use default mechanism of creating activity instance in
newActivity(ClassLoader, String, Intent)
Ensures we've onStopped() all activities which were onStarted().
According to Activity's contract, the process is not killable between onStart and onStop. Breaking this contract (which finish() will if you let it) can cause bad behaviour (including a full restart of system_server).
We give the app 2 seconds to stop all its activities, then we proceed.