Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96df8040 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Send TransitionInfo through onTasksAppeared()" into main

parents ca75ea98 c0f5ec2f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -59,11 +59,12 @@ oneway interface IRecentsAnimationRunner {
    void onAnimationStart(in IRecentsAnimationController controller,
            in RemoteAnimationTarget[] apps, in RemoteAnimationTarget[] wallpapers,
            in Rect homeContentInsets, in Rect minimizedHomeBounds, in Bundle extras,
            in TransitionInfo info) = 2;
            in @nullable TransitionInfo info) = 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;
    void onTasksAppeared(in RemoteAnimationTarget[] app,
            in @nullable TransitionInfo transitionInfo) = 3;
}
+6 −3
Original line number Diff line number Diff line
@@ -1214,13 +1214,16 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
            // Since we're accepting the merge, update the finish transaction so that changes via
            // that transaction will be applied on top of those of the merged transitions
            mFinishTransaction = finishT;
            boolean passTransitionInfo = ENABLE_DESKTOP_RECENTS_TRANSITIONS_CORNERS_BUGFIX.isTrue();
            if (!passTransitionInfo) {
                // not using the incoming anim-only surfaces
                info.releaseAnimSurfaces();
            }
            if (appearedTargets != null) {
                try {
                    ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                            "[%d] RecentsController.merge: calling onTasksAppeared", mInstanceId);
                    mListener.onTasksAppeared(appearedTargets);
                    mListener.onTasksAppeared(appearedTargets, passTransitionInfo ? info : null);
                } catch (RemoteException e) {
                    Slog.e(TAG, "Error sending appeared tasks to recents animation", e);
                }
+26 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -291,6 +292,31 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
        assertThat(listener.getState()).isEqualTo(TRANSITION_STATE_NOT_RUNNING);
    }

    @Test
    @EnableFlags(FLAG_ENABLE_DESKTOP_RECENTS_TRANSITIONS_CORNERS_BUGFIX)
    public void testMerge_openingTasks_callsOnTasksAppeared() throws Exception {
        final IRecentsAnimationRunner animationRunner = mock(IRecentsAnimationRunner.class);
        TransitionInfo mergeTransitionInfo = new TransitionInfoBuilder(TRANSIT_OPEN)
                .addChange(TRANSIT_OPEN, new TestRunningTaskInfoBuilder().build())
                .build();
        final IBinder transition = startRecentsTransition(/* synthetic= */ false, animationRunner);
        SurfaceControl.Transaction finishT = mock(SurfaceControl.Transaction.class);
        mRecentsTransitionHandler.startAnimation(
                transition, createTransitionInfo(), new StubTransaction(), new StubTransaction(),
                mock(Transitions.TransitionFinishCallback.class));

        mRecentsTransitionHandler.findController(transition).merge(
                mergeTransitionInfo,
                new StubTransaction(),
                finishT,
                transition,
                mock(Transitions.TransitionFinishCallback.class));
        mMainExecutor.flushAll();

        verify(animationRunner).onTasksAppeared(
                /* appearedTargets= */ any(), eq(mergeTransitionInfo));
    }

    @Test
    @EnableFlags(FLAG_ENABLE_DESKTOP_RECENTS_TRANSITIONS_CORNERS_BUGFIX)
    public void testMergeAndFinish_openingFreeformTasks_setsCornerRadius() {
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.shared.system;

import android.annotation.Nullable;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.RemoteAnimationTarget;
@@ -42,5 +43,5 @@ public interface RecentsAnimationListener {
     * Called when the task of an activity that has been started while the recents animation
     * was running becomes ready for control.
     */
    void onTasksAppeared(RemoteAnimationTarget[] app);
    void onTasksAppeared(RemoteAnimationTarget[] app, @Nullable TransitionInfo transitionInfo);
}