Android TV HAL

This is just some learnings out of a research on the TV HAL framework.

Framework Usage

The hardware TV service will set a surfance to the TvInputhal java class that uses a thread on it’s native implementation to do several requests to the tv_input HAL implementation. This Thread will do the buffer handling using a queue.

The formating of the buffer is requested by the tv_inut hal implementation as well as the requirements for the type of buffer being used. The buffer producer will comply with those requests.

sources on the framework:

  • frameworks/base/services/core/java/com/android/server/tv/

  • frameworks/base/services/core/java/com/android/server/tv/

  • frameworks/base/services/core/jni/com_android_server_tv_TvInputHal.cpp

Methods on tv_input hal module.


inits the hal_module.


Run once to init the hardware configure the event callback used by the client(s) to receive information and data.


inform clients on how we do the streaming of videos.


initiate a stream of video. If the drive has a "side channel" to display the video this will be responsible to setup such channel. If the hardware will produce buffer that need to be rendered this will setup the process but each frame will initiate a new "capture" process.


Request the capture of a single frame. The buffer will be filled by the hardware and the HAL will notify the client using the "notify" call back.