DeviceActions


public final class DeviceActions


Public methods

static final @NonNull DeviceAction

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

static final @NonNull DeviceAction

Set device screen to be closed.

static final @NonNull DeviceAction
setDisplaySize(
    @NonNull WidthSizeClass widthSizeClass,
    @NonNull HeightSizeClass heightSizeClass
)

Set device's window size.

static final @NonNull DeviceAction

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

static final @NonNull DeviceAction

Set device's screen orientation.

static final @NonNull DeviceAction

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

Public methods

public static final @NonNull DeviceAction setBookMode()

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.

public static final @NonNull DeviceAction setClosedMode()

Set device screen to be closed.

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

public static final @NonNull DeviceAction setDisplaySize(
    @NonNull WidthSizeClass widthSizeClass,
    @NonNull HeightSizeClass heightSizeClass
)

Set device's window size.

Parameters
@NonNull WidthSizeClass widthSizeClass

the window width to set the device to

@NonNull HeightSizeClass heightSizeClass

the window height to set the device to

public static final @NonNull DeviceAction setFlatMode()

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

public static final @NonNull DeviceAction setScreenOrientation(@NonNull ScreenOrientation orientation)

Set device's screen orientation.

Parameters
@NonNull ScreenOrientation orientation

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

public static final @NonNull DeviceAction setTabletopMode()

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.

Learn about Gemini privacy policies.

Updated Apr 30, 2024

Develop your UI on Android.

Updated Jan 9, 2025

Find the training option that's right for you.

Updated Dec 27, 2019