diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp index 9b0b1f1..dd8994e 100644 --- a/libgralloc/framebuffer.cpp +++ b/libgralloc/framebuffer.cpp @@ -405,6 +405,54 @@ static int fb_orientationChanged(struct framebuffer_device_t* dev, int orientati pthread_mutex_unlock(&m->overlayLock); return 0; } + +static int handle_open_secure_start(private_module_t* m) { + pthread_mutex_lock(&m->overlayLock); + m->hdmiMirroringState = HDMI_NO_MIRRORING; + m->secureVideoOverlay = true; + closeHDMIChannel(m); + pthread_mutex_unlock(&m->overlayLock); + return 0; +} + +static int handle_open_secure_end(private_module_t* m) { + pthread_mutex_lock(&m->overlayLock); + if (m->enableHDMIOutput) { + if (m->trueMirrorSupport) { + m->hdmiMirroringState = HDMI_UI_MIRRORING; + } else if(!m->videoOverlay) { + m->hdmiMirroringState = HDMI_UI_MIRRORING; + } + m->hdmiStateChanged = true; + pthread_cond_signal(&(m->overlayPost)); + } + pthread_mutex_unlock(&m->overlayLock); + return 0; +} + +static int handle_close_secure_start(private_module_t* m) { + pthread_mutex_lock(&m->overlayLock); + m->hdmiMirroringState = HDMI_NO_MIRRORING; + m->secureVideoOverlay = false; + closeHDMIChannel(m); + pthread_mutex_unlock(&m->overlayLock); + return 0; +} + +static int handle_close_secure_end(private_module_t* m) { + pthread_mutex_lock(&m->overlayLock); + if (m->enableHDMIOutput) { + if (m->trueMirrorSupport) { + m->hdmiMirroringState = HDMI_UI_MIRRORING; + } else if(!m->videoOverlay) { + m->hdmiMirroringState = HDMI_UI_MIRRORING; + } + m->hdmiStateChanged = true; + pthread_cond_signal(&(m->overlayPost)); + } + pthread_mutex_unlock(&m->overlayLock); + return 0; +} #endif //Wait until framebuffer content is displayed. @@ -450,6 +498,18 @@ static int fb_perform(struct framebuffer_device_t* dev, int event, int value) case EVENT_ORIENTATION_CHANGE: fb_orientationChanged(dev, value); break; + case EVENT_OPEN_SECURE_START: + handle_open_secure_start(m); + break; + case EVENT_OPEN_SECURE_END: + handle_open_secure_end(m); + break; + case EVENT_CLOSE_SECURE_START: + handle_close_secure_start(m); + break; + case EVENT_CLOSE_SECURE_END: + handle_close_secure_end(m); + break; #endif case EVENT_RESET_POSTBUFFER: fb_resetBufferPostStatus(dev);