Fix VrDisplayTest failure
Before CL[1], the system regarded system created displays as
trusted displays, which provided the ability to gain the focus
without user's touch.
After CL[1], the system checked if a virtual display is trusted by
the flag FLAG_TRUSTED. Therefore, the activity lunched on the
Vr2dDisplay can not gain the focus because Vr2dDisplay didn't
hold the flag FLAG_TRUSTED.
This CL adds the flag to Vr2dDisplay to make it a trusted display.
CL[1]: ef7b1333f0e87cd07af115719b94dd37e2de54dc
Bug: 168268396
Test: Vr2DisplayTests
Change-Id: Iac88859d3fa7cbb75214efcc6ce4a88e0eb718f2
diff --git a/services/core/java/com/android/server/vr/Vr2dDisplay.java b/services/core/java/com/android/server/vr/Vr2dDisplay.java
index 3f2b5c2..a713e5b 100644
--- a/services/core/java/com/android/server/vr/Vr2dDisplay.java
+++ b/services/core/java/com/android/server/vr/Vr2dDisplay.java
@@ -295,6 +295,7 @@
flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL;
flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE;
+ flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_TRUSTED;
final VirtualDisplayConfig.Builder builder = new VirtualDisplayConfig.Builder(
DISPLAY_NAME, mVirtualDisplayWidth, mVirtualDisplayHeight, mVirtualDisplayDpi);