3535#include " hdcpapi.h"
3636#include " port.h"
3737
38+ #ifdef ANDROID
39+ #include < hwcserviceapi.h>
40+ #include < log/log.h>
41+ #include < binder/IServiceManager.h>
42+ #include < binder/ProcessState.h>
43+ #include < iservice.h>
44+
45+ #define BINDER_IPC " /dev/vndbinder"
46+ #endif
47+
3848#define THREAD_STARTUP_BACKOFF_DELAY_US 100
3949#define AUTH_CHECK_DELAY_MS 1000
4050#define INTEGRITY_CHECK_DELAY_MS 500
@@ -109,14 +119,14 @@ class PortManager
109119 PortManager (HdcpDaemon& daemonSocket);
110120
111121 // /////////////////////////////////////////////////////////////////////////
112- // / \brief Destructor for PortManager
122+ // / \brief Virtual destructor for PortManager
113123 // /
114124 // / \return nothing -- It's a destructor
115125 // /
116126 // / This will cleanup any ports currently in the port list
117127 // / Any dynamic memory controlled by the PortManager should be released
118128 // /////////////////////////////////////////////////////////////////////////
119- ~PortManager (void );
129+ virtual ~PortManager (void );
120130
121131 // /////////////////////////////////////////////////////////////////////////
122132 // / \brief Checks if the portmanager was successfully created
@@ -215,7 +225,7 @@ class PortManager
215225 void DisableAllPorts ();
216226
217227 // Declare private functions
218- private :
228+ protected :
219229
220230 // /////////////////////////////////////////////////////////////////////////
221231 // / \brief Get DrmObject by port Id
@@ -247,7 +257,10 @@ class PortManager
247257 uint8_t *cpType);
248258
249259 // /////////////////////////////////////////////////////////////////////////
250- // / \brief Set Port Property
260+ // / \brief Virtual function set port property. By default, port property is
261+ // / set through drm ioctl call. On ClearLinux, port property is set
262+ // / through IAS. On Andorid, port property is set through Hardware
263+ // / Composer.
251264 // /
252265 // / \param[in] drmId, Id of the drm object
253266 // / \param[in] propertyId, Id of property
@@ -256,7 +269,7 @@ class PortManager
256269 // / \param[in] numRetry, the retry times
257270 // / \return int32_t Function return status
258271 // /////////////////////////////////////////////////////////////////////////
259- int32_t SetPortProperty (
272+ virtual int32_t SetPortProperty (
260273 int32_t drmId,
261274 int32_t propertyId,
262275 int32_t size,
@@ -278,10 +291,47 @@ class PortManager
278291 // / \return int32_t Function return status
279292 // /////////////////////////////////////////////////////////////////////////
280293 int32_t InitDrmObjects ();
281-
294+
282295 static void SigCatcher (int sig);
283296};
284297
298+ #ifdef ANDROID
299+ class PortManagerHWComposer : public PortManager
300+ {
301+ public:
302+
303+ // /////////////////////////////////////////////////////////////////////////
304+ // / \brief Constructor for the PortManagerHWComposer class,
305+ // / this is for Android platform.
306+ // /
307+ // / \return Nothing
308+ // /
309+ // / Callers must check the newly created manager against IsValid.
310+ // /////////////////////////////////////////////////////////////////////////
311+ PortManagerHWComposer (HdcpDaemon& daemonSocket);
312+
313+ // /////////////////////////////////////////////////////////////////////////
314+ // / \brief Virtual function set port property. By default, port property is
315+ // / set through drm ioctl call. On ClearLinux, port property is set
316+ // / through IAS. On Andorid, port property is set through Hardware
317+ // / Composer.
318+ // /
319+ // / \param[in] drmId, Id of the drm object
320+ // / \param[in] propertyId, Id of property
321+ // / \param[in] size, Length of value, it's an array
322+ // / \param[in] value, Pointer of the array
323+ // / \param[in] numRetry, the retry times
324+ // / \return int32_t Function return status
325+ // /////////////////////////////////////////////////////////////////////////
326+ virtual int32_t SetPortProperty (
327+ int32_t drmId,
328+ int32_t propertyId,
329+ int32_t size,
330+ const uint8_t *value,
331+ uint32_t numRetry);
332+ };
333+ #endif
334+
285335// /////////////////////////////////////////////////////////////////////////////
286336// / \brief Create the local instance of the PortManager
287337// /
0 commit comments