summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Karthik Ravi Shankar <karthikrs@google.com> 2017-04-06 17:02:01 -0700
committer Karthik Ravi Shankar <karthikrs@google.com> 2017-04-07 15:48:23 -0700
commitf29b4c2c43e5c7936927b7ede300d25ebf081d6f (patch)
tree4b216c9cdc0ff3b12a3ed3622ccc3807b547024a
parent23a7c1e870ad200d889113297fd7e236b921a2ed (diff)
Fix when vr app launches 2d activity
When a 2D app is launched from a VR app, since the VR app was on DEFAULT_DISPLAY, the 2D app is also moved to DEFAULT_DISPLAY. This needs to be addressed by moving any non-VR 2D app launch in VR mode to the virtual display. Bug: 37111307 Test: android.server.cts.ActivityManagerDisplayTests Test: #testVrActivityLaunch Test: #testVrActivityReLaunch Test: #testPostVrLaunch Change-Id: I83bffe94bb89415a6b3c026dd7077e70fe36fee0 Signed-off-by: Karthik Ravi Shankar <karthikrs@google.com>
-rw-r--r--services/core/java/com/android/server/am/ActivityStarter.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index dcd293a340df..bf91230961ca 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -1472,17 +1472,11 @@ class ActivityStarter {
}
/**
- * Returns the ID of the display to use for a new activity. If the source activity has
- * a explicit display ID set, use that to launch the activity. If not and the device is in VR
- * mode, then return the Vr mode's virtual display ID.
+ * Returns the ID of the display to use for a new activity. If the device is in VR mode,
+ * then return the Vr mode's virtual display ID. If not, if the source activity has
+ * a explicit display ID set, use that to launch the activity.
*/
private int getSourceDisplayId(ActivityRecord sourceRecord, ActivityRecord startingActivity) {
- int displayId = sourceRecord != null ? sourceRecord.getDisplayId() : INVALID_DISPLAY;
- // If the activity has a displayId set explicitly, launch it on the same displayId.
- if (displayId != INVALID_DISPLAY) {
- return displayId;
- }
-
// Check if the Activity is a VR activity. If so, the activity should be launched in
// main display.
if (startingActivity != null && startingActivity.requestedVrComponent != null) {
@@ -1490,7 +1484,7 @@ class ActivityStarter {
}
// Get the virtual display id from ActivityManagerService.
- displayId = mService.mVrCompatibilityDisplayId;
+ int displayId = mService.mVrCompatibilityDisplayId;
if (displayId != INVALID_DISPLAY) {
if (DEBUG_STACK) {
Slog.d(TAG, "getSourceDisplayId :" + displayId);
@@ -1498,6 +1492,12 @@ class ActivityStarter {
mUsingVrCompatibilityDisplay = true;
return displayId;
}
+
+ displayId = sourceRecord != null ? sourceRecord.getDisplayId() : INVALID_DISPLAY;
+ // If the activity has a displayId set explicitly, launch it on the same displayId.
+ if (displayId != INVALID_DISPLAY) {
+ return displayId;
+ }
return DEFAULT_DISPLAY;
}