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

Commit b2ad819f authored by Jerry Chang's avatar Jerry Chang Committed by Automerger Merge Worker
Browse files

Merge "Apply new remote animation when reusing existing activities" into...

Merge "Apply new remote animation when reusing existing activities" into tm-qpr-dev am: 5128afe9 am: d56d94f2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20258947



Change-Id: Ib109a62a71e8630a078f7b6c46483475d4571d25
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 46b104f2 d56d94f2
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
@@ -2643,10 +2643,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
@@ -294,8 +294,8 @@ public class AppTransitionController {
            final int flags = appTransition.getTransitFlags();
            layoutRedo = appTransition.goodToGo(transit, topOpeningApp);
            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;
@@ -1322,6 +1323,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);