Use the Android Camera Service

The Android Camera Service comprises the camera stack used in automotive devices, as well as in other form factors such as mobile phones, tablets, and TVs. To view the overall camera architecture, see Camera. This page focuses on topics specific to automotive devices, and working with the Android Camera API.

Enable Android Camera Service

To enable the Android Camera Service on the automotive platform, the product's makefile must specify ENABLE_CAMERA_SERVICE as true.

Automotive-specific camera characteristics

In the context of automotive devices, the camera HAL must include two distinctive characteristics specific to the automotive form factor:

Name Description
android.automotive.location Specifies the positioning of cameras in relation to the vehicle's body frame.
android.automotive.lens.facing Indicates which direction a camera lens is facing relative to the vehicle body frame and passenger seats.

In situations when cameras don't precisely align with specific location or lens orientation (indicated by the presence of *_OTHER in the android.automotive.location or android.automotive.lens.facing characteristics), or when multiple cameras share the same location and direction, the camera HAL should provide additional characteristics to enable apps to accurately determine the camera's location. These characteristics include:

Grant access to the Headless System User

Certain system and first-party (1P) apps can access the camera as the Headless System User, also known as User 0. This feature ensures that safety-critical apps, such as the rear-view camera, can continue camera streaming without interruption, regardless of foreground user switching. Only apps that are platform-signed and hold the new permission android.permission.CAMERA_HEADLESS_SYSTEM_USER can access the camera as User 0.

For apps accessing cameras as User 0, the camera data MUST be consumed locally and MUST not be transmitted off the device, including any data derived from the camera data. These apps require that the android.permission.CAMERA permission be pre-granted and must adhere to the pre-grant permission policy outlined in Design for Driving for GAS requirements.

Configure a camera privacy allowlist

Original equipment manufacturers (OEMs) can now configure specific camera apps to be included on an allowlist that grants camera access regardless of the camera privacy toggle's status. This feature enables users to disable camera access for entertainment apps, such as social media and video conferencing, while simultaneously permitting camera access for certain allowlisted apps.

Only system and privileged apps granted the android.permission.CAMERA_PRIVACY_ALLOWLIST permission can use this feature. Google Automotive Services (GAS) partners must submit their allowlisted apps for review and comply with the privacy allowlist policy. To learn more, see Android for Cars.

Add an app to the allowlist

In the etc/sysconfig directory:

  1. Add the app's package name in a system configuration XML file:

    <!-- In an xml file under etc/sysconfig —>
    
    <!--
    Allowlisted packages for the camera privacy toggle. Users will not be able to turn the privacy on for these packages as OEM requires camera access for these packages to preserve user safety.
    -->
    
    <config>
        <camera-privacy-allowlisted-app package="package_name" />
    </config>
    
  2. Add the app's URL of privacy policy disclosure to AndroidManifest.xml. The name of the meta-data should be privacy_policy.

    <meta-data android:name="privacy_policy" android:value= privacy policy URL/>
    

By default, the camera privacy toggle for allowlisted apps or required apps is hidden in the Privacy Settings UI. However, OEMs can override this behavior by setting the following flag to TRUE. This allows OEMs to customize the visibility of the camera privacy toggle for the required apps based on their preferences.

<!-- Whether to show the toggle to turn on the camera privacy for required apps -->

<bool name="config_show_camera_required_apps_toggle">false</bool>

Get early camera access

Specific time-sensitive and safety-oriented apps can access the camera before the Android boot process is finished. However, this access is exclusively granted to privileged clients with the UID AID_AUTOMOTIVE_EVS. To learn more about assigning a specific UID to a native app, see Discretionary access control (DAC). This early access to the camera is limited to system cameras positioned on the exterior of the vehicle's body.