Merge "Don't force FREEFORM on FULLSCREEN displays."
diff --git a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
index f3050a9..904c503 100644
--- a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
@@ -235,8 +235,7 @@
// STEP 2.3: Adjust launch parameters as needed for freeform display. We enforce the policy
// that legacy (pre-D) apps and those apps that can't handle multiple screen density well
// are forced to be maximized. The rest of this step is to define the default policy when
- // there is no initial bounds or a fully resolved current params from callers. Right now we
- // launch all possible tasks/activities that can handle freeform into freeform mode.
+ // there is no initial bounds or a fully resolved current params from callers.
if (display.inFreeformWindowingMode()) {
if (launchMode == WINDOWING_MODE_PINNED) {
if (DEBUG) appendLog("picture-in-picture");
@@ -247,17 +246,6 @@
launchMode = WINDOWING_MODE_FULLSCREEN;
outParams.mBounds.setEmpty();
if (DEBUG) appendLog("forced-maximize");
- } else if (fullyResolvedCurrentParam) {
- // Don't adjust launch mode if that's inherited, except when we're launching an
- // activity that should be forced to maximize.
- if (DEBUG) appendLog("skip-adjustment-fully-resolved-params");
- } else if (launchMode != WINDOWING_MODE_FREEFORM
- && (isNOrGreater(root) || isPreNResizeable(root))) {
- // We're launching a pre-N and post-D activity that supports resizing, or a post-N
- // activity. They can handle freeform nicely so launch them in freeform.
- // Use undefined because we know we're in a freeform display.
- launchMode = WINDOWING_MODE_UNDEFINED;
- if (DEBUG) appendLog("should-be-freeform");
}
} else {
if (DEBUG) appendLog("non-freeform-display");
@@ -441,10 +429,6 @@
return !root.isResizeable();
}
- private boolean isNOrGreater(@NonNull ActivityRecord root) {
- return root.appInfo.targetSdkVersion >= Build.VERSION_CODES.N;
- }
-
/**
* Resolves activity requested orientation to 4 categories:
* 1) {@link ActivityInfo#SCREEN_ORIENTATION_LOCKED} indicating app wants to lock down
@@ -485,10 +469,6 @@
return orientation;
}
- private boolean isPreNResizeable(ActivityRecord root) {
- return root.appInfo.targetSdkVersion < Build.VERSION_CODES.N && root.isResizeable();
- }
-
private void cascadeBounds(@NonNull Rect srcBounds, @NonNull ActivityDisplay display,
@NonNull Rect outBounds) {
outBounds.set(srcBounds);
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 ace179a..cdbb121 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -29,13 +29,11 @@
import static android.util.DisplayMetrics.DENSITY_DEFAULT;
import static android.view.Display.DEFAULT_DISPLAY;
-import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.RESULT_CONTINUE;
import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.RESULT_SKIP;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
import android.app.ActivityOptions;
import android.content.pm.ActivityInfo;
@@ -474,6 +472,22 @@
}
@Test
+ public void testUsesFullscreenWhenRequestedOnFreeformDisplay() {
+ final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ WINDOWING_MODE_FREEFORM);
+
+ final ActivityOptions options = ActivityOptions.makeBasic();
+ options.setLaunchDisplayId(freeformDisplay.mDisplayId);
+ options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
+
+ assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
+ mActivity, /* source */ null, options, mCurrent, mResult));
+
+ assertEquivalentWindowingMode(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode,
+ WINDOWING_MODE_FREEFORM);
+ }
+
+ @Test
public void testUsesFreeformByDefaultForPostNApp() {
final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
WINDOWING_MODE_FREEFORM);