Merge changes Ifd466d1e,I9f57651a
* changes: Don't set windowing mode in fullscreen displays. Only persist launch params on freeform display.
This commit is contained in:
committed by
Android (Google) Code Review
commit
42439214eb
@@ -338,6 +338,11 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
|
||||
mDisplayWindowingMode = windowingMode;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@WindowingMode
|
||||
public int getDisplayWindowingMode() {
|
||||
return mDisplayWindowingMode;
|
||||
}
|
||||
|
||||
public void setActivityType(@ActivityType int activityType) {
|
||||
if (mActivityType == activityType) {
|
||||
|
||||
@@ -211,7 +211,9 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
|
||||
if (!currentParams.isEmpty() && !hasInitialBounds
|
||||
&& (!currentParams.hasPreferredDisplay()
|
||||
|| displayId == currentParams.mPreferredDisplayId)) {
|
||||
if (currentParams.hasWindowingMode()) {
|
||||
// Only set windowing mode if display is in freeform. If the display is in fullscreen
|
||||
// mode we should only launch a task in fullscreen mode.
|
||||
if (currentParams.hasWindowingMode() && display.inFreeformWindowingMode()) {
|
||||
launchMode = currentParams.mWindowingMode;
|
||||
fullyResolvedCurrentParam = launchMode != WINDOWING_MODE_FREEFORM;
|
||||
if (DEBUG) {
|
||||
|
||||
@@ -1908,7 +1908,7 @@ class TaskRecord extends ConfigurationContainer {
|
||||
/**
|
||||
* Saves launching state if necessary so that we can launch the activity to its latest state.
|
||||
* It only saves state if this task has been shown to user and it's in fullscreen or freeform
|
||||
* mode.
|
||||
* mode on freeform displays.
|
||||
*/
|
||||
void saveLaunchingStateIfNeeded() {
|
||||
if (!hasBeenVisible) {
|
||||
@@ -1917,8 +1917,15 @@ class TaskRecord extends ConfigurationContainer {
|
||||
}
|
||||
|
||||
final int windowingMode = getWindowingMode();
|
||||
if (windowingMode != WindowConfiguration.WINDOWING_MODE_FULLSCREEN
|
||||
&& windowingMode != WindowConfiguration.WINDOWING_MODE_FREEFORM) {
|
||||
if (windowingMode != WINDOWING_MODE_FULLSCREEN
|
||||
&& windowingMode != WINDOWING_MODE_FREEFORM) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't persist state if display isn't in freeform mode. Then the task will be launched
|
||||
// back to its last state in a freeform display when it's launched in a freeform display
|
||||
// next time.
|
||||
if (getWindowConfiguration().getDisplayWindowingMode() != WINDOWING_MODE_FREEFORM) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -345,6 +345,19 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
|
||||
WINDOWING_MODE_FULLSCREEN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchesFullscreenOnFullscreenDisplayWithFreeformHistory() {
|
||||
mCurrent.mPreferredDisplayId = Display.INVALID_DISPLAY;
|
||||
mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
|
||||
mCurrent.mBounds.set(0, 0, 200, 100);
|
||||
|
||||
assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
|
||||
mActivity, /* source */ null, /* options */ null, mCurrent, mResult));
|
||||
|
||||
assertEquivalentWindowingMode(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode,
|
||||
WINDOWING_MODE_FULLSCREEN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRespectsFullyResolvedCurrentParam_Fullscreen() {
|
||||
final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
|
||||
@@ -1173,6 +1186,19 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
|
||||
assertEquals(new Rect(0, 0, 1680, 953), mResult.mBounds);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsNonFullscreenBoundsOnFullscreenDisplayWithFreeformHistory() {
|
||||
mCurrent.mPreferredDisplayId = Display.INVALID_DISPLAY;
|
||||
mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
|
||||
mCurrent.mBounds.set(0, 0, 200, 100);
|
||||
|
||||
assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
|
||||
mActivity, /* source */ null, /* options */ null, mCurrent, mResult));
|
||||
|
||||
// Returned bounds with in fullscreen mode will be set to last non-fullscreen bounds.
|
||||
assertEquals(new Rect(0, 0, 200, 100), mCurrent.mBounds);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdjustsBoundsToFitInDisplayFullyResolvedBounds() {
|
||||
final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
|
||||
@@ -1186,7 +1212,7 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
|
||||
options.setLaunchDisplayId(freeformDisplay.mDisplayId);
|
||||
|
||||
assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
|
||||
mActivity, /* source */ null, /* options */ null, mCurrent, mResult));
|
||||
mActivity, /* source */ null, options, mCurrent, mResult));
|
||||
|
||||
assertEquals(new Rect(0, 0, 300, 300), mResult.mBounds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user