sf: vds: Add support for secure virtual displays

1. Propagate secure flag on display creation

In SurfaceFlinger we have information that tells us whether a
display is secure or not. We need to propagate this information
when creating the corresponding virtual display, allowing us to
configure output buffers with the correct (secure) usage flags.

2. Use secure heap only for sessions that need HW level protection

Use MM heap only if the secure session needs hardware level
protection. At the present moment we are assuming that only displays
with the GRALLOC_USAGE_HW_ENCODER need hardware level protection.

Change-Id: I7e0d42ba3a81d1f5c42b1074e3018826b38b7a8d
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index bd64601..f8bf368 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1259,7 +1259,8 @@
         if(!wfdVirtual) {
             // This is for non-wfd virtual display scenarios(e.g. SSD/SR/CTS)
             sp<VirtualDisplaySurface> vds = new VirtualDisplaySurface(*mHwc,
-                    hwcDisplayId, state.surface, bqProducer, bqConsumer, state.displayName);
+                    hwcDisplayId, state.surface, bqProducer, bqConsumer,
+                    state.displayName, state.isSecure);
             dispSurface = vds;
             // There won't be any interaction with HWC for this virtual display.
             // so the GLES driver can pass buffers directly to the sink.
@@ -1279,7 +1280,8 @@
                 // WFD virtual display instance gets valid hwcDisplayId and
                 // SSD/SR will get invalid hwcDisplayId
                 sp<VirtualDisplaySurface> vds = new VirtualDisplaySurface(*mHwc,
-                        hwcDisplayId, state.surface, bqProducer, bqConsumer, state.displayName);
+                        hwcDisplayId, state.surface, bqProducer, bqConsumer,
+                        state.displayName, state.isSecure);
                 dispSurface = vds;
                 // There won't be any interaction with HWC for this virtual
                 // display, so the GLES driver can pass buffers directly to the
@@ -1295,7 +1297,8 @@
         // mForceHwcCopy (which is based on Usage Flags)
 
         sp<VirtualDisplaySurface> vds = new VirtualDisplaySurface(*mHwc,
-                hwcDisplayId, state.surface, bqProducer, bqConsumer, state.displayName);
+                hwcDisplayId, state.surface, bqProducer, bqConsumer,
+                state.displayName, state.isSecure);
         dispSurface = vds;
         if (hwcDisplayId >= 0) {
             producer = vds;