Merge "Clear bounds of fullscreen leaf tasks" into udc-dev
This commit is contained in:
@@ -2035,6 +2035,10 @@ class Task extends TaskFragment {
|
||||
Rect outOverrideBounds = getResolvedOverrideConfiguration().windowConfiguration.getBounds();
|
||||
|
||||
if (windowingMode == WINDOWING_MODE_FULLSCREEN) {
|
||||
if (!mCreatedByOrganizer) {
|
||||
// Use empty bounds to indicate "fill parent".
|
||||
outOverrideBounds.setEmpty();
|
||||
}
|
||||
// The bounds for fullscreen mode shouldn't be adjusted by minimal size. Otherwise if
|
||||
// the parent or display is smaller than the size, the content may be cropped.
|
||||
return;
|
||||
|
||||
@@ -35,6 +35,8 @@ import static org.mockito.Mockito.atLeast;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.never;
|
||||
|
||||
import android.app.WindowConfiguration;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
@@ -45,6 +47,7 @@ import android.platform.test.annotations.Presubmit;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.ContentRecordingSession;
|
||||
import android.view.Gravity;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceControl;
|
||||
|
||||
@@ -258,8 +261,17 @@ public class ContentRecorderTests extends WindowTestsBase {
|
||||
|
||||
@Test
|
||||
public void testOnTaskBoundsConfigurationChanged_notifiesCallback() {
|
||||
mTask.getRootTask().setWindowingMode(WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW);
|
||||
|
||||
final int recordedWidth = 333;
|
||||
final int recordedHeight = 999;
|
||||
|
||||
final ActivityInfo info = new ActivityInfo();
|
||||
info.windowLayout = new ActivityInfo.WindowLayout(-1 /* width */,
|
||||
-1 /* widthFraction */, -1 /* height */, -1 /* heightFraction */,
|
||||
Gravity.NO_GRAVITY, recordedWidth, recordedHeight);
|
||||
mTask.setMinDimensions(info);
|
||||
|
||||
// WHEN a recording is ongoing.
|
||||
mContentRecorder.setContentRecordingSession(mTaskSession);
|
||||
mContentRecorder.updateRecording();
|
||||
@@ -267,7 +279,6 @@ public class ContentRecorderTests extends WindowTestsBase {
|
||||
|
||||
// WHEN a configuration change arrives, and the recorded content is a different size.
|
||||
mTask.setBounds(new Rect(0, 0, recordedWidth, recordedHeight));
|
||||
mContentRecorder.onConfigurationChanged(mDefaultDisplay.getLastOrientation());
|
||||
assertThat(mContentRecorder.isCurrentlyRecording()).isTrue();
|
||||
|
||||
// THEN content in the captured DisplayArea is scaled to fit the surface size.
|
||||
|
||||
@@ -535,6 +535,34 @@ public class TaskTests extends WindowTestsBase {
|
||||
assertEquals(reqBounds.height(), task.getBounds().height());
|
||||
}
|
||||
|
||||
/** Tests that the task bounds adjust properly to changes between FULLSCREEN and FREEFORM */
|
||||
@Test
|
||||
public void testBoundsOnModeChangeFreeformToFullscreen() {
|
||||
DisplayContent display = mAtm.mRootWindowContainer.getDefaultDisplay();
|
||||
Task rootTask = new TaskBuilder(mSupervisor).setDisplay(display).setCreateActivity(true)
|
||||
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
|
||||
Task task = rootTask.getBottomMostTask();
|
||||
task.getRootActivity().setOrientation(SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
DisplayInfo info = new DisplayInfo();
|
||||
display.mDisplay.getDisplayInfo(info);
|
||||
final Rect fullScreenBounds = new Rect(0, 0, info.logicalWidth, info.logicalHeight);
|
||||
final Rect freeformBounds = new Rect(fullScreenBounds);
|
||||
freeformBounds.inset((int) (freeformBounds.width() * 0.2),
|
||||
(int) (freeformBounds.height() * 0.2));
|
||||
task.setBounds(freeformBounds);
|
||||
|
||||
assertEquals(freeformBounds, task.getBounds());
|
||||
|
||||
// FULLSCREEN inherits bounds
|
||||
rootTask.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
|
||||
assertEquals(fullScreenBounds, task.getBounds());
|
||||
assertEquals(freeformBounds, task.mLastNonFullscreenBounds);
|
||||
|
||||
// FREEFORM restores bounds
|
||||
rootTask.setWindowingMode(WINDOWING_MODE_FREEFORM);
|
||||
assertEquals(freeformBounds, task.getBounds());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a task with forced orientation has orientation-consistent bounds within the
|
||||
* parent.
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.server.wm;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
|
||||
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
|
||||
@@ -1699,7 +1700,8 @@ public class TransitionTests extends WindowTestsBase {
|
||||
@Test
|
||||
public void testTransitionVisibleChange() {
|
||||
registerTestTransitionPlayer();
|
||||
final ActivityRecord app = createActivityRecord(mDisplayContent);
|
||||
final ActivityRecord app = createActivityRecord(
|
||||
mDisplayContent, WINDOWING_MODE_MULTI_WINDOW, ACTIVITY_TYPE_STANDARD);
|
||||
final Transition transition = new Transition(TRANSIT_OPEN, 0 /* flags */,
|
||||
app.mTransitionController, mWm.mSyncEngine);
|
||||
app.mTransitionController.moveToCollecting(transition, BLASTSyncEngine.METHOD_NONE);
|
||||
@@ -1749,7 +1751,8 @@ public class TransitionTests extends WindowTestsBase {
|
||||
@Test
|
||||
public void testVisibleChange_snapshot() {
|
||||
registerTestTransitionPlayer();
|
||||
final ActivityRecord app = createActivityRecord(mDisplayContent);
|
||||
final ActivityRecord app = createActivityRecord(
|
||||
mDisplayContent, WINDOWING_MODE_MULTI_WINDOW, ACTIVITY_TYPE_STANDARD);
|
||||
final Transition transition = new Transition(TRANSIT_CHANGE, 0 /* flags */,
|
||||
app.mTransitionController, mWm.mSyncEngine);
|
||||
app.mTransitionController.moveToCollecting(transition, BLASTSyncEngine.METHOD_NONE);
|
||||
|
||||
Reference in New Issue
Block a user