summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Garfield Tan <xutan@google.com> 2019-01-03 10:31:59 -0800
committer Garfield Tan <xutan@google.com> 2019-01-03 11:01:39 -0800
commitd5972d10c4bcc6afb23e471109b212ed91a8d314 (patch)
tree3130f5de249094d152654dd2b37f2cfacab11d1f
parent76e986a2f25e71924937b63bbf1cd793d72094d3 (diff)
Set bounds from previous modifiers for fullscreen
Bounds in LaunchParams are still used to restore TaskRecord#mLastNonFullscreenBounds if windowing mode is not freeform. Therefore still pass it along if previous modifiers or LaunchParamsController has that. Fixes: 121166721 Test: Manual test and WmTests:TaskLaunchParamsModifierTests. Change-Id: I7a554ff38478594a032bc0123beeffead7c152b4
-rw-r--r--services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java12
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java15
2 files changed, 24 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
index 5107b522c33b..2a5584029bcb 100644
--- a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
@@ -219,10 +219,16 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
}
}
- if (launchMode == WINDOWING_MODE_FREEFORM && !currentParams.mBounds.isEmpty()) {
+ if (!currentParams.mBounds.isEmpty()) {
+ // Carry over bounds from callers regardless of launch mode because bounds is still
+ // used to restore last non-fullscreen bounds when launch mode is not freeform.
+ // Therefore it's not a resolution step for non-freeform launch mode and only
+ // consider it fully resolved only when launch mode is freeform.
outParams.mBounds.set(currentParams.mBounds);
- fullyResolvedCurrentParam = true;
- if (DEBUG) appendLog("inherit-bounds=" + outParams.mBounds);
+ if (launchMode == WINDOWING_MODE_FREEFORM) {
+ fullyResolvedCurrentParam = true;
+ if (DEBUG) appendLog("inherit-bounds=" + outParams.mBounds);
+ }
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
index 7186e22cefef..e789c16c1bd7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -768,6 +768,21 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
}
@Test
+ public void testReturnBoundsForFullscreenWindowingMode() {
+ final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ WINDOWING_MODE_FREEFORM);
+
+ mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
+ mCurrent.mWindowingMode = WINDOWING_MODE_FULLSCREEN;
+ mCurrent.mBounds.set(0, 0, 200, 100);
+
+ assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
+ mActivity, /* source */ null, /* options */ null, mCurrent, mResult));
+
+ assertEquals(new Rect(0, 0, 200, 100), mResult.mBounds);
+ }
+
+ @Test
public void testUsesDisplayOrientationForNoSensorOrientation() {
final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
WINDOWING_MODE_FREEFORM);