hwc: set the secure flag for AD when secure content is present

When AD is enabled and we have secure content then the secure
flag must be set appropriately. This configures the WB session
as secure; enabling secure playback on AD.

Change-Id: I32373b4b716d5add14994f88e626ff26d2823b8b
diff --git a/libhwcomposer/hwc_ad.cpp b/libhwcomposer/hwc_ad.cpp
index c2ea4ee..104ffce 100644
--- a/libhwcomposer/hwc_ad.cpp
+++ b/libhwcomposer/hwc_ad.cpp
@@ -192,6 +192,14 @@
 
     overlay::Writeback *wb = overlay::Writeback::getInstance();
 
+    //Set Security flag on writeback
+    if(isSecureBuffer(hnd)) {
+        if(!wb->setSecure(isSecureBuffer(hnd))) {
+            ALOGE("Failure in setting WB secure flag for ad");
+            return false;
+        }
+    }
+
     if(!wb->configureDpyInfo(hnd->width, hnd->height)) {
         ALOGE("%s: config display failed", __func__);
         mDoable = false;
@@ -209,7 +217,7 @@
     size = getBufferSizeAndDimensions(hnd->width, hnd->height,
                 format, tmpW, tmpH);
 
-    if(!wb->configureMemory(size, isSecureBuffer(hnd))) {
+    if(!wb->configureMemory(size)) {
         ALOGE("%s: config memory failed", __func__);
         mDoable = false;
         return false;