Camera HAL testing checklist

This page lists all tests available for evaluating the Android camera hardware abstraction layer (HAL). It is intended for original equipment manufacturers (OEMs) and application processor (AP) vendors so they may ensure proper implementation of the camera HAL with minimum defects. Although this is a voluntary addition to the Android Compatibility Test Suite (CTS), it greatly increases camera test coverage and will certainly identify potential bugs.

By passing these tests, OEMs validate whether they have properly integrated the Android camera hardware abstraction layer (HAL) 3 interfaces. When conforming with all items in the checklist, a device implementation may be considered full with respect to the Android Camera HAL interfaces. This will in turn enable a device to properly support the android.hardware.camera2 package that camera apps build upon.

Camera HAL3 specification

The Android Camera HAL3 specification is the authoritative source of information on what devices must satisfy; this page provides a summary of all tests that can be used as a checklist. Camera HAL implementers (e.g. AP vendors) should go through the Camera HAL3 specification line-by-line and ensure their devices conform to it.

The current HAL specification is defined in these files within the Android 5.0 and later generic Android Platform Development Kit (PDK):

Camera test types

Here are the primary types of tests available for the latest Android camera along with references to associated instructions below:

All of these test types are described in detail below. These tests are presented in the chronological order in which OEMs are expected to execute them.

For instance, if a device fails the native tests, it will assuredly fail the subsequent Compatibility Test Suite (CTS) tests. And if a device fails CTS, there is little use in proceeding to the Image Test Suite (ITS). We recommend addressing failures in each test type before proceeding to the next set of tests.

Vendor Test Suite (VTS) tests

The Android Vendor Test Suite (VTS) is a testing suite that works on the HIDL interface level. For more information on using VTS, see Vendor Test Suite.

Compatibility Test Suite (CTS) tests

Camera Android Compatibility Test Suite (CTS) tests focus upon device compatibility. For information on setting up a test environment, see Setting up CTS.

The starting path for camera CTS tests is: platform/cts.

When running camera CTS for devices that support external cameras (such as USB webcams), you must have a device plugged in when running CTS or the tests will automatically fail. Examples of external cameras include: Logitech HD Pro Webcam C920 and the Microsoft LifeCam HD-3000.

See the CTS introduction and its subpages for general instructions on running CTS.

CTS tests for the android.hardware.Camera API

Find these camera tests under cts/tests/tests/:

  • hardware/src/android/hardware/cts/
  • hardware/src/android/hardware/cts/
  • hardware/src/android/hardware/cts/
  • permission/src/android/permission/cts/

CTS tests for the android.hardware.camera2 API

Find these camera tests under cts/tests/tests/:

  • hardware/src/android/hardware/camera2/cts/*
  • permission/src/android/permission/cts/

CTS Verifier camera tests

Find these camera tests under: cts/apps/CtsVerifier/src/com/android/cts/verifier/camera/*

Image Test Suite (ITS) tests

The Camera Image Test Suite (ITS) tests focus on image correctness. To perform the tests, run the Python scripts on a workstation with the Android device connected over USB.

The Camera ITS infrastructure and tests are located in the cts/apps/CameraITS directory. Each test resides in a tests/scene# subdirectory.

For more information on how to set up and run the tests, see Camera ITS.

For scene and test descriptions, see Camera ITS Tests.

ITS tests either pass or fail. All mandated tests in each scene folder must pass. Tests that aren't mandated can fail and still count as a pass in CtsVerifier.

ITS tests test scenarios that aren't tested in CTS and are an important component of the HAL 3.2 test plan.

Media Framework tests

Pass all of the camera-related media tests in MediaFrameworkTest. Please note, these tests require the mediaframeworktest.apk be installed on the Android device. You will need to make mediaframeworktest and then use adb to install the resulting .apk. Example commands are included below.

The starting path for Camera-related media framework tests is: platform/frameworks/base

Find the source code for the tests here: frameworks/base/media/tests/MediaFrameworkTest

To set up these tests:

make mediaframeworktest
adb install out/target/product/name/data/app/mediaframeworktest.apk

Where the name variable represents the directory containing the vendor's product.

Find all of the tests in the following directory or its subdirectories:


Each subdirectory represents a class of tests:

  • functional/
  • integration/
  • performance/
  • power/
  • stress/
  • unit/

Run Media Framework tests

To see all of the available tests::

adb shell pm list instrumentation

This will yield results resembling:

Identify and extract the component (between instrumentation: and ( from each test line. The component is composed of the target package name ( and the test runner name (MediaFrameworkTestRunner).

For instance:

You may then pass each component to adb shell am instrument like so:

adb shell am instrument -w

Where equals the extracted value above. For example:

adb shell am instrument -w

Please note, while the class path is the Java package + class name, the instrumentation package isn't necessarily the same as the Java package. Make sure you use the AndroidManifest.xml package when concatenating the component name, not the Java package in which the test runner class resides.

To run a single class of tests, pass the -e class argument, like so:

adb shell am instrument -e class -w

To run only a single method in a test class, append a pound (#) sign and the method name (in this case, testConnectPro) to the class name, like so:

adb shell am instrument -e class '' -w

Media settings functional tests

Here is an example run of a functional test. This test verifies the basic functionality of different combinations of camera settings. (ie, Flash, exposure, WB, scene, picture size and geoTag)

Run the test command:

adb shell am instrument -w -r  -e delay_msec 15 -e log true -e class

Media integration tests

Here is an example run of an integration test, in this case mediaframeworktest/integration/ and mediaframeworktest/

adb  shell am instrument -e class \ '' -w \ ''

If successful, this results in output resembling:

Test results for CameraStressTestRunner=...........
Time: 3.328

OK (11 tests)


Media performance tests

This preview memory test will open and release the camera preview for 200 times. In each 20 iterations, the snapshot of ps mediaserver will be recorded and it will compare the memory usage different after 200 iterations. Test will fail If the difference is greater than 150kM.

Run the test command:

adb shell am instrument -w -r  -e class

More detailed output can be found in: /sdcard/mediaMemOutput.txt

Media unit tests

The commands to run unit tests are all similar. For example, for, the command would be:

adb shell am instrument -e class '' -w ''

Media stress tests

This test is to stress out the camera image capture and video recording.

Run the test command:

adb shell am instrument -w

All tests should pass.

Manual TestingCam tests

The TestingCam app should be run manually with the following checks performed. The source for TestingCam is here: pdk/apps/TestingCamera/

Infinity focus with camera tilt

Start TestingCam, turn on preview, and ensure that autofocus mode is set to infinity. Using the Take picture button, capture shots of distant subjects (at least 10m away) with the camera pointed horizontally, upwards (close to vertical), and downwards (close to vertical); an example of the upwards shot could be high leaves/branches of a tree from beneath and an example of the downwards shot could be the street as seen from the roof of a building. In all cases, the distant subject should be sharp and in focus. Save and view the shots in the gallery view so that you can zoom in and inspect the sharpness more easily.

Note that for a camera with a VCM actuator to pass this test, it will require either a closed-loop AF control system, or it will need some sort of SW correction based on using accelerometer data to determine camera orientation. Reliable factory calibration of the lens infinity position will also be needed.

Manual TestingCam2 tests

The TestingCam2 app should be run manually, with the following checks performed. The source for TestingCam2 is here: pdk/apps/TestingCamera2/

JPEG capture

Start TestingCam2, and press the JPEG button. The image that appears to the right of the viewfinder image should appear the same as the viewfinder, including having the same orientation.