VR Virtual Display created with SECURE flag.

VR Virtual display needs to be able to composite secure layers
into the VR scene.  To do that it needs access to said layers by
including VIRTUAL_DISPLAY_FLAG_SECURE at creation time.

Also add code to allow secure virtual displays to be created from
system components, which VR is.

Test: Run a secure activity (like a credit-card entry) in the virtual
display and ensure that it renders in VR.

Bug: 67714367
Change-Id: Iaeb9507aacd5d7e52e92b67c8ce2cd5af31a3f83
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index a5c1fe2..53a315c 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -1741,7 +1741,7 @@
                             + "display.");
                 }
             }
-            if ((flags & VIRTUAL_DISPLAY_FLAG_SECURE) != 0) {
+            if (callingUid != Process.SYSTEM_UID && (flags & VIRTUAL_DISPLAY_FLAG_SECURE) != 0) {
                 if (!canProjectSecureVideo(projection)) {
                     throw new SecurityException("Requires CAPTURE_SECURE_VIDEO_OUTPUT "
                             + "or an appropriate MediaProjection token to create a "