hwc: Skip secure buffers in non secure mode

Bug: 7283255
Change-Id: Ia4ca0ef4ad4c57deea25c82dfdef009a2c1f82d6
Acked-by: Amara Venkata Mastan Manoj Kumar<manojavm@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc_video.cpp b/libhwcomposer/hwc_video.cpp
index 7bbfaf9..d5f5114 100644
--- a/libhwcomposer/hwc_video.cpp
+++ b/libhwcomposer/hwc_video.cpp
@@ -47,13 +47,19 @@
     //index guaranteed to be not -1 at this point
     hwc_layer_1_t *yuvLayer = &list->hwLayers[yuvIndex];
 
+    private_handle_t *hnd = (private_handle_t *)yuvLayer->handle;
     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;
         }
+    } else {
+        if (isSecureBuffer(hnd)) {
+            ALOGD_IF(VIDEO_DEBUG, "%s: Handle secure video layer"
+                     "during non-secure playback gracefully", __FUNCTION__);
+            return false;
+        }
     }
     chooseState(ctx, dpy, yuvLayer);
     if(configure(ctx, dpy, yuvLayer)) {