Fix weird animation when switching back to split pair from recents
Since Launcher indexes TaskView with leaf task ids directly. Collects
opening leaf tasks only to make sure Launcher can identify the proper
TaskView to animate in while finishing the recents transition.
Bug: 223396206
Test: adb shell setprop persist.wm.debug.shell_transit 1 && adb reboot,
enter split mode, switch back and forth between the split pair and
normal fullscreen tasks in overview. Verified both of the
splitting tasks animate in together.
Change-Id: Icec4e3376d7127f6a9ab2820057a2bba63539c3f
This commit is contained in:
@@ -41,6 +41,7 @@ import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.IRecentsAnimationController;
|
||||
import android.view.SurfaceControl;
|
||||
import android.window.IRemoteTransition;
|
||||
@@ -243,22 +244,28 @@ public class RemoteTransitionCompat implements Parcelable {
|
||||
@SuppressLint("NewApi")
|
||||
boolean merge(TransitionInfo info, SurfaceControl.Transaction t,
|
||||
RecentsAnimationListener recents) {
|
||||
ArrayList<TransitionInfo.Change> openingTasks = null;
|
||||
SparseArray<TransitionInfo.Change> openingTasks = null;
|
||||
boolean cancelRecents = false;
|
||||
boolean homeGoingAway = false;
|
||||
boolean hasChangingApp = false;
|
||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if (change.getMode() == TRANSIT_OPEN || change.getMode() == TRANSIT_TO_FRONT) {
|
||||
if (change.getTaskInfo() != null) {
|
||||
if (change.getTaskInfo().topActivityType == ACTIVITY_TYPE_HOME) {
|
||||
final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
|
||||
if (taskInfo != null) {
|
||||
if (taskInfo.topActivityType == ACTIVITY_TYPE_HOME) {
|
||||
// canceling recents animation
|
||||
cancelRecents = true;
|
||||
}
|
||||
if (openingTasks == null) {
|
||||
openingTasks = new ArrayList<>();
|
||||
openingTasks = new SparseArray<>();
|
||||
}
|
||||
openingTasks.add(change);
|
||||
if (taskInfo.hasParentTask()) {
|
||||
// Collects opening leaf tasks only since Launcher monitors leaf task
|
||||
// ids to perform recents animation.
|
||||
openingTasks.remove(taskInfo.parentTaskId);
|
||||
}
|
||||
openingTasks.put(taskInfo.taskId, change);
|
||||
}
|
||||
} else if (change.getMode() == TRANSIT_CLOSE
|
||||
|| change.getMode() == TRANSIT_TO_BACK) {
|
||||
@@ -286,7 +293,7 @@ public class RemoteTransitionCompat implements Parcelable {
|
||||
int pauseMatches = 0;
|
||||
if (!cancelRecents) {
|
||||
for (int i = 0; i < openingTasks.size(); ++i) {
|
||||
if (mPausingTasks.contains(openingTasks.get(i).getContainer())) {
|
||||
if (mPausingTasks.contains(openingTasks.valueAt(i).getContainer())) {
|
||||
++pauseMatches;
|
||||
}
|
||||
}
|
||||
@@ -307,10 +314,11 @@ public class RemoteTransitionCompat implements Parcelable {
|
||||
final RemoteAnimationTargetCompat[] targets =
|
||||
new RemoteAnimationTargetCompat[openingTasks.size()];
|
||||
for (int i = 0; i < openingTasks.size(); ++i) {
|
||||
mOpeningLeashes.add(openingTasks.get(i).getLeash());
|
||||
final TransitionInfo.Change change = openingTasks.valueAt(i);
|
||||
mOpeningLeashes.add(change.getLeash());
|
||||
// We are receiving new opening tasks, so convert to onTasksAppeared.
|
||||
final RemoteAnimationTargetCompat target = new RemoteAnimationTargetCompat(
|
||||
openingTasks.get(i), layer, info, t);
|
||||
change, layer, info, t);
|
||||
mLeashMap.put(mOpeningLeashes.get(i), target.leash);
|
||||
t.reparent(target.leash, mInfo.getRootLeash());
|
||||
t.setLayer(target.leash, layer);
|
||||
|
||||
Reference in New Issue
Block a user