Starting in Android 13, the Hardware Composer (HWC) HAL is defined in
AIDL and the HIDL versions ranging from
email@example.com are deprecated.
This page describes the differences between the AIDL and the HIDL HAL for the HWC and the implementation and testing of the AIDL HAL.
Because of the advantages offered by AIDL, vendors are encouraged to implement the AIDL composer HAL starting Android 13 instead of the HIDL version. See the Implementation section for more information.
Differences between AIDL and HIDL HALs
The new AIDL composer HAL, named
It exposes an API similar to the HIDL HAL
firstname.lastname@example.org with the following changes:
Removal of the Fast Message Queue (FMQ) in favor of parcelable commands.
The AIDL HAL defines the command interface based on strongly typed parcelable types as opposed to the serialized commands over FMQ in HIDL. This provides a stable interface for commands and a more readable definition of how the command payload is interpreted.
executeCommandsmethod is defined in
CommandResultPayload executeCommands(in DisplayCommand commands);
where each command is a strongly typed parcelable type defined in
DisplayCommand.aidl. Command responses are strongly typed parcelables defined in
IComposerClient.getClientTargetSupportas there are no active clients for this method.
Representation of colors as floats instead of bytes to better align with the upper graphics stack in Android as defined in
Addition of new fields for controlling HDR content.
In the AIDL HAL, mixed SDR/HDR layer stacks support the seamless dimming of SDR layers when an HDR layer is simultaneously on screen.
LayerCommandlets SurfaceFlinger specify a per-layer brightness, so that the HWC dims the layer’s content in linear light space, as opposed to gamma space.
ClientTargetPropertyWithBrightnesslets the HWC specify the brightness space for client composition and to instruct
RenderEnginewhether to dim SDR layers in client composition.
dimmingStagefield lets the HWC configure when
RenderEngineshould dim content. This accommodates vendor-defined
ColorModes, which might prefer to dim in gamma space, to allow vendor-defined contrast enhancements in their color pipelines.
Addition of a new composition type
Composition.aidlfor screen decorations.
Some devices have dedicated hardware to optimize drawing the alpha mask that smooths rounded corners and cutouts on displays. Devices with such hardware must implement
IComposerClient.getDisplayDecorationSupportto return a
DisplayDecorationSupportstructure as defined in the new
DisplayDecorationSupport.aidl. This structure describes the
AlphaInterpretationenums required by the device. Upon this implementation, System UI marks the alpha mask layer as
DISPLAY_DECORATION, a new composition type that takes advantage of the dedicated hardware.
Addition of a new
expectedPresentTimefield lets SurfaceFlinger set the expected present time to when the current content must be displayed on screen. With this feature, SurfaceFlinger sends a present command to the implementation ahead of time, allowing it to pipeline more of the composition work.
Addition of new APIs to control boot display configuration.
BOOT_DISPLAY_CONFIG, vendors can specify that the boot display configuration is supported. The
setBootDisplayConfig, the framework informs vendors of the boot time display configuration. Vendors must cache in the boot display configuration, and boot in this config on next reboot. If the device is unable to boot in this config, the vendor must find a config that matches the resolution and refresh rate of this config. If no such config exists, the vendor should use their preferred display config.
clearBootDisplayConfig, the framework informs the vendors to clear the boot display configuration, and boot in their preferred display config during the next reboot.
getPreferredBootDisplayConfig, the framework queries the vendor's preferred boot mode.
When the boot display configuration isn't supported, these methods return a value of
Addition of new APIs to control the display idle timer.
DISPLAY_IDLE_TIMER, vendors can specify that an inactivity timer is implemented by the vendor for this display. When idle, this capability changes the refresh rate to a lower setting to preserve power. The platform uses
setIdleTimerEnabledto control the timeout of the timer, and in some cases, to disable it in order to prevent undesired refresh rate switches when idle.
IComposerCallback.onVsyncIdlecallback indicates to the platform that the display is idle and the
vsynccadence has changed. The platform responds to this callback by resetting its
vsyncmodel. It forces a
vsyncresync on the next frame, and learns the new
Vendors aren't required to implement the AIDL HAL for Android 13. However, they're encouraged to implement the AIDL composer HAL instead of the HIDL version to use the new functionality and APIs.
A reference implementation for the AIDL HWC HAL is implemented in Android emulators.
To test your implementation, run