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

Commit 5128afe9 authored by Jerry Chang's avatar Jerry Chang Committed by Android (Google) Code Review
Browse files

Merge "Apply new remote animation when reusing existing activities" into tm-qpr-dev

parents 30774919 5b5c6e6f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    /** The most recently given options. */
    private ActivityOptions mPendingOptions;
    /** Non-null if {@link #mPendingOptions} specifies the remote animation. */
    private RemoteAnimationAdapter mPendingRemoteAnimation;
    RemoteAnimationAdapter mPendingRemoteAnimation;
    private RemoteTransition mPendingRemoteTransition;
    ActivityOptions returningOptions; // options that are coming back via convertToTranslucent
    AppTimeTracker appTimeTracker; // set if we are tracking the time in this app/task/activity
+5 −1
Original line number Diff line number Diff line
@@ -2947,10 +2947,14 @@ class ActivityStarter {
            }
        }

        // Update the target's launch cookie to those specified in the options if set
        // Update the target's launch cookie and pending remote animation to those specified in the
        // options if set.
        if (mStartActivity.mLaunchCookie != null) {
            intentActivity.mLaunchCookie = mStartActivity.mLaunchCookie;
        }
        if (mStartActivity.mPendingRemoteAnimation != null) {
            intentActivity.mPendingRemoteAnimation = mStartActivity.mPendingRemoteAnimation;
        }

        // Need to update mTargetRootTask because if task was moved out of it, the original root
        // task may be destroyed.
+1 −1
Original line number Diff line number Diff line
@@ -300,8 +300,8 @@ public class AppTransitionController {
            layoutRedo = appTransition.goodToGo(transit, topOpeningApp);
            handleNonAppWindowsInTransition(transit, flags);
            appTransition.postAnimationCallback();
            appTransition.clear();
        } finally {
            appTransition.clear();
            mService.mSurfaceAnimationRunner.continueStartingAnimations();
        }

+27 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ import android.service.voice.IVoiceInteractionSession;
import android.util.Pair;
import android.util.Size;
import android.view.Gravity;
import android.view.RemoteAnimationAdapter;
import android.window.TaskFragmentOrganizerToken;

import androidx.test.filters.SmallTest;
@@ -1314,6 +1315,32 @@ public class ActivityStarterTests extends WindowTestsBase {
        assertTrue(mRootWindowContainer.topRunningActivity().mLaunchCookie == newCookie);
    }

    @Test
    public void testRemoteAnimation_appliesToExistingTask() {
        final ActivityStarter starter = prepareStarter(0, false);

        // Put an activity on default display as the top focused activity.
        ActivityRecord r = new ActivityBuilder(mAtm).setCreateTask(true).build();
        final Intent intent = new Intent();
        intent.setComponent(ActivityBuilder.getDefaultComponent());
        starter.setReason("testRemoteAnimation_newTask")
                .setIntent(intent)
                .execute();

        assertNull(mRootWindowContainer.topRunningActivity().mPendingRemoteAnimation);

        // Relaunch the activity with remote animation indicated in options.
        final RemoteAnimationAdapter adaptor = mock(RemoteAnimationAdapter.class);
        final ActivityOptions options = ActivityOptions.makeRemoteAnimation(adaptor);
        starter.setReason("testRemoteAnimation_existingTask")
                .setIntent(intent)
                .setActivityOptions(options.toBundle())
                .execute();

        // Verify the remote animation is updated.
        assertEquals(adaptor, mRootWindowContainer.topRunningActivity().mPendingRemoteAnimation);
    }

    @Test
    public void testStartLaunchIntoPipActivity() {
        final ActivityStarter starter = prepareStarter(0, false);