Merge "Do not reset surface when entering PiP" into tm-qpr-dev
This commit is contained in:
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.wm.shell.unfold;
|
package com.android.wm.shell.unfold;
|
||||||
|
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.app.ActivityManager.RunningTaskInfo;
|
import android.app.ActivityManager.RunningTaskInfo;
|
||||||
import android.app.TaskInfo;
|
import android.app.TaskInfo;
|
||||||
@@ -56,6 +54,12 @@ public class UnfoldAnimationController implements UnfoldListener {
|
|||||||
private final SparseArray<SurfaceControl> mTaskSurfaces = new SparseArray<>();
|
private final SparseArray<SurfaceControl> mTaskSurfaces = new SparseArray<>();
|
||||||
private final SparseArray<UnfoldTaskAnimator> mAnimatorsByTaskId = new SparseArray<>();
|
private final SparseArray<UnfoldTaskAnimator> mAnimatorsByTaskId = new SparseArray<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether we're in stage change process. This should be set to {@code true} in
|
||||||
|
* {@link #onStateChangeStarted()} and {@code false} in {@link #onStateChangeFinished()}.
|
||||||
|
*/
|
||||||
|
private boolean mIsInStageChange;
|
||||||
|
|
||||||
public UnfoldAnimationController(
|
public UnfoldAnimationController(
|
||||||
@NonNull ShellInit shellInit,
|
@NonNull ShellInit shellInit,
|
||||||
@NonNull TransactionPool transactionPool,
|
@NonNull TransactionPool transactionPool,
|
||||||
@@ -123,7 +127,7 @@ public class UnfoldAnimationController implements UnfoldListener {
|
|||||||
animator.onTaskChanged(taskInfo);
|
animator.onTaskChanged(taskInfo);
|
||||||
} else {
|
} else {
|
||||||
// Became inapplicable
|
// Became inapplicable
|
||||||
resetTask(animator, taskInfo);
|
maybeResetTask(animator, taskInfo);
|
||||||
animator.onTaskVanished(taskInfo);
|
animator.onTaskVanished(taskInfo);
|
||||||
mAnimatorsByTaskId.remove(taskInfo.taskId);
|
mAnimatorsByTaskId.remove(taskInfo.taskId);
|
||||||
}
|
}
|
||||||
@@ -154,7 +158,7 @@ public class UnfoldAnimationController implements UnfoldListener {
|
|||||||
final boolean isCurrentlyApplicable = animator != null;
|
final boolean isCurrentlyApplicable = animator != null;
|
||||||
|
|
||||||
if (isCurrentlyApplicable) {
|
if (isCurrentlyApplicable) {
|
||||||
resetTask(animator, taskInfo);
|
maybeResetTask(animator, taskInfo);
|
||||||
animator.onTaskVanished(taskInfo);
|
animator.onTaskVanished(taskInfo);
|
||||||
mAnimatorsByTaskId.remove(taskInfo.taskId);
|
mAnimatorsByTaskId.remove(taskInfo.taskId);
|
||||||
}
|
}
|
||||||
@@ -166,6 +170,7 @@ public class UnfoldAnimationController implements UnfoldListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mIsInStageChange = true;
|
||||||
SurfaceControl.Transaction transaction = null;
|
SurfaceControl.Transaction transaction = null;
|
||||||
for (int i = 0; i < mAnimators.size(); i++) {
|
for (int i = 0; i < mAnimators.size(); i++) {
|
||||||
final UnfoldTaskAnimator animator = mAnimators.get(i);
|
final UnfoldTaskAnimator animator = mAnimators.get(i);
|
||||||
@@ -219,11 +224,12 @@ public class UnfoldAnimationController implements UnfoldListener {
|
|||||||
transaction.apply();
|
transaction.apply();
|
||||||
|
|
||||||
mTransactionPool.release(transaction);
|
mTransactionPool.release(transaction);
|
||||||
|
mIsInStageChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) {
|
private void maybeResetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) {
|
||||||
if (taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) {
|
if (!mIsInStageChange) {
|
||||||
// PiP task has its own cleanup path, ignore surface reset to avoid conflict.
|
// No need to resetTask if there is no ongoing state change.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final SurfaceControl.Transaction transaction = mTransactionPool.acquire();
|
final SurfaceControl.Transaction transaction = mTransactionPool.acquire();
|
||||||
|
|||||||
Reference in New Issue
Block a user