From 2705ef31538540888c494651c84abccdcf934d57 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 26 Aug 2024 23:29:11 +0000 Subject: [PATCH] 7/ Remove legacy recents animation controller no-op calls - Update the callers to not call no-op calls which were only used in the non-shell transition recents path (onSwitchToScreenshot was never called following the migration to shell-transition based recents transition) Flag: EXEMPT bugfix Bug: 359608026 Test: atest NexusLauncherTests Change-Id: I396b3ec42a86fbeef1d8854b3ed98be14d47e2b3 --- .../android/quickstep/AbsSwipeUpHandler.java | 13 +------ .../com/android/quickstep/GestureState.java | 8 +---- .../quickstep/RecentsAnimationCallbacks.java | 21 +----------- .../quickstep/RecentsAnimationController.java | 34 +------------------ .../com/android/quickstep/SystemUiProxy.java | 4 +-- .../quickstep/TaskAnimationManager.java | 28 --------------- .../com/android/quickstep/TaskViewUtils.java | 8 ----- 7 files changed, 6 insertions(+), 110 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 05627be4d6..a0cbdaa890 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -190,7 +190,6 @@ public abstract class AbsSwipeUpHandler 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(); } }); @@ -1022,9 +1014,6 @@ public abstract class AbsSwipeUpHandler mPreviouslyAppearedTaskIds = new HashSet<>(); private int[] mLastStartedTaskId = new int[]{INVALID_TASK_ID, INVALID_TASK_ID}; - private RecentsAnimationController mRecentsAnimationController; private HashMap 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 consumeRecentsAnimationCanceledSnapshot() { if (mRecentsAnimationCanceledSnapshots != null) { HashMap data = - new HashMap(mRecentsAnimationCanceledSnapshots); + new HashMap<>(mRecentsAnimationCanceledSnapshots); mRecentsAnimationCanceledSnapshots = null; return data; } diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java index 7b9b5604a0..0c5806b13c 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java @@ -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; - } } } diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationController.java b/quickstep/src/com/android/quickstep/RecentsAnimationController.java index adcf4ef6cd..190d5269ed 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationController.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationController.java @@ -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) */ diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 4392255ba6..8295e0f0ae 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -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; @@ -88,6 +86,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; diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 49ec5973e1..1a0262e32b 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -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); diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 1a09691d9a..d8063ba9b9 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -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; }