Merge "7/ Remove legacy recents animation controller no-op calls" into main
This commit is contained in:
@@ -192,7 +192,6 @@ public abstract class AbsSwipeUpHandler<
|
||||
|
||||
// Null if the recents animation hasn't started yet or has been canceled or finished.
|
||||
protected @Nullable RecentsAnimationController mRecentsAnimationController;
|
||||
protected @Nullable RecentsAnimationController mDeferredCleanupRecentsAnimationController;
|
||||
protected RecentsAnimationTargets mRecentsAnimationTargets;
|
||||
protected @Nullable RECENTS_CONTAINER mContainer;
|
||||
protected @Nullable RECENTS_VIEW mRecentsView;
|
||||
@@ -533,14 +532,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
HashMap<Integer, ThumbnailData> snapshots =
|
||||
mGestureState.consumeRecentsAnimationCanceledSnapshot();
|
||||
if (snapshots != null) {
|
||||
mRecentsView.switchToScreenshot(snapshots, () -> {
|
||||
if (mRecentsAnimationController != null) {
|
||||
mRecentsAnimationController.cleanupScreenshot();
|
||||
} else if (mDeferredCleanupRecentsAnimationController != null) {
|
||||
mDeferredCleanupRecentsAnimationController.cleanupScreenshot();
|
||||
mDeferredCleanupRecentsAnimationController = null;
|
||||
}
|
||||
});
|
||||
mRecentsView.switchToScreenshot(snapshots, () -> {});
|
||||
mRecentsView.onRecentsAnimationComplete();
|
||||
}
|
||||
});
|
||||
@@ -987,9 +979,6 @@ public abstract class AbsSwipeUpHandler<
|
||||
/* event= */ "cancelRecentsAnimation",
|
||||
/* gestureEvent= */ CANCEL_RECENTS_ANIMATION);
|
||||
mActivityInitListener.unregister("AbsSwipeUpHandler.onRecentsAnimationCanceled");
|
||||
// Cache the recents animation controller so we can defer its cleanup to after having
|
||||
// properly cleaned up the screenshot without accidentally using it.
|
||||
mDeferredCleanupRecentsAnimationController = mRecentsAnimationController;
|
||||
mStateCallback.setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED);
|
||||
// Defer clearing the controller and the targets until after we've updated the state
|
||||
mRecentsAnimationController = null;
|
||||
|
||||
@@ -179,7 +179,6 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
private RemoteAnimationTarget[] mLastAppearedTaskTargets;
|
||||
private Set<Integer> mPreviouslyAppearedTaskIds = new HashSet<>();
|
||||
private int[] mLastStartedTaskId = new int[]{INVALID_TASK_ID, INVALID_TASK_ID};
|
||||
private RecentsAnimationController mRecentsAnimationController;
|
||||
private HashMap<Integer, ThumbnailData> mRecentsAnimationCanceledSnapshots;
|
||||
|
||||
/** The time when the swipe up gesture is triggered. */
|
||||
@@ -470,7 +469,6 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
@Override
|
||||
public void onRecentsAnimationStart(RecentsAnimationController controller,
|
||||
RecentsAnimationTargets targets) {
|
||||
mRecentsAnimationController = controller;
|
||||
mStateCallback.setState(STATE_RECENTS_ANIMATION_STARTED);
|
||||
}
|
||||
|
||||
@@ -480,10 +478,6 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
mStateCallback.setState(STATE_RECENTS_ANIMATION_CANCELED);
|
||||
mStateCallback.setState(STATE_RECENTS_ANIMATION_ENDED);
|
||||
if (mRecentsAnimationCanceledSnapshots != null) {
|
||||
// Clean up the screenshot to finalize the recents animation cancel
|
||||
if (mRecentsAnimationController != null) {
|
||||
mRecentsAnimationController.cleanupScreenshot();
|
||||
}
|
||||
mRecentsAnimationCanceledSnapshots = null;
|
||||
}
|
||||
}
|
||||
@@ -522,7 +516,7 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
HashMap<Integer, ThumbnailData> consumeRecentsAnimationCanceledSnapshot() {
|
||||
if (mRecentsAnimationCanceledSnapshots != null) {
|
||||
HashMap<Integer, ThumbnailData> data =
|
||||
new HashMap<Integer, ThumbnailData>(mRecentsAnimationCanceledSnapshots);
|
||||
new HashMap<>(mRecentsAnimationCanceledSnapshots);
|
||||
mRecentsAnimationCanceledSnapshots = null;
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -174,19 +174,7 @@ public class RecentsAnimationCallbacks implements
|
||||
});
|
||||
}
|
||||
|
||||
@BinderThread
|
||||
@Override
|
||||
public boolean onSwitchToScreenshot(Runnable onFinished) {
|
||||
Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), () -> {
|
||||
for (RecentsAnimationListener listener : getListeners()) {
|
||||
if (listener.onSwitchToScreenshot(onFinished)) return;
|
||||
}
|
||||
onFinished.run();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private final void onAnimationFinished(RecentsAnimationController controller) {
|
||||
private void onAnimationFinished(RecentsAnimationController controller) {
|
||||
Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), () -> {
|
||||
ActiveGestureLog.INSTANCE.addLog(
|
||||
/* event= */ "RecentsAnimationCallbacks.onAnimationFinished",
|
||||
@@ -242,12 +230,5 @@ public class RecentsAnimationCallbacks implements
|
||||
* Callback made when a task started from the recents is ready for an app transition.
|
||||
*/
|
||||
default void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTarget) {}
|
||||
|
||||
/**
|
||||
* @return whether this will call onFinished or not (onFinished should only be called once).
|
||||
*/
|
||||
default boolean onSwitchToScreenshot(Runnable onFinished) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,9 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.FINISH_RECENTS_ANIMATION;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.view.IRecentsAnimationController;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManagerGlobal;
|
||||
import android.window.PictureInPictureSurfaceTransaction;
|
||||
@@ -34,11 +32,11 @@ import com.android.internal.jank.Cuj;
|
||||
import com.android.internal.os.IResultReceiver;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.quickstep.util.ActiveGestureErrorDetector;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
|
||||
import com.android.wm.shell.recents.IRecentsAnimationController;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.function.Consumer;
|
||||
@@ -90,15 +88,6 @@ public class RecentsAnimationController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove task remote animation target from
|
||||
* {@link RecentsAnimationCallbacks#onTasksAppeared}}.
|
||||
*/
|
||||
@UiThread
|
||||
public void removeTaskTarget(int targetTaskId) {
|
||||
UI_HELPER_EXECUTOR.execute(() -> mController.removeTask(targetTaskId));
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void finishAnimationToHome() {
|
||||
finishController(true /* toRecents */, null, false /* sendUserLeaveHint */);
|
||||
@@ -172,19 +161,6 @@ public class RecentsAnimationController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IRecentsAnimationController#cleanupScreenshot()
|
||||
*/
|
||||
@UiThread
|
||||
public void cleanupScreenshot() {
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
ActiveGestureLog.INSTANCE.addLog(
|
||||
"cleanupScreenshot",
|
||||
ActiveGestureErrorDetector.GestureEvent.CLEANUP_SCREENSHOT);
|
||||
mController.cleanupScreenshot();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RecentsAnimationControllerCompat#detachNavigationBarFromApp
|
||||
*/
|
||||
@@ -193,14 +169,6 @@ public class RecentsAnimationController {
|
||||
UI_HELPER_EXECUTOR.execute(() -> mController.detachNavigationBarFromApp(moveHomeToTop));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IRecentsAnimationController#animateNavigationBarToApp(long)
|
||||
*/
|
||||
@UiThread
|
||||
public void animateNavigationBarToApp(long duration) {
|
||||
UI_HELPER_EXECUTOR.execute(() -> mController.animateNavigationBarToApp(duration));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IRecentsAnimationController#setWillFinishToHome(boolean)
|
||||
*/
|
||||
|
||||
@@ -43,8 +43,6 @@ import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.IRecentsAnimationController;
|
||||
import android.view.IRecentsAnimationRunner;
|
||||
import android.view.IRemoteAnimationRunner;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
@@ -87,6 +85,8 @@ import com.android.wm.shell.desktopmode.IDesktopMode;
|
||||
import com.android.wm.shell.desktopmode.IDesktopTaskListener;
|
||||
import com.android.wm.shell.draganddrop.IDragAndDrop;
|
||||
import com.android.wm.shell.onehanded.IOneHanded;
|
||||
import com.android.wm.shell.recents.IRecentsAnimationController;
|
||||
import com.android.wm.shell.recents.IRecentsAnimationRunner;
|
||||
import com.android.wm.shell.recents.IRecentTasks;
|
||||
import com.android.wm.shell.recents.IRecentTasksListener;
|
||||
import com.android.wm.shell.shared.GroupedRecentTaskInfo;
|
||||
|
||||
@@ -289,38 +289,10 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
true /*shown*/, null /* animatorHandler */);
|
||||
}
|
||||
if (mController != null) {
|
||||
if (mLastAppearedTaskTargets != null) {
|
||||
for (RemoteAnimationTarget lastTarget : mLastAppearedTaskTargets) {
|
||||
for (RemoteAnimationTarget appearedTarget : appearedTaskTargets) {
|
||||
if (lastTarget != null &&
|
||||
appearedTarget.taskId != lastTarget.taskId) {
|
||||
mController.removeTaskTarget(lastTarget.taskId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mLastAppearedTaskTargets = appearedTaskTargets;
|
||||
mLastGestureState.updateLastAppearedTaskTargets(mLastAppearedTaskTargets);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSwitchToScreenshot(Runnable onFinished) {
|
||||
if (!containerInterface.isInLiveTileMode()
|
||||
|| containerInterface.getCreatedContainer() == null) {
|
||||
// No need to switch since tile is already a screenshot.
|
||||
onFinished.run();
|
||||
} else {
|
||||
final RecentsView recentsView =
|
||||
containerInterface.getCreatedContainer().getOverviewPanel();
|
||||
if (recentsView != null) {
|
||||
recentsView.switchToScreenshot(onFinished);
|
||||
} else {
|
||||
onFinished.run();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final long eventTime = gestureState.getSwipeUpStartTimeMs();
|
||||
mCallbacks.addListener(gestureState);
|
||||
|
||||
@@ -304,14 +304,6 @@ public final class TaskViewUtils {
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// There is no transition animation for app launch from recent in live tile mode so
|
||||
// we have to trigger the navigation bar animation from system here.
|
||||
final RecentsAnimationController controller =
|
||||
recentsView.getRecentsAnimationController();
|
||||
if (controller != null) {
|
||||
controller.animateNavigationBarToApp(RECENTS_LAUNCH_DURATION);
|
||||
}
|
||||
}
|
||||
topMostSimulators = remoteTargetHandles;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user