Merge "Remove redundant operations of split screen" into sc-v2-dev am: 33c3fc3421
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16145580 Change-Id: I5eeca1e69aea9d31f3e31b9902e521f0ed044a23
This commit is contained in:
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.wm.shell.splitscreen;
|
package com.android.wm.shell.splitscreen;
|
||||||
|
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
|
||||||
|
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@@ -56,7 +54,6 @@ class MainStage extends StageTaskListener {
|
|||||||
|
|
||||||
final WindowContainerToken rootToken = mRootTaskInfo.token;
|
final WindowContainerToken rootToken = mRootTaskInfo.token;
|
||||||
wct.setBounds(rootToken, rootBounds)
|
wct.setBounds(rootToken, rootBounds)
|
||||||
.setWindowingMode(rootToken, WINDOWING_MODE_MULTI_WINDOW)
|
|
||||||
// Moving the root task to top after the child tasks were re-parented , or the root
|
// Moving the root task to top after the child tasks were re-parented , or the root
|
||||||
// task cannot be visible and focused.
|
// task cannot be visible and focused.
|
||||||
.reorder(rootToken, true /* onTop */);
|
.reorder(rootToken, true /* onTop */);
|
||||||
@@ -83,11 +80,7 @@ class MainStage extends StageTaskListener {
|
|||||||
|
|
||||||
if (mRootTaskInfo == null) return;
|
if (mRootTaskInfo == null) return;
|
||||||
final WindowContainerToken rootToken = mRootTaskInfo.token;
|
final WindowContainerToken rootToken = mRootTaskInfo.token;
|
||||||
wct.setLaunchRoot(
|
wct.reparentTasks(
|
||||||
rootToken,
|
|
||||||
null,
|
|
||||||
null)
|
|
||||||
.reparentTasks(
|
|
||||||
rootToken,
|
rootToken,
|
||||||
null /* newParent */,
|
null /* newParent */,
|
||||||
CONTROLLED_WINDOWING_MODES_WHEN_ACTIVE,
|
CONTROLLED_WINDOWING_MODES_WHEN_ACTIVE,
|
||||||
@@ -97,9 +90,4 @@ class MainStage extends StageTaskListener {
|
|||||||
// all its tasks.
|
// all its tasks.
|
||||||
.reorder(rootToken, false /* onTop */);
|
.reorder(rootToken, false /* onTop */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateConfiguration(int windowingMode, Rect bounds, WindowContainerTransaction wct) {
|
|
||||||
wct.setBounds(mRootTaskInfo.token, bounds)
|
|
||||||
.setWindowingMode(mRootTaskInfo.token, windowingMode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,14 +50,8 @@ class SideStage extends StageTaskListener {
|
|||||||
wct.setBounds(rootToken, rootBounds).reorder(rootToken, true /* onTop */);
|
wct.setBounds(rootToken, rootBounds).reorder(rootToken, true /* onTop */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addTask(ActivityManager.RunningTaskInfo task, Rect rootBounds,
|
void addTask(ActivityManager.RunningTaskInfo task, WindowContainerTransaction wct) {
|
||||||
WindowContainerTransaction wct) {
|
wct.reparent(task.token, mRootTaskInfo.token, true /* onTop*/);
|
||||||
final WindowContainerToken rootToken = mRootTaskInfo.token;
|
|
||||||
wct.setBounds(rootToken, rootBounds)
|
|
||||||
.reparent(task.token, rootToken, true /* onTop*/)
|
|
||||||
// Moving the root task to top after the child tasks were reparented , or the root
|
|
||||||
// task cannot be visible and focused.
|
|
||||||
.reorder(rootToken, true /* onTop */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean removeAllTasks(WindowContainerTransaction wct, boolean toTop) {
|
boolean removeAllTasks(WindowContainerTransaction wct, boolean toTop) {
|
||||||
|
|||||||
@@ -268,11 +268,14 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
boolean moveToSideStage(ActivityManager.RunningTaskInfo task,
|
boolean moveToSideStage(ActivityManager.RunningTaskInfo task,
|
||||||
@SplitPosition int sideStagePosition) {
|
@SplitPosition int sideStagePosition) {
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
|
final WindowContainerTransaction evictWct = new WindowContainerTransaction();
|
||||||
setSideStagePosition(sideStagePosition, wct);
|
setSideStagePosition(sideStagePosition, wct);
|
||||||
mMainStage.activate(getMainStageBounds(), wct, true /* reparent */);
|
mSideStage.evictAllChildren(evictWct);
|
||||||
mSideStage.addTask(task, getSideStageBounds(), wct);
|
mSideStage.addTask(task, wct);
|
||||||
mSyncQueue.queue(wct);
|
if (!evictWct.isEmpty()) {
|
||||||
mSyncQueue.runInSync(t -> updateSurfaceBounds(null /* layout */, t));
|
wct.merge(evictWct, true /* transfer */);
|
||||||
|
}
|
||||||
|
mTaskOrganizer.applyTransaction(wct);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,7 +762,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
// Make sure the main stage is active.
|
// Make sure the main stage is active.
|
||||||
mMainStage.activate(getMainStageBounds(), wct, true /* reparent */);
|
mMainStage.activate(getMainStageBounds(), wct, true /* reparent */);
|
||||||
mSideStage.moveToTop(getSideStageBounds(), wct);
|
mSideStage.moveToTop(getSideStageBounds(), wct);
|
||||||
mTaskOrganizer.applyTransaction(wct);
|
mSyncQueue.queue(wct);
|
||||||
|
mSyncQueue.runInSync(t -> updateSurfaceBounds(mSplitLayout, t));
|
||||||
}
|
}
|
||||||
if (!mLogger.hasStartedSession() && mMainStageListener.mHasChildren
|
if (!mLogger.hasStartedSession() && mMainStageListener.mHasChildren
|
||||||
&& mSideStageListener.mHasChildren) {
|
&& mSideStageListener.mHasChildren) {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class SideStageTests extends ShellTestCase {
|
|||||||
public void testAddTask() {
|
public void testAddTask() {
|
||||||
final ActivityManager.RunningTaskInfo task = new TestRunningTaskInfoBuilder().build();
|
final ActivityManager.RunningTaskInfo task = new TestRunningTaskInfoBuilder().build();
|
||||||
|
|
||||||
mSideStage.addTask(task, mRootTask.configuration.windowConfiguration.getBounds(), mWct);
|
mSideStage.addTask(task, mWct);
|
||||||
|
|
||||||
verify(mWct).reparent(eq(task.token), eq(mRootTask.token), eq(true));
|
verify(mWct).reparent(eq(task.token), eq(mRootTask.token), eq(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,10 +113,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
|||||||
|
|
||||||
mStageCoordinator.moveToSideStage(task, SPLIT_POSITION_BOTTOM_OR_RIGHT);
|
mStageCoordinator.moveToSideStage(task, SPLIT_POSITION_BOTTOM_OR_RIGHT);
|
||||||
|
|
||||||
verify(mMainStage).activate(any(Rect.class), any(WindowContainerTransaction.class),
|
verify(mSideStage).addTask(eq(task), any(WindowContainerTransaction.class));
|
||||||
eq(true /* includingTopTask */));
|
|
||||||
verify(mSideStage).addTask(eq(task), any(Rect.class),
|
|
||||||
any(WindowContainerTransaction.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user