From 4c6573889567dbe2dc0fad6217818aab6b7a7a1f Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Tue, 26 Sep 2017 13:40:58 -0700 Subject: [PATCH] Fix launch of activities into VR Virtual display When launching a 2D activity in VR mode by the VR app, we want to launch it in the virtual display created by VR. But, this fails since the virtual display owner is system and the calling UID doesn't have ACTIVITY_EMBED permission. We address this by making the virtual display public since it's lifetime is only VR mode and we want to allow all apps to launch 2D activities and route them to the vr virtual display. Bug: 66475142 Test: Launch VrSettingsActivity by clicking on gear and check "adb shell am stack list" to verify it launched on the virtual display Change-Id: Idde63ea63c953c6cf3d4ea46989a963a5651ce8a Signed-off-by: Karthik Ravi Shankar --- services/core/java/com/android/server/vr/Vr2dDisplay.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/vr/Vr2dDisplay.java b/services/core/java/com/android/server/vr/Vr2dDisplay.java index 8f50a39a54245..5721415c55f57 100644 --- a/services/core/java/com/android/server/vr/Vr2dDisplay.java +++ b/services/core/java/com/android/server/vr/Vr2dDisplay.java @@ -294,6 +294,8 @@ class Vr2dDisplay { int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH; flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT; + flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; + flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; mVirtualDisplay = mDisplayManager.createVirtualDisplay(null /* projection */, DISPLAY_NAME, mVirtualDisplayWidth, mVirtualDisplayHeight, mVirtualDisplayDpi, null /* surface */, flags, null /* callback */, null /* handler */,