Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +18 −3 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.app.Activity; import android.app.ActivityManager; import android.app.TaskInfo; import android.app.WindowConfiguration; import android.content.Context; import android.content.Intent; Loading Loading @@ -2079,13 +2080,16 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (!mCanceled) { TaskView nextTask = mRecentsView.getNextPageTaskView(); if (nextTask != null) { int taskId = nextTask.getTask().key.id; Task.TaskKey nextTaskKey = nextTask.getTask().key; int taskId = nextTaskKey.id; mGestureState.updateLastStartedTaskId(taskId); boolean hasTaskPreviouslyAppeared = mGestureState.getPreviouslyAppearedTaskIds() .contains(taskId); if (!hasTaskPreviouslyAppeared) { ActiveGestureLog.INSTANCE.trackEvent(EXPECTING_TASK_APPEARED); } ActiveGestureLog.INSTANCE.addLog("Launching task: id=" + taskId + " pkg=" + nextTaskKey.getPackageName()); nextTask.launchTask(success -> { resultCallback.accept(success); if (success) { Loading Loading @@ -2154,7 +2158,18 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, @Override public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets) { if (mRecentsAnimationController != null) { if (handleTaskAppeared(appearedTaskTargets)) { boolean hasStartedTaskBefore = Arrays.stream(appearedTaskTargets).anyMatch( targetCompat -> targetCompat.taskId == mGestureState.getLastStartedTaskId()); if (!mStateCallback.hasStates(STATE_GESTURE_COMPLETED) && !hasStartedTaskBefore) { // This is a special case, if a task is started mid-gesture that wasn't a part of a // previous quickswitch task launch, then cancel the animation back to the app RemoteAnimationTarget appearedTaskTarget = appearedTaskTargets[0]; TaskInfo taskInfo = appearedTaskTarget.taskInfo; ActiveGestureLog.INSTANCE.addLog("Unexpected task appeared" + " id=" + taskInfo.taskId + " pkg=" + taskInfo.baseIntent.getComponent().getPackageName()); finishRecentsAnimationOnTasksAppeared(); } else if (handleTaskAppeared(appearedTaskTargets)) { Optional<RemoteAnimationTarget> taskTargetOptional = Arrays.stream(appearedTaskTargets) .filter(targetCompat -> Loading Loading @@ -2202,7 +2217,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (mRecentsAnimationController != null) { mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); } ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", false); ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimationOnTasksAppeared"); } /** Loading Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +18 −3 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.app.Activity; import android.app.ActivityManager; import android.app.TaskInfo; import android.app.WindowConfiguration; import android.content.Context; import android.content.Intent; Loading Loading @@ -2079,13 +2080,16 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (!mCanceled) { TaskView nextTask = mRecentsView.getNextPageTaskView(); if (nextTask != null) { int taskId = nextTask.getTask().key.id; Task.TaskKey nextTaskKey = nextTask.getTask().key; int taskId = nextTaskKey.id; mGestureState.updateLastStartedTaskId(taskId); boolean hasTaskPreviouslyAppeared = mGestureState.getPreviouslyAppearedTaskIds() .contains(taskId); if (!hasTaskPreviouslyAppeared) { ActiveGestureLog.INSTANCE.trackEvent(EXPECTING_TASK_APPEARED); } ActiveGestureLog.INSTANCE.addLog("Launching task: id=" + taskId + " pkg=" + nextTaskKey.getPackageName()); nextTask.launchTask(success -> { resultCallback.accept(success); if (success) { Loading Loading @@ -2154,7 +2158,18 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, @Override public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets) { if (mRecentsAnimationController != null) { if (handleTaskAppeared(appearedTaskTargets)) { boolean hasStartedTaskBefore = Arrays.stream(appearedTaskTargets).anyMatch( targetCompat -> targetCompat.taskId == mGestureState.getLastStartedTaskId()); if (!mStateCallback.hasStates(STATE_GESTURE_COMPLETED) && !hasStartedTaskBefore) { // This is a special case, if a task is started mid-gesture that wasn't a part of a // previous quickswitch task launch, then cancel the animation back to the app RemoteAnimationTarget appearedTaskTarget = appearedTaskTargets[0]; TaskInfo taskInfo = appearedTaskTarget.taskInfo; ActiveGestureLog.INSTANCE.addLog("Unexpected task appeared" + " id=" + taskInfo.taskId + " pkg=" + taskInfo.baseIntent.getComponent().getPackageName()); finishRecentsAnimationOnTasksAppeared(); } else if (handleTaskAppeared(appearedTaskTargets)) { Optional<RemoteAnimationTarget> taskTargetOptional = Arrays.stream(appearedTaskTargets) .filter(targetCompat -> Loading Loading @@ -2202,7 +2217,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (mRecentsAnimationController != null) { mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); } ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimation", false); ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimationOnTasksAppeared"); } /** Loading