Understanding Android and HDMI CEC commands

Jack Aureliano De Santis
2 min readFeb 14, 2019

A developer asked me yesterday the following question:

Do you happen to know how to send CEC commands over HDMI through an Android non-TV app?

The developer had a little Android TV box (not officially running Android TV but AOSP), Venztech V10 to be exact, and was trying to make the device send CEC commands over HDMI to turn on and off the connected TV.

He was finding some traces of CEC in the logs and the code but couldn’t get it to actually work properly, some of the logs that puzzled him:

I can see in the logs that the classes related to HDMI Control Service appear, like this
02–06 16:33:10.568 4012 4105 D CEC : [cec_rx_loop]msg:04 90 00
02–06 16:33:10.570 4012 4105 D HdmiCecExtend: onCecMessageRx
02–06 16:33:10.657 4012 4012 W HDMI : [1]:Unhandled cec command:<Report Power Status> src: 0, dst: 4, params: 00
02–06 16:33:10.762 4012 4104 D CEC : [cec_send_message][4 -> 0]len:3, body:00 90 00 , result:success

Now why would the log show “cec_send_message result:success” while nothing is actually sent over HDMI?

The answer is simple, since Android 5.0 the Android system does support HDMI-CEC commands, but it’s up to each individual OEM to implement the Driver and HDMI-CEC HAL (parts marked in blue on the above graphic).
So while you might find traces of it in the OS itself, unless your OEM has implemented the driver that is just not going to happen.
And implementing it yourself would be a huge task that would likely involve building the entire device ROM, Kernel, Vendor/HAL.

Your only realistic option if you need HDMI-CEC on Android is to be particularly careful about which device you purchase, making sure your device OEM has implemented the driver necessary.

An important note is that different “branches” of Android, such as Android TV, Android Auto and the Android you run on your smartphone tend to share the same AOSP source code, so finding bits of something in the code and/or logs is possible, but it really does not guarantee proper support.

--

--