hwc: Handle non secure buffers

When secure mode is on, skip overlay composition for
non secure buffers.

Bug: 7216266
Change-Id: I5fb1f3a26505bb69305e7d359bdb3a020baf193f
Acked-by: Amara Venkata Mastan Manoj Kumar<manojavm@codeaurora.org>
diff --git a/libhwcomposer/hwc_video.cpp b/libhwcomposer/hwc_video.cpp
index b974ffe..2e4342a 100644
--- a/libhwcomposer/hwc_video.cpp
+++ b/libhwcomposer/hwc_video.cpp
@@ -43,6 +43,15 @@
 
     //index guaranteed to be not -1 at this point
     hwc_layer_1_t *yuvLayer = &list->hwLayers[yuvIndex];
+
+    if(ctx->mSecureMode) {
+        private_handle_t *hnd = (private_handle_t *)yuvLayer->handle;
+        if (! isSecureBuffer(hnd)) {
+            ALOGD_IF(VIDEO_DEBUG, "%s: Handle non-secure video layer"
+                     "during secure playback gracefully", __FUNCTION__);
+            return false;
+        }
+    }
     chooseState(ctx, dpy, yuvLayer);
     if(configure(ctx, dpy, yuvLayer)) {
         markFlags(yuvLayer);