Merge "Fix split cannot active if app trampoline launch new task" into tm-qpr-dev
This commit is contained in:
@@ -727,10 +727,6 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
|
|||||||
getRefBounds2(mTempRect);
|
getRefBounds2(mTempRect);
|
||||||
t.setPosition(leash2, mTempRect.left, mTempRect.top)
|
t.setPosition(leash2, mTempRect.left, mTempRect.top)
|
||||||
.setWindowCrop(leash2, mTempRect.width(), mTempRect.height());
|
.setWindowCrop(leash2, mTempRect.width(), mTempRect.height());
|
||||||
// Make right or bottom side surface always higher than left or top side to avoid weird
|
|
||||||
// animation when dismiss split. e.g. App surface fling above on decor surface.
|
|
||||||
t.setLayer(leash1, 1);
|
|
||||||
t.setLayer(leash2, 2);
|
|
||||||
|
|
||||||
if (mImePositionProcessor.adjustSurfaceLayoutForIme(
|
if (mImePositionProcessor.adjustSurfaceLayoutForIme(
|
||||||
t, dividerLeash, leash1, leash2, dimLayer1, dimLayer2)) {
|
t, dividerLeash, leash1, leash2, dimLayer1, dimLayer2)) {
|
||||||
|
|||||||
@@ -468,26 +468,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
RemoteAnimationTarget[] wallpapers,
|
RemoteAnimationTarget[] wallpapers,
|
||||||
RemoteAnimationTarget[] nonApps,
|
RemoteAnimationTarget[] nonApps,
|
||||||
final IRemoteAnimationFinishedCallback finishedCallback) {
|
final IRemoteAnimationFinishedCallback finishedCallback) {
|
||||||
boolean openingToSide = false;
|
if (isEnteringSplit && mSideStage.getChildCount() == 0) {
|
||||||
if (apps != null) {
|
|
||||||
for (int i = 0; i < apps.length; ++i) {
|
|
||||||
if (apps[i].mode == MODE_OPENING
|
|
||||||
&& mSideStage.containsTask(apps[i].taskId)) {
|
|
||||||
openingToSide = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (mSideStage.getChildCount() != 0) {
|
|
||||||
// There are chances the entering app transition got canceled by performing
|
|
||||||
// rotation transition. Checks if there is any child task existed in split
|
|
||||||
// screen before fallback to cancel entering flow.
|
|
||||||
openingToSide = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEnteringSplit && !openingToSide) {
|
|
||||||
mMainExecutor.execute(() -> exitSplitScreen(
|
mMainExecutor.execute(() -> exitSplitScreen(
|
||||||
mSideStage.getChildCount() == 0 ? mMainStage : mSideStage,
|
null /* childrenToTop */, EXIT_REASON_UNKNOWN));
|
||||||
EXIT_REASON_UNKNOWN));
|
mSplitUnsupportedToast.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finishedCallback != null) {
|
if (finishedCallback != null) {
|
||||||
@@ -572,26 +556,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
|
RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
|
||||||
IRemoteAnimationFinishedCallback finishedCallback,
|
IRemoteAnimationFinishedCallback finishedCallback,
|
||||||
SurfaceControl.Transaction t) {
|
SurfaceControl.Transaction t) {
|
||||||
boolean openingToSide = false;
|
if (isEnteringSplit && mSideStage.getChildCount() == 0) {
|
||||||
if (apps != null) {
|
|
||||||
for (int i = 0; i < apps.length; ++i) {
|
|
||||||
if (apps[i].mode == MODE_OPENING
|
|
||||||
&& mSideStage.containsTask(apps[i].taskId)) {
|
|
||||||
openingToSide = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (mSideStage.getChildCount() != 0) {
|
|
||||||
// There are chances the entering app transition got canceled by performing
|
|
||||||
// rotation transition. Checks if there is any child task existed in split
|
|
||||||
// screen before fallback to cancel entering flow.
|
|
||||||
openingToSide = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEnteringSplit && !openingToSide && apps != null) {
|
|
||||||
mMainExecutor.execute(() -> exitSplitScreen(
|
mMainExecutor.execute(() -> exitSplitScreen(
|
||||||
mSideStage.getChildCount() == 0 ? mMainStage : mSideStage,
|
null /* childrenToTop */, EXIT_REASON_UNKNOWN));
|
||||||
EXIT_REASON_UNKNOWN));
|
mSplitUnsupportedToast.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apps != null) {
|
if (apps != null) {
|
||||||
|
|||||||
@@ -220,20 +220,12 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
mCallbacks.onNoLongerSupportMultiWindow();
|
mCallbacks.onNoLongerSupportMultiWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (taskInfo.topActivity == null && mChildrenTaskInfo.contains(taskInfo.taskId)
|
mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
|
||||||
&& mChildrenTaskInfo.get(taskInfo.taskId).topActivity != null) {
|
|
||||||
// If top activity become null, it means the task is about to vanish, we use this
|
|
||||||
// signal to remove it from children list earlier for smooth dismiss transition.
|
|
||||||
mChildrenTaskInfo.remove(taskInfo.taskId);
|
|
||||||
mChildrenLeashes.remove(taskInfo.taskId);
|
|
||||||
} else {
|
|
||||||
mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
|
|
||||||
}
|
|
||||||
mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */,
|
mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */,
|
||||||
taskInfo.isVisible);
|
taskInfo.isVisible);
|
||||||
if (!ENABLE_SHELL_TRANSITIONS && mChildrenLeashes.contains(taskInfo.taskId)) {
|
if (!ENABLE_SHELL_TRANSITIONS) {
|
||||||
updateChildTaskSurface(taskInfo, mChildrenLeashes.get(taskInfo.taskId),
|
updateChildTaskSurface(
|
||||||
false /* firstAppeared */);
|
taskInfo, mChildrenLeashes.get(taskInfo.taskId), false /* firstAppeared */);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
||||||
@@ -267,6 +259,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendStatusChanged();
|
sendStatusChanged();
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
|
||||||
|
+ "\n mRootTaskInfo: " + mRootTaskInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,12 @@ public final class StageTaskListenerTests extends ShellTestCase {
|
|||||||
verify(mCallbacks).onStatusChanged(eq(mRootTask.isVisible), eq(true));
|
verify(mCallbacks).onStatusChanged(eq(mRootTask.isVisible), eq(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
public void testUnknownTaskVanished() {
|
||||||
|
final ActivityManager.RunningTaskInfo task = new TestRunningTaskInfoBuilder().build();
|
||||||
|
mStageTaskListener.onTaskVanished(task);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTaskVanished() {
|
public void testTaskVanished() {
|
||||||
// With shell transitions, the transition manages status changes, so skip this test.
|
// With shell transitions, the transition manages status changes, so skip this test.
|
||||||
|
|||||||
Reference in New Issue
Block a user