Loading services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java +1 −21 Original line number Diff line number Diff line Loading @@ -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"); Loading @@ -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"); Loading Loading @@ -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 Loading Loading @@ -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); Loading services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java +16 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -473,6 +471,22 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase { WINDOWING_MODE_FULLSCREEN); } @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( Loading Loading
services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java +1 −21 Original line number Diff line number Diff line Loading @@ -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"); Loading @@ -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"); Loading Loading @@ -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 Loading Loading @@ -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); Loading
services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java +16 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -473,6 +471,22 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase { WINDOWING_MODE_FULLSCREEN); } @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( Loading