{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

DeviceController

interface DeviceController


Provides base-level device operations that can be used to build user actions such as folding a device, changing screen orientation etc.

This is a low level API, typically used by higher level test frameworks. It is generally not recommended for direct use by most tests. Please use high-level Espresso device APIs to interact with the device.

This API is experimental and is subject to change or removal in future releases.

Summary

Nested types

DeviceController.ScreenOrientation

Enum for screen orientations a device can be set to.

Public methods

abstract @NonNull void
setDeviceMode(@NonNull int deviceMode)

Sets the connected device to the provided mode.

abstract @NonNull void
setScreenOrientation(@NonNull int screenOrientation)

Sets the connected device to the provided screen orientation.

Public methods

setDeviceMode

@NonNull
public abstract void setDeviceMode(@NonNull int deviceMode)

Sets the connected device to the provided mode. unsupported device mode.

Parameters
@NonNull int deviceMode

the mode to put the device in

setScreenOrientation

@NonNull
public abstract void setScreenOrientation(@NonNull int screenOrientation)

Sets the connected device to the provided screen orientation.

Parameters
@NonNull int screenOrientation

the orientation to put the device in