Camera ITS foldables testing

From Android 13, Camera ITS includes testing support for foldable devices. Foldable devices have cameras that are available or unavailable depending on whether the device is in a folded or unfolded state.

The camera IDs change depending on the device type, model, and brand; and the availability of physical front cameras change depending on the state. Because of this, Camera ITS dynamically determines the scene and camera combinations to use for testing. As cameras need to be tested in both the folded and unfolded states, foldables testing requires the DUT to be remounted during the testing process.

Front and rear camera testing

The camera sensors available on a foldable device are different depending on whether the device is in a folded or unfolded state. For foldables, the front camera availability changes depending on the state. For example, the front camera isn't available in the folded state. Because of this change in front camera availability, front cameras must be tested in both the folded and unfolded states. Camera ITS assumes the rear camera's availability remains the same whether the device is folded or unfolded, so rear cameras only need to be tested once.

Depending on the state of the device, Camera ITS filters out the unavailable camera devices and the camera devices don't appear in the list of camera and scene combinations.

The following table describes the Camera ITS test behavior for each camera orientation.

Camera orientation Camera ITS test behavior
Rear camera Tests camera once in either the folded or unfolded state
Primary front camera Tests camera once in the folded state and once in the unfolded state.
Physical front camera Tests camera only in states where the camera is available.

Test procedure

This section describes the steps to test cameras for foldable devices.

Set up device

For setup information, see Setup.

Grant test API access

For Camera ITS to determine whether the device is foldable or not, you must grant test API access before invoking the tests. If access isn't granted, running the Camera ITS tests results in the app crashing.

To grant access, run the following ADB command. This command needs to be run once for a single device. If CTS Verifier is reinstalled with a different version, you must run the command again.

adb shell am compat enable ALLOW_TEST_API_ACCESS

Configuration file

To specify that the device is a foldable device, add the foldable_device parameter in both tablet and sensor_fusion testbeds in the config.yml file. Camera ITS uses this parameter to determine the camera_id and scene combinations for folded and unfolded states.

The following is an example of a config.yml file for a foldable device.

    # Test configuration for scenes[0:4, 6]
          - serial: 8A9X0NS5Z
            label: dut
          - serial: 5B16001229
            label: tablet

      brightness: 192
      chart_distance: 22.0
      debug_mode: "False"     # "quotes" needed
      chart_loc_arg: ""
      camera: 0
      scene: scene2_a
  lighting_cntl: arduino    # can be "arduino" or "None"
  lighting_ch: 1
  foldable_device: "True"     # "False" for non-foldable DUTs

Run tests

To run the ITS tests on a foldable device, run the command. For details see, Invoking tests.

When running Camera ITS on a foldable device, the primary front camera is tested in both states, folded and unfolded. If the device is folded, results are displayed under the camera1_SCENE_NAME_folded option in the CTS Verifier app. Depending on the device state, certain front physical camera IDs are unavailable and aren't tested. The rear camera only needs to be tested in one state, preferably the folded state, and the results for the rear camera don't have the _folded suffix.

To ensure that the folded scenes are executed with the device folded and check the state of the foldable DUT, run the following command.

adb shell cmd device_state state

When executing tests in a folded state, Camera ITS displays a message in the terminal to prompt the user to set up the device properly on the ITS box. To continue executing the test after the prompt, hit Enter.

If you're running all scenes in both the folded and unfolded states, the folded scenes are executed first, followed by the unfolded scenes. This minimizes the amount of remounting required during testing.

Camera ITS also adds the folded suffix to the tmp directory created for folded state scenes.

Sample commands

The following are sample commands for test execution on foldable devices.

Command Description
python tools/ Runs all the scenes.
python tools/ scenes=scene0 Runs scene0. If the device is folded and the user is testing the primary front camera, the script determines the device state and add the suffix _folded to the scene name. Users don't have to add the suffix to run the folded scenes.
python tests/scene0/ -c config.yml Runs a specific test.