public interface

DeviceController

 androidx.test.platform.device.DeviceController

Gradle dependencies

compile group: 'androidx.test', name: 'orchestrator', version: '1.5.0'

  • groupId: androidx.test
  • artifactId: orchestrator
  • version: 1.5.0

Artifact androidx.test:orchestrator:1.5.0 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.test:orchestrator com.android.support.test:orchestrator

Overview

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.

Summary

Methods
public voidsetDeviceMode(int deviceMode)

Sets the connected device to the provided mode.

public voidsetScreenOrientation(int screenOrientation)

Sets the connected device to the provided screen orientation.

Methods

public void setDeviceMode(int deviceMode)

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

Parameters:

deviceMode: the mode to put the device in

public void setScreenOrientation(int screenOrientation)

Sets the connected device to the provided screen orientation.

Parameters:

screenOrientation: the orientation to put the device in

Source

/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.test.platform.device;


/**
 * Provides base-level device operations that can be used to build user actions such as folding a
 * device, changing screen orientation etc.
 *
 * <p>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.
 */
public interface DeviceController {
  /**
   * Sets the connected device to the provided mode. unsupported device mode.
   *
   * @param deviceMode the mode to put the device in
   * @throws UnsupportedDeviceOperationException if used on an unsupported device.
   */
  void setDeviceMode(int deviceMode);

  /**
   * Sets the connected device to the provided screen orientation.
   *
   * @param screenOrientation the orientation to put the device in
   * @throws UnsupportedDeviceOperationException if used on an unsupported device.
   */
  void setScreenOrientation(int screenOrientation);

  /** Enum for screen orientations a device can be set to. */
  enum ScreenOrientation {
    PORTRAIT,
    LANDSCAPE
  }
}