summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2024-09-10 21:50:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-09-10 21:50:00 +0000
commit7164ab54d1290cc19e8573ae5e48441aec32402c (patch)
tree1b084fa51a7af05d62c67121cdb7f3b5f66f4135 /libs
parent12932d25ed4b06b7c2e32158364038ec9a9175ec (diff)
parenteda33eca155078b165bfc8f0ef642f242d46abd4 (diff)
Merge "6/ Remove unhandled recents animation controller calls from the interface" into main
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentTasks.aidl2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationController.aidl108
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationRunner.aidl68
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java29
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java2
6 files changed, 179 insertions, 32 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentTasks.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentTasks.aidl
index ebfd3571ae6d..799028a5507a 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentTasks.aidl
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentTasks.aidl
@@ -21,8 +21,8 @@ import android.app.IApplicationThread;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
-import android.view.IRecentsAnimationRunner;
+import com.android.wm.shell.recents.IRecentsAnimationRunner;
import com.android.wm.shell.recents.IRecentTasksListener;
import com.android.wm.shell.shared.GroupedRecentTaskInfo;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationController.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationController.aidl
new file mode 100644
index 000000000000..ccfaab079205
--- /dev/null
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationController.aidl
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.wm.shell.recents;
+
+import android.app.ActivityManager;
+import android.graphics.GraphicBuffer;
+import android.view.IRemoteAnimationFinishedCallback;
+import android.view.RemoteAnimationTarget;
+import android.view.SurfaceControl;
+import android.window.PictureInPictureSurfaceTransaction;
+import android.window.TaskSnapshot;
+import android.window.WindowAnimationState;
+
+import com.android.internal.os.IResultReceiver;
+
+/**
+ * Passed to the {@link IRecentsAnimationRunner} in order for the runner to control to let the
+ * runner control certain aspects of the recents animation, and to notify window manager when the
+ * animation has completed.
+ *
+ * {@hide}
+ */
+interface IRecentsAnimationController {
+
+ /**
+ * Takes a screenshot of the task associated with the given {@param taskId}. Only valid for the
+ * current set of task ids provided to the handler.
+ */
+ TaskSnapshot screenshotTask(int taskId);
+
+ /**
+ * Sets the final surface transaction on a Task. This is used by Launcher to notify the system
+ * that animating Activity to PiP has completed and the associated task surface should be
+ * updated accordingly. This should be called before `finish`
+ * @param taskId for which the leash should be updated
+ * @param finishTransaction leash operations for the final transform.
+ * @param overlay the surface control for an overlay being shown above the pip (can be null)
+ */
+ void setFinishTaskTransaction(int taskId,
+ in PictureInPictureSurfaceTransaction finishTransaction, in SurfaceControl overlay);
+
+ /**
+ * Notifies to the system that the animation into Recents should end, and all leashes associated
+ * with remote animation targets should be relinquished. If {@param moveHomeToTop} is true, then
+ * the home activity should be moved to the top. Otherwise, the home activity is hidden and the
+ * user is returned to the app.
+ * @param sendUserLeaveHint If set to true, {@link Activity#onUserLeaving} will be sent to the
+ * top resumed app, false otherwise.
+ */
+ void finish(boolean moveHomeToTop, boolean sendUserLeaveHint, in IResultReceiver finishCb);
+
+ /**
+ * Called by the handler to indicate that the recents animation input consumer should be
+ * enabled. This is currently used to work around an issue where registering an input consumer
+ * mid-animation causes the existing motion event chain to be canceled. Instead, the caller
+ * may register the recents animation input consumer prior to starting the recents animation
+ * and then enable it mid-animation to start receiving touch events.
+ */
+ void setInputConsumerEnabled(boolean enabled);
+
+ /**
+ * Sets a state for controller to decide which surface is the destination when the recents
+ * animation is cancelled through fail safe mechanism.
+ */
+ void setWillFinishToHome(boolean willFinishToHome);
+
+ /**
+ * Detach navigation bar from app.
+ *
+ * The system reparents the leash of navigation bar to the app when the recents animation starts
+ * and Launcher should call this method to let system restore the navigation bar to its
+ * original position when the quick switch gesture is finished and will run the fade-in
+ * animation If {@param moveHomeToTop} is {@code true}. Otherwise, restore the navigtation bar
+ * without animation.
+ *
+ * @param moveHomeToTop if {@code true}, the home activity should be moved to the top.
+ * Otherwise, the home activity is hidden and the user is returned to the
+ * app.
+ */
+ void detachNavigationBarFromApp(boolean moveHomeToTop);
+
+ /**
+ * Hand off the ongoing animation of a set of remote targets, to be run by another handler using
+ * the given starting parameters.
+ *
+ * Once the handoff is complete, operations on the old leashes for the given targets as well as
+ * callbacks will become no-ops.
+ *
+ * The number of targets MUST match the number of states, and each state MUST match the target
+ * at the same index.
+ */
+ oneway void handOffAnimation(in RemoteAnimationTarget[] targets,
+ in WindowAnimationState[] states);
+}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationRunner.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationRunner.aidl
new file mode 100644
index 000000000000..8021758bf7c3
--- /dev/null
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentsAnimationRunner.aidl
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.wm.shell.recents;
+
+import android.app.ActivityManager;
+import android.graphics.Rect;
+import android.view.RemoteAnimationTarget;
+import android.window.TaskSnapshot;
+import android.os.Bundle;
+
+import com.android.wm.shell.recents.IRecentsAnimationController;
+
+/**
+ * Interface that is used to callback from window manager to the process that runs a recents
+ * animation to start or cancel it.
+ *
+ * {@hide}
+ */
+oneway interface IRecentsAnimationRunner {
+
+ /**
+ * Called when the system needs to cancel the current animation. This can be due to the
+ * wallpaper not drawing in time, or the handler not finishing the animation within a predefined
+ * amount of time.
+ *
+ * @param taskIds Indicates tasks with cancelling snapshot.
+ * @param taskSnapshots If the snapshots is null, the animation will be cancelled and the leash
+ * will be inactive immediately. Otherwise, the contents of the tasks will
+ * be replaced with {@param taskSnapshots}, such that the runner's leash is
+ * still active. As soon as the runner doesn't need the leash anymore, it
+ * must call {@link IRecentsAnimationController#cleanupScreenshot).
+ *
+ * @see {@link RecentsAnimationController#cleanupScreenshot}
+ */
+ void onAnimationCanceled(in @nullable int[] taskIds,
+ in @nullable TaskSnapshot[] taskSnapshots) = 1;
+
+ /**
+ * Called when the system is ready for the handler to start animating all the visible tasks.
+ *
+ * @param homeContentInsets The current home app content insets
+ * @param minimizedHomeBounds Specifies the bounds of the minimized home app, will be
+ * {@code null} if the device is not currently in split screen
+ */
+ void onAnimationStart(in IRecentsAnimationController controller,
+ in RemoteAnimationTarget[] apps, in RemoteAnimationTarget[] wallpapers,
+ in Rect homeContentInsets, in Rect minimizedHomeBounds, in Bundle extras) = 2;
+
+ /**
+ * Called when the task of an activity that has been started while the recents animation
+ * was running becomes ready for control.
+ */
+ void onTasksAppeared(in RemoteAnimationTarget[] app) = 3;
+}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java
index 9af33a84b045..a6e25a95e1eb 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java
@@ -37,7 +37,6 @@ import android.os.RemoteException;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseIntArray;
-import android.view.IRecentsAnimationRunner;
import android.window.WindowContainerToken;
import androidx.annotation.BinderThread;
@@ -54,6 +53,7 @@ import com.android.wm.shell.common.TaskStackListenerCallback;
import com.android.wm.shell.common.TaskStackListenerImpl;
import com.android.wm.shell.desktopmode.DesktopModeTaskRepository;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
+import com.android.wm.shell.recents.IRecentsAnimationRunner;
import com.android.wm.shell.shared.GroupedRecentTaskInfo;
import com.android.wm.shell.shared.annotations.ExternalThread;
import com.android.wm.shell.shared.annotations.ShellMainThread;
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java
index c90da052dd72..c660000e4f61 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java
@@ -49,8 +49,6 @@ import android.util.IntArray;
import android.util.Pair;
import android.util.Slog;
import android.view.Display;
-import android.view.IRecentsAnimationController;
-import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
import android.window.PictureInPictureSurfaceTransaction;
@@ -1024,10 +1022,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
}
@Override
- public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) {
- }
-
- @Override
public void setFinishTaskTransaction(int taskId,
PictureInPictureSurfaceTransaction finishTransaction, SurfaceControl overlay) {
mExecutor.execute(() -> {
@@ -1254,14 +1248,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
}
@Override
- public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) {
- }
-
- @Override
- public void cleanupScreenshot() {
- }
-
- @Override
public void setWillFinishToHome(boolean willFinishToHome) {
mExecutor.execute(() -> {
mWillFinishToHome = willFinishToHome;
@@ -1269,14 +1255,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
}
/**
- * @see IRecentsAnimationController#removeTask
- */
- @Override
- public boolean removeTask(int taskId) {
- return false;
- }
-
- /**
* @see IRecentsAnimationController#detachNavigationBarFromApp
*/
@Override
@@ -1292,13 +1270,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
}
});
}
-
- /**
- * @see IRecentsAnimationController#animateNavigationBarToApp(long)
- */
- @Override
- public void animateNavigationBarToApp(long duration) {
- }
};
/** Utility class to track the state of a task as-seen by recents. */
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java
index 7c63fdad660a..7937a843b90a 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java
@@ -76,7 +76,6 @@ import android.os.RemoteException;
import android.platform.test.flag.junit.SetFlagsRule;
import android.util.ArraySet;
import android.util.Pair;
-import android.view.IRecentsAnimationRunner;
import android.view.Surface;
import android.view.SurfaceControl;
import android.window.IRemoteTransition;
@@ -107,6 +106,7 @@ import com.android.wm.shell.TestShellExecutor;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.ShellExecutor;
+import com.android.wm.shell.recents.IRecentsAnimationRunner;
import com.android.wm.shell.recents.RecentTasksController;
import com.android.wm.shell.recents.RecentsTransitionHandler;
import com.android.wm.shell.shared.ShellSharedConstants;