BinderStressCreator


@UnstableApi
@RequiresApi(value = 23)
class BinderStressCreator : AutoCloseable


A utility for creating artificial stress on the system process binder.

While the class is active, any attempt to call a binder method to the system process will be much slower.

This class should be used in a try-with-resources block.

Use verifyNoSystemBinderCalls to verify no system binder calls happen in a test.

Summary

Public constructors

Public functions

Unit
java-static Unit
<T> verifyNoSystemBinderCalls(
    systemUnderTest: Supplier<T!>!,
    cleanUp: Consumer<T!>!
)

Verifies that the provided system-under-test does not exercise any system binder calls by comparing the run time with and without additional stress caused by .

Public constructors

BinderStressCreator

BinderStressCreator(context: Context!)

Public functions

close

fun close(): Unit

verifyNoSystemBinderCalls

java-static fun <T> verifyNoSystemBinderCalls(
    systemUnderTest: Supplier<T!>!,
    cleanUp: Consumer<T!>!
): Unit

Verifies that the provided system-under-test does not exercise any system binder calls by comparing the run time with and without additional stress caused by .

Parameters
systemUnderTest: Supplier<T!>!

The system-under-test that can return a test object for later clean-up.

cleanUp: Consumer<T!>!

The clean-up stage for the system-under-test.