summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2024-10-24 16:09:11 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-10-24 16:09:11 +0000
commit0935d9993a1b5027b1bcc69248382495c3bdaa48 (patch)
tree95c4d546237b7376f573e063e55355dc7655a204
parent43ffc5cdf1ac26685060dabf3c56e6f5eb1ac77c (diff)
parent94a6b2240ca299c14ad60fe96691a93bf6631e8b (diff)
Merge "Pipe finish callback through synthetic recents path" into main
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java19
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/recents/RecentsTransitionHandlerTest.java10
2 files changed, 22 insertions, 7 deletions
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 f7ed1dd4606b..6d4d4b410be8 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
@@ -585,7 +585,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
- "[%d] RecentsController.cancelSyntheticTransition reason=%s",
+ "[%d] RecentsController.cancelSyntheticTransition: reason=%s",
mInstanceId, reason);
try {
// TODO(b/366021931): Notify the correct tasks once we build actual targets, and
@@ -602,13 +602,24 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
* Called when a synthetic transition is finished.
* @return
*/
- boolean finishSyntheticTransition() {
+ boolean finishSyntheticTransition(IResultReceiver runnerFinishCb, String reason) {
if (!isSyntheticTransition()) {
return false;
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
- "[%d] RecentsController.finishSyntheticTransition", mInstanceId);
+ "[%d] RecentsController.finishSyntheticTransition: reason=%s", mInstanceId,
+ reason);
+ if (runnerFinishCb != null) {
+ try {
+ ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
+ "[%d] RecentsController.finishInner: calling finish callback",
+ mInstanceId);
+ runnerFinishCb.send(0, null);
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to report transition finished", e);
+ }
+ }
// TODO(b/366021931): Clean up leashes accordingly
cleanUp();
return true;
@@ -1230,7 +1241,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
private void finishInner(boolean toHome, boolean sendUserLeaveHint,
IResultReceiver runnerFinishCb, String reason) {
- if (finishSyntheticTransition()) {
+ if (finishSyntheticTransition(runnerFinishCb, reason)) {
return;
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/recents/RecentsTransitionHandlerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/recents/RecentsTransitionHandlerTest.java
index 0effc3e3d6b8..6087763b4978 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/recents/RecentsTransitionHandlerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/recents/RecentsTransitionHandlerTest.java
@@ -20,6 +20,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSess
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -43,6 +44,7 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.dx.mockito.inline.extended.ExtendedMockito;
import com.android.dx.mockito.inline.extended.StaticMockitoSession;
+import com.android.internal.os.IResultReceiver;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.ShellTestCase;
import com.android.wm.shell.TestShellExecutor;
@@ -141,8 +143,9 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
}
@Test
- public void testStartSyntheticRecentsTransition_callsOnAnimationStart() throws Exception {
+ public void testStartSyntheticRecentsTransition_callsOnAnimationStartAndFinishCallback() throws Exception {
final IRecentsAnimationRunner runner = mock(IRecentsAnimationRunner.class);
+ final IResultReceiver finishCallback = mock(IResultReceiver.class);
doReturn(new Binder()).when(runner).asBinder();
Bundle options = new Bundle();
options.putBoolean("is_synthetic_recents_transition", true);
@@ -151,10 +154,11 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
runner);
verify(runner).onAnimationStart(any(), any(), any(), any(), any(), any());
- // Finish and verify no transition remains
+ // Finish and verify no transition remains and that the provided finish callback is called
mRecentsTransitionHandler.findController(transition).finish(true /* toHome */,
- false /* sendUserLeaveHint */, null /* finishCb */);
+ false /* sendUserLeaveHint */, finishCallback);
mMainExecutor.flushAll();
+ verify(finishCallback).send(anyInt(), any());
assertNull(mRecentsTransitionHandler.findController(transition));
}