mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Merge "Finish the recents animation when an unhandled task appears" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
21d4a9cdbc
@@ -1205,17 +1205,28 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
|
||||
}
|
||||
|
||||
/** @return Whether this was the task we were waiting to appear, and thus handled it. */
|
||||
protected boolean handleTaskAppeared(RemoteAnimationTarget[] appearedTaskTarget) {
|
||||
protected boolean handleTaskAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets,
|
||||
@NonNull ActiveGestureLog.CompoundString failureReason) {
|
||||
if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
|
||||
failureReason.append("State handler was invalidated");
|
||||
return false;
|
||||
}
|
||||
boolean hasStartedTaskBefore = Arrays.stream(appearedTaskTarget).anyMatch(
|
||||
mGestureState.mLastStartedTaskIdPredicate);
|
||||
if (mStateCallback.hasStates(STATE_START_NEW_TASK) && hasStartedTaskBefore) {
|
||||
reset();
|
||||
return true;
|
||||
boolean stateStartNewTaskSet = mStateCallback.hasStates(STATE_START_NEW_TASK);
|
||||
if (!stateStartNewTaskSet || !hasStartedTaskBefore(appearedTaskTargets)) {
|
||||
if (!stateStartNewTaskSet) {
|
||||
failureReason.append("STATE_START_NEW_TASK was never set");
|
||||
} else {
|
||||
TaskInfo taskInfo = appearedTaskTargets[0].taskInfo;
|
||||
failureReason.append("Unexpected task appeared")
|
||||
.append(" id=")
|
||||
.append(taskInfo.taskId)
|
||||
.append(" pkg=")
|
||||
.append(taskInfo.baseIntent.getComponent().getPackageName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
private float dpiFromPx(float pixels) {
|
||||
@@ -2402,14 +2413,18 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasStartedTaskBefore(@NonNull RemoteAnimationTarget[] appearedTaskTargets) {
|
||||
return Arrays.stream(appearedTaskTargets)
|
||||
.anyMatch(mGestureState.mLastStartedTaskIdPredicate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets) {
|
||||
if (mRecentsAnimationController == null) {
|
||||
return;
|
||||
}
|
||||
boolean hasStartedTaskBefore = Arrays.stream(appearedTaskTargets).anyMatch(
|
||||
mGestureState.mLastStartedTaskIdPredicate);
|
||||
if (!mStateCallback.hasStates(STATE_GESTURE_COMPLETED) && !hasStartedTaskBefore) {
|
||||
if (!mStateCallback.hasStates(STATE_GESTURE_COMPLETED)
|
||||
&& !hasStartedTaskBefore(appearedTaskTargets)) {
|
||||
// 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];
|
||||
@@ -2423,7 +2438,11 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
|
||||
finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */);
|
||||
return;
|
||||
}
|
||||
if (!handleTaskAppeared(appearedTaskTargets)) {
|
||||
ActiveGestureLog.CompoundString handleTaskFailureReason =
|
||||
new ActiveGestureLog.CompoundString("handleTaskAppeared check failed: ");
|
||||
if (!handleTaskAppeared(appearedTaskTargets, handleTaskFailureReason)) {
|
||||
ActiveGestureLog.INSTANCE.addLog(handleTaskFailureReason);
|
||||
finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */);
|
||||
return;
|
||||
}
|
||||
Optional<RemoteAnimationTarget> taskTargetOptional =
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.fallback.FallbackRecentsView;
|
||||
import com.android.quickstep.fallback.RecentsState;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
@@ -170,14 +171,16 @@ public class FallbackSwipeHandler extends
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean handleTaskAppeared(RemoteAnimationTarget[] appearedTaskTarget) {
|
||||
protected boolean handleTaskAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTarget,
|
||||
@NonNull ActiveGestureLog.CompoundString failureReason) {
|
||||
if (mActiveAnimationFactory != null
|
||||
&& mActiveAnimationFactory.handleHomeTaskAppeared(appearedTaskTarget)) {
|
||||
mActiveAnimationFactory = null;
|
||||
failureReason.append("(FallbackSwipeHandler) should be handled as home task appeared");
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.handleTaskAppeared(appearedTaskTarget);
|
||||
return super.handleTaskAppeared(appearedTaskTarget, failureReason);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user