Loading libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldAnimationController.java +13 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.wm.shell.unfold; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import android.annotation.NonNull; import android.app.ActivityManager.RunningTaskInfo; import android.app.TaskInfo; Loading Loading @@ -56,6 +54,12 @@ public class UnfoldAnimationController implements UnfoldListener { private final SparseArray<SurfaceControl> mTaskSurfaces = 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( @NonNull ShellInit shellInit, @NonNull TransactionPool transactionPool, Loading Loading @@ -123,7 +127,7 @@ public class UnfoldAnimationController implements UnfoldListener { animator.onTaskChanged(taskInfo); } else { // Became inapplicable resetTask(animator, taskInfo); maybeResetTask(animator, taskInfo); animator.onTaskVanished(taskInfo); mAnimatorsByTaskId.remove(taskInfo.taskId); } Loading Loading @@ -154,7 +158,7 @@ public class UnfoldAnimationController implements UnfoldListener { final boolean isCurrentlyApplicable = animator != null; if (isCurrentlyApplicable) { resetTask(animator, taskInfo); maybeResetTask(animator, taskInfo); animator.onTaskVanished(taskInfo); mAnimatorsByTaskId.remove(taskInfo.taskId); } Loading @@ -166,6 +170,7 @@ public class UnfoldAnimationController implements UnfoldListener { return; } mIsInStageChange = true; SurfaceControl.Transaction transaction = null; for (int i = 0; i < mAnimators.size(); i++) { final UnfoldTaskAnimator animator = mAnimators.get(i); Loading Loading @@ -219,11 +224,12 @@ public class UnfoldAnimationController implements UnfoldListener { transaction.apply(); mTransactionPool.release(transaction); mIsInStageChange = false; } private void resetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) { if (taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) { // PiP task has its own cleanup path, ignore surface reset to avoid conflict. private void maybeResetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) { if (!mIsInStageChange) { // No need to resetTask if there is no ongoing state change. return; } final SurfaceControl.Transaction transaction = mTransactionPool.acquire(); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/unfold/UnfoldAnimationController.java +13 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.wm.shell.unfold; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import android.annotation.NonNull; import android.app.ActivityManager.RunningTaskInfo; import android.app.TaskInfo; Loading Loading @@ -56,6 +54,12 @@ public class UnfoldAnimationController implements UnfoldListener { private final SparseArray<SurfaceControl> mTaskSurfaces = 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( @NonNull ShellInit shellInit, @NonNull TransactionPool transactionPool, Loading Loading @@ -123,7 +127,7 @@ public class UnfoldAnimationController implements UnfoldListener { animator.onTaskChanged(taskInfo); } else { // Became inapplicable resetTask(animator, taskInfo); maybeResetTask(animator, taskInfo); animator.onTaskVanished(taskInfo); mAnimatorsByTaskId.remove(taskInfo.taskId); } Loading Loading @@ -154,7 +158,7 @@ public class UnfoldAnimationController implements UnfoldListener { final boolean isCurrentlyApplicable = animator != null; if (isCurrentlyApplicable) { resetTask(animator, taskInfo); maybeResetTask(animator, taskInfo); animator.onTaskVanished(taskInfo); mAnimatorsByTaskId.remove(taskInfo.taskId); } Loading @@ -166,6 +170,7 @@ public class UnfoldAnimationController implements UnfoldListener { return; } mIsInStageChange = true; SurfaceControl.Transaction transaction = null; for (int i = 0; i < mAnimators.size(); i++) { final UnfoldTaskAnimator animator = mAnimators.get(i); Loading Loading @@ -219,11 +224,12 @@ public class UnfoldAnimationController implements UnfoldListener { transaction.apply(); mTransactionPool.release(transaction); mIsInStageChange = false; } private void resetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) { if (taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) { // PiP task has its own cleanup path, ignore surface reset to avoid conflict. private void maybeResetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) { if (!mIsInStageChange) { // No need to resetTask if there is no ongoing state change. return; } final SurfaceControl.Transaction transaction = mTransactionPool.acquire(); Loading