class DeviceInteraction


API surface for performing device-centric operations.

Summary

Public companion functions

DeviceInteraction

Set device screen to be folded with the hinge in the vertical position.

DeviceInteraction

Set device screen to be closed.

DeviceInteraction
DeviceInteraction.setDisplaySize(
    widthSizeClass: WidthSizeClass,
    heightSizeClass: HeightSizeClass
)

Set device's display size.

DeviceInteraction

Set device screen to be completely flat, like a tablet.

DeviceInteraction

Set device's screen orientation.

DeviceInteraction

Set device screen to be folded with the hinge in the horizontal position.

Public constructors

Public functions

DeviceInteraction

Performs the given action on the test device.

Public companion functions

fun DeviceInteraction.setBookMode(): DeviceInteraction

Set device screen to be folded with the hinge in the vertical position. For details on foldable postures, see https://developer.android.com/guide/topics/large-screens/learn-about-foldables#foldable_postures

This action is for foldable devices only. Currently only supported for tests run on Android Emulators.

fun DeviceInteraction.setClosedMode(): DeviceInteraction

Set device screen to be closed.

This action is for foldable devices only. Currently only supported for tests run on Android Emulators.

fun DeviceInteraction.setDisplaySize(
    widthSizeClass: WidthSizeClass,
    heightSizeClass: HeightSizeClass
): DeviceInteraction

Set device's display size.

Parameters
widthSizeClass: WidthSizeClass

the width to set the device display to

heightSizeClass: HeightSizeClass

the height to set the device display to

fun DeviceInteraction.setFlatMode(): DeviceInteraction

Set device screen to be completely flat, like a tablet. For details on foldable postures, see https://developer.android.com/guide/topics/large-screens/learn-about-foldables#foldable_postures

This action is for foldable devices only. Currently only supported for tests run on Android Emulators.

setScreenOrientation

fun DeviceInteraction.setScreenOrientation(orientation: ScreenOrientation): DeviceInteraction

Set device's screen orientation.

Parameters
orientation: ScreenOrientation

the orientation to set the device to (portait or landscape)

fun DeviceInteraction.setTabletopMode(): DeviceInteraction

Set device screen to be folded with the hinge in the horizontal position. For details on foldable postures, see https://developer.android.com/guide/topics/large-screens/learn-about-foldables#foldable_postures

This action is for foldable devices only. Currently only supported for tests run on Android Emulators.

Public constructors

DeviceInteraction

@Inject
DeviceInteraction(deviceController: DeviceController)

Public functions

perform

fun perform(action: DeviceAction): DeviceInteraction

Performs the given action on the test device. This method should not be called on the main thread. The calling thread is blocked until the requested device action is completed.

Parameters
action: DeviceAction

the DeviceAction to execute.

Returns
DeviceInteraction

this interaction for further perform/verification calls.

Throws
kotlin.IllegalStateException

when being invoked on the main thread.