summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Rosky <erosky@google.com> 2019-02-27 18:27:35 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-27 18:27:35 +0000
commit9775be8e5b7235e0ca14a225f97c5f35d67c7c84 (patch)
tree0b7a607d975483b495d62ceec85ba8f8984398d8
parente8cb4061a9fb8e3ad7baa10b15faea638e7def29 (diff)
parent6e76a500ddcbe7a35ea844b60fec66c8d5740414 (diff)
Merge "Don't force FREEFORM on FULLSCREEN displays."
-rw-r--r--services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java22
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java18
2 files changed, 17 insertions, 23 deletions
diff --git a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
index f3050a903c70..904c50348b2c 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 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
// 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 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
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 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
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 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
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 ace179acdeb5..cdbb12109c58 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.content.res.Configuration.ORIENTATION_LANDSCAPE;
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 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
}
@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);