Merge "Fix weird animation when switching back to split pair from recents" into tm-dev
This commit is contained in:
@@ -41,6 +41,7 @@ import android.os.Parcelable;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.SparseArray;
|
||||||
import android.view.IRecentsAnimationController;
|
import android.view.IRecentsAnimationController;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
import android.window.IRemoteTransition;
|
import android.window.IRemoteTransition;
|
||||||
@@ -244,22 +245,28 @@ public class RemoteTransitionCompat implements Parcelable {
|
|||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
boolean merge(TransitionInfo info, SurfaceControl.Transaction t,
|
boolean merge(TransitionInfo info, SurfaceControl.Transaction t,
|
||||||
RecentsAnimationListener recents) {
|
RecentsAnimationListener recents) {
|
||||||
ArrayList<TransitionInfo.Change> openingTasks = null;
|
SparseArray<TransitionInfo.Change> openingTasks = null;
|
||||||
boolean cancelRecents = false;
|
boolean cancelRecents = false;
|
||||||
boolean homeGoingAway = false;
|
boolean homeGoingAway = false;
|
||||||
boolean hasChangingApp = false;
|
boolean hasChangingApp = false;
|
||||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||||
if (change.getMode() == TRANSIT_OPEN || change.getMode() == TRANSIT_TO_FRONT) {
|
if (change.getMode() == TRANSIT_OPEN || change.getMode() == TRANSIT_TO_FRONT) {
|
||||||
if (change.getTaskInfo() != null) {
|
final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
|
||||||
if (change.getTaskInfo().topActivityType == ACTIVITY_TYPE_HOME) {
|
if (taskInfo != null) {
|
||||||
|
if (taskInfo.topActivityType == ACTIVITY_TYPE_HOME) {
|
||||||
// canceling recents animation
|
// canceling recents animation
|
||||||
cancelRecents = true;
|
cancelRecents = true;
|
||||||
}
|
}
|
||||||
if (openingTasks == null) {
|
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
|
} else if (change.getMode() == TRANSIT_CLOSE
|
||||||
|| change.getMode() == TRANSIT_TO_BACK) {
|
|| change.getMode() == TRANSIT_TO_BACK) {
|
||||||
@@ -287,7 +294,7 @@ public class RemoteTransitionCompat implements Parcelable {
|
|||||||
int pauseMatches = 0;
|
int pauseMatches = 0;
|
||||||
if (!cancelRecents) {
|
if (!cancelRecents) {
|
||||||
for (int i = 0; i < openingTasks.size(); ++i) {
|
for (int i = 0; i < openingTasks.size(); ++i) {
|
||||||
if (mPausingTasks.contains(openingTasks.get(i).getContainer())) {
|
if (mPausingTasks.contains(openingTasks.valueAt(i).getContainer())) {
|
||||||
++pauseMatches;
|
++pauseMatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,10 +315,11 @@ public class RemoteTransitionCompat implements Parcelable {
|
|||||||
final RemoteAnimationTargetCompat[] targets =
|
final RemoteAnimationTargetCompat[] targets =
|
||||||
new RemoteAnimationTargetCompat[openingTasks.size()];
|
new RemoteAnimationTargetCompat[openingTasks.size()];
|
||||||
for (int i = 0; i < openingTasks.size(); ++i) {
|
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.
|
// We are receiving new opening tasks, so convert to onTasksAppeared.
|
||||||
final RemoteAnimationTargetCompat target = new RemoteAnimationTargetCompat(
|
final RemoteAnimationTargetCompat target = new RemoteAnimationTargetCompat(
|
||||||
openingTasks.get(i), layer, info, t);
|
change, layer, info, t);
|
||||||
mLeashMap.put(mOpeningLeashes.get(i), target.leash);
|
mLeashMap.put(mOpeningLeashes.get(i), target.leash);
|
||||||
t.reparent(target.leash, mInfo.getRootLeash());
|
t.reparent(target.leash, mInfo.getRootLeash());
|
||||||
t.setLayer(target.leash, layer);
|
t.setLayer(target.leash, layer);
|
||||||
|
|||||||
Reference in New Issue
Block a user