finish

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.

Parameters

resultCode

int

results

Bundle

interceptActivityUsing

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.

setJsBridgeClassName

specifyDexMakerCacheProperty

void specifyDexMakerCacheProperty ()

waitForActivitiesToComplete

void waitForActivitiesToComplete ()

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.