Bogado.net

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/TvInputHardwareManager.java

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

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

Methods on tv_input hal module.

device_open

inits the hal_module.

initialize

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

get_stream_configuration

inform clients on how we do the streaming of videos.

open_stream

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_capture

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.