Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.

Changes to camera and system configuration

Camera and system configuration management and usage have also been updated in Extended View System (EVS) 1.1. As EVS 1.0 does not provide methods to query camera device information and system configuration, the app developer must get that information themselves. For example, the client must have camera calibration data if it implements some computer vision apps.

To alleviate this circumstance, EVS 1.1 extends a camera device descriptor with camera metadata and provides several methods that enables clients to get camera device and system configuration information.

importandroid.frameworks.cameraservice.device@2.0::CameraMetadata;
importandroid.frameworks.cameraservice.common@2.0::CameraMetadataType;
/**
 * Structure describing the basic properties of an EVS camera, extended
 * fromits v1.0 declaration.
 *
 * The HAL is responsible for filling out this structure for each
 * EVS camera in the system.
 */
struct CameraDesc {
 @1.0::CameraDesc v1;
 /**
 * Store camera metadata such as lens characteristics.
 */
 CameraMetadata metadata;
};

CameraDesc is extended to have camera device metadata and this type is imported from android.frameworks.cameraservice.device@2.0. This design choice allows vendors to use camera_metadata_t in their implementations and to take advantage of APIs defined in ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS . The EVS driver can use this type to identify which stream configurations are supported by each camera module. Also, vendors can't use their own metadata types to deliver other information not defined in Android as explained in ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS . The EVS driver can use this type to identify which stream configurations are supported by each camera module.

Open a camera device with desired stream configuration

importandroid.hardware.camera.device@3.2::Stream;
/**
 * Get the IEvsCamera associated with a cameraId froma CameraDesc
 *
 * Given a camera's unique cameraId from CameraDesc, returns the
 * IEvsCamera interface associated with the specified camera. When
 * done using the camera, the caller may release it by calling closeCamera().
 *
 * @param cameraId A unique identifier of the camera.
 * @param streamCfg A stream configuration the client wants to use.
 * @return evsCamera EvsCamera object associated with a given cameraId.
 */
openCamera_1_1(string cameraId, Stream streamCfg) generates (IEvsCamera evsCamera);

One of the metadata fields Android defines is ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS . The EVS driver can use this type to identify which stream configurations are supported by each camera module. For example, the reference implementation provided below lists the information oforf each supported stream configuration:

  • Stream ID
  • Width
  • Height
  • Direction (input or output)
  • Frame rate

Multiple clients on a single camera HW instance

If a client requests to open an already active camera device, the EVS manager compares a requested stream configuration with the active configuration. If they differ, the EVS manager returns a null IEvsCamera object. The client MUST handle this possible failure properly.

Reference configuration file

The reference configuration file included in EVS 1.1 is written in XML and vendors can use the included DTD file (shown below) to validate a (modified) sample configuration file or use their own file if they want to use the same format. The DTD file also provides detailed descriptions for each element and attribute.

<?xmlversion='1.0'encoding='utf-8'?>
<!--Copyright(C)2019TheAndroidOpenSourceProject
LicensedundertheApacheLicense,Version2.0(the"License");
youmaynotusethisfileexceptincompliancewiththeLicense.
YoumayobtainacopyoftheLicenseat
http://www.apache.org/licenses/LICENSE-2.0
Unlessrequiredbyapplicablelaworagreedtoinwriting,software
distributedundertheLicenseisdistributedonan"AS IS"BASIS,
WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
SeetheLicenseforthespecificlanguagegoverningpermissionsand
limitationsundertheLicense.
-->

<!--Author:changyeon@google.com Version:1.0 --> <!ELEMENTconfiguration(system,camera,display)> <!--SystemConfigurationthatcontainsbelowinformations: -Thedimensionofthevehicle. -NumberofcamerasavailabletoEVS. -Listofpredefinedusecases. --> <!ELEMENTsystem(dimension,num_cameras,supported_use_case*)> <!--Thex,y,andzdimensionofthevehicleintheunitofcentimeters.Axesaredefinedat https://source.android.com/docs/core/interaction/sensors/sensor-types#auto_axes --> <!ELEMENTdimensionEMPTY> <!ATTLISTdimension xCDATA'0' yCDATA'0' zCDATA'0' > <!--ThenumberofcamerasthatareavailabletoEVSonthevehicle. Thismustbeequaltothenumberofcameraelementsofthedeviceelement. --> <!ELEMENTnum_camerasEMPTY> <!ATTLISTnum_cameras valueCDATA#REQUIRED > <!--Listofpredefinedusecases--> <!ELEMENTsupported_use_case(use_case)*> <!--Predefinedconfigurationsforeachoflistedusecases. @attrid:Uniquestringidentifierofthisusecase. @attrcamera:IDofeitherasinglecameradeviceoracameragroup. @attrstream_id:Preferredstreamconfigurationofcameradevice/group thatissetbycameraattribute. --> <!ELEMENTuse_caseEMPTY> <!ATTLISTuse_case idCDATA#REQUIRED cameraCDATA#REQUIRED stream_idCDATA#REQUIRED > <!--Devicedescriptions--> <!ELEMENTcamera(group|device)*> <!--Cameragroupdescriptor @attrgroup_id:Uniquelogicalcameragroupidentifier.Cameradeviceusethistobe amemberofthegroup. @attrdevice_id:Comma-separatedlistofuniquecameraidentifiersofmembercamera devices. @attrsynchronized:Booleanfieldthattellswhetherornotthiscameraissynchronized withothercamerasinthesamegroup.Thisisineffectiveif thereisasinglecamerainthegrouporagroupisinvalid. --> <!ELEMENTgroup(caps)> <!ATTLISTgroup group_idCDATA#REQUIRED device_idCDATA#REQUIRED synchronizedCDATA#REQUIRED > <!--Pleasenotethatacameramayhavestreamconfigurations.Ifithas,allstream configurationsmustbesupportedbyeachcameradeviceinthegroup. --> <!--Cameradevicedescriptor @attrid:Uniquecameraidentifier. @attrposition:Mustbeoneoffront,rear,left,orright. --> <!ELEMENTdevice(caps,characteristics*)> <!ATTLISTdevice idCDATA#REQUIRED positionCDATA#REQUIRED > <!--Camerametadatathatcontains: -Alistofsupportedcontrols. -Alistofsupportedstreamconfigurations. --> <!ELEMENTcaps(supported_controls|stream)*> <!--Alistofsupportedcontrols. Thismustbeasubsetofandroid.hardware.automotive.evs@1.1::CameraParam. --> <!ELEMENTsupported_controlsEMPTY> <!ATTLISTsupported_controls valueCDATA#REQUIRED > <!--Alistofsupportedoutputsizes.--> <!ELEMENTstreamEMPTY> <!ATTLISTstream idCDATA#REQUIRED widthCDATA#REQUIRED heightCDATA#REQUIRED formatCDATA#REQUIRED > <!--Cameramodulecharacteristicsincludingitsopticsandimagingsensor.--> <!ELEMENTcharacteristics(parameter)*> <!ELEMENTparameterEMPTY> <!--Anameofcameracharacteristic.Thismustbeasubsetof android.hardware.automotive.evs@1.1::CameraCharacteristics. --> <!ATTLISTparameter nameCDATA#REQUIRED typeCDATA#REQUIRED sizeCDATA#REQUIRED valueCDATA#REQUIRED > <!--Availabledisplaydevices--> <!ELEMENTdisplay(display_device)*> <!--Displaydevicedescriptor @attrid:Uniquedisplayidentifier. @attrposition:Displaymountlocation. --> <!ELEMENTdisplay_device(supported_formats)*> <!ATTLISTdisplay_device idCDATA#REQUIRED positionCDATA#REQUIRED > <!--Alistofsupportedinputdataformats. @attrvalue:Acommaseparatedlistofinputdataformats --> <!ELEMENTsupported_formatsEMPTY> <!ATTLISTsupported_formats valueCDATA#REQUIRED >

A sample configuration file is shown below (the sample contains dummy numerical data).

<?xmlversion='1.0'encoding='utf-8'?>
<!--Copyright(C)2019TheAndroidOpenSourceProject
LicensedundertheApacheLicense,Version2.0(the"License");
youmaynotusethisfileexceptincompliancewiththeLicense.
YoumayobtainacopyoftheLicenseat
http://www.apache.org/licenses/LICENSE-2.0
Unlessrequiredbyapplicablelaworagreedtoinwriting,software
distributedundertheLicenseisdistributedonan"AS IS"BASIS,
WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
SeetheLicenseforthespecificlanguagegoverningpermissionsand
limitationsundertheLicense.
-->
<!--ExtendedViewSystemExampleConfiguration
AndroidAutomotiveaxesareusedtodefinecoordinates.
Seehttps://source.android.com/docs/core/interaction/sensors/sensor-types#auto_axes
Useevs_configuration.dtdwithxmllinttool,tovalidateXMLconfigurationfile
-->
<configuration>
<!--systemconfiguration-->
<system>
<!--referencedimensionofthevehicleintheunitofcentimeters-->
<dimensionx='200'y='400'z='100'/>
<!--numberofcamerasavailabletoEVS-->
<num_camerasvalue='2'/>
<!--listofsupportedusecases-->
<supported_use_case>
<!--usecaseconfiguration-->
<use_case
id='rear_view'
camera='/dev/video1'
stream_id='1'
/>
<!--usecaseconfiguration-->
<use_case
id='surround_view'
camera='group1'
stream_id='0'
/>
</supported_use_case>
</system>
<!--cameradeviceinformation-->
<camera>
<!--cameragroup0-->
<groupgroup_id='group0'
device_id='/dev/video1,/dev/video2'
synchronized='false'
>
<caps>
<streamid='0'width='640'height='360'format='V4L2_PIX_UYUV'/>
</caps>
</group>
<!--cameradevicestarts-->
<deviceid='/dev/video1'position='rear'>
<caps>
<!--listofsupportedcontrols-->
<supported_controls
value='BRIGHTNESS,
CONTRAST,
AUTO_WHITE_BALANCE,
WHITE_BALANCE_TEMPERATURE,
SHARPNESS,
AUTO_EXPOSURE,
ABSOLUTE_EXPOSURE,
AUTO_FOCUS,
ABSOLUTE_ZOOM'
/>
<!--listofsupportedstreamconfigurations-->
<streamid='0'width='1280'height='1080'format='V4L2_PIX_NV21'/>
<streamid='1'width='1280'height='1080'format='V4L2_PIX_YUYV'/>
<streamid='2'width='1280'height='1080'format='V4L2_PIX_UYUV'/>
<streamid='3'width='640'height='360'format='V4L2_PIX_NV21'/>
<streamid='4'width='640'height='360'format='V4L2_PIX_YUYV'/>
<streamid='5'width='640'height='360'format='V4L2_PIX_UYUV'/>
<streamid='6'width='320'height='240'format='V4L2_PIX_NV21'/>
<streamid='7'width='320'height='240'format='V4L2_PIX_YUYV'/>
<streamid='8'width='320'height='240'format='V4L2_PIX_UYUV'/>
</caps>
<!--listofparameters-->
<characteristics>
<!--Lensdistortioninformation.See
https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#LENS_DISTORTION
-->
<parameter
name='LENS_DISTORTION'
type='float'
size='5'
value='0.0,0.0,0.0,0.0,0.0'
/>
<!--Cameraintrinsiccalibrationmatrix.See
https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#LENS_INTRINSIC_CALIBRATION
-->
<parameter
name='LENS_INTRINSIC_CALIBRATION'
type='float'
size='5'
value='0.0,0.0,0.0,0.0,0.0'
/>
<!--Cameraposetranslationandrotation.See
https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#LENS_POSE_TRANSLATION
https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#LENS_POSE_ROTATION
-->
<parameter
name='LENS_POSE_TRANSLATION'
type='float'
size='3'
value='0.0,0.0,0.0'
/>
<parameter
name='LENS_POSE_ROTATION'
type='float'
size='4'
value='0.0,0.0,0.0,0.0'
/>
</characteristics>
</device>
<deviceid='/dev/video2'position='front'>
<caps>
<!--listofsupportedstreamconfigurations-->
<streamid='0'width='1280'height='1080'format='V4L2_PIX_NV21'/>
</caps>
</device>
</camera>
<!--displaydevicestarts-->
<display>
<display_deviceid='display0'position='driver'>
<!--listofsupportedinputformats
Thismustbeasubsetofandroid_pixel_format_tenum.
-->
<supported_formats
value='RGBA_8888,
YUYV,
UYVY'
/>
</display_device>
</display>
</configuration>

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025年12月02日 UTC.