How to detect if the HDMI port on an Android device has HDCP enabled?
Solution 1
You can try to check the Display
flags: http://developer.android.com/reference/android/view/Display.html#getFlags()
FLAG_SECURE or FLAG_SUPPORTS_PROTECTED_BUFFERS (http://developer.android.com/reference/android/view/Display.html#FLAG_SECURE and http://developer.android.com/reference/android/view/Display.html#FLAG_SUPPORTS_PROTECTED_BUFFERS)
Solution 2
This is an older thread - but since I am working on this stuff again I thought I would update.
As of API 17 (Android 4.2+), you can get a decent proxy for HDCP information from the standard Android SDK.
If you want to ensure that a display is "secure" you can call setSecure(true) on the application Surface. Then for good measure you can enumerate the available Displays and verify that FLAG_SECURE is set for each one. This will block DDMS and at least hint to the display driver that the output should have HDCP turned on. No guarantees though and your mileage may vary.
On further note -- the path Alex noted above may have changed on newer devices (Android 5.1+). But since this is dependent on the OEM, expect this may vary on different devices. :-(
Comments
-
Yi Wang about 2 years
Can't find anything definitive on Android Doc and Google.
If there is API to detect this, what is it and what is the API to enable/disable HDCP on the HDMI output?
If there is NO API to detect this, is there a device can be used to check the HDCP flag on HDMI port?
On some android devices (most notably Samsung devices), the HDMI port always has HDCP enabled. But how about other manufactures devices? Is HDCP mandatory on Google certified device? If it's not mandatory, how do major content providers's Android apps (from Big cable company teleco) prevent video output to non-HDCP protected HDMI port?
-
Yi Wang over 10 yearsThanks looks like's its related to HDCP flag but there is absolutely no examples of how to allocate a secured buffer then use the buffer to output video frames.
-
Marcos Zolnowski over 10 yearsI believe you would allocate a SurfaceView, then call setSecure. After that, using MediaPlayer, call setDisplay(exampleSurfaceView.getHolder()).
-
Yi Wang over 10 yearsActually, is it possible to have a special android version that returns true for flag FLAG_SECURE and have no HDCP at all? The special android is there just to fool application into thinking that HDCP is available but in fact it's not.