HDCP module binderized

Change-Id: I866768b1e3f3b232f1934a35b65f66befc12f3f6
diff --git a/media/libmediaplayerservice/HDCP.cpp b/media/libmediaplayerservice/HDCP.cpp
index 6f8a465..e7dea6e 100644
--- a/media/libmediaplayerservice/HDCP.cpp
+++ b/media/libmediaplayerservice/HDCP.cpp
@@ -36,13 +36,16 @@
         return;
     }
 
-    typedef HDCPModule *(*CreateHDCPModuleFunc)();
+    typedef HDCPModule *(*CreateHDCPModuleFunc)(
+            void *, HDCPModule::ObserverFunc);
+
     CreateHDCPModuleFunc createHDCPModule =
         (CreateHDCPModuleFunc)dlsym(mLibHandle, "createHDCPModule");
 
     if (createHDCPModule == NULL) {
         ALOGE("Unable to find symbol 'createHDCPModule'.");
-    } else if ((mHDCPModule = createHDCPModule()) == NULL) {
+    } else if ((mHDCPModule = createHDCPModule(
+                    this, &HDCP::ObserveWrapper)) == NULL) {
         ALOGE("createHDCPModule failed.");
     }
 }
@@ -97,5 +100,16 @@
     return mHDCPModule->encrypt(inData, size, streamCTR, outInputCTR, outData);
 }
 
+// static
+void HDCP::ObserveWrapper(void *me, int msg, int ext1, int ext2) {
+    static_cast<HDCP *>(me)->observe(msg, ext1, ext2);
+}
+
+void HDCP::observe(int msg, int ext1, int ext2) {
+    if (mObserver != NULL) {
+        mObserver->notify(msg, ext1, ext2, NULL /* obj */);
+    }
+}
+
 }  // namespace android