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

Commit 66dbb9d5 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

3.3 Introduce a new version of startPendingIntentWithAnimation.

This new API uses RemoteTransition instead of the old
RemoteAnimationAdapter.

Trying to make each of the CLs as small as possible to keep them
digestible and low risk. For the refactor plan see
go/animlib-shell-refactor-plan.

Bug: 397180418
Flag: com.android.systemui.animation_library_shell_migration
Test: atest ActivityTransitionAnimatorTest + manual
Change-Id: I285cc3a6d82e8df585d6d4ed2e1ce069b954b428
parent 2e1609fe
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -543,6 +543,27 @@ constructor(
        }
    }

    /**
     * Same as [startIntentWithAnimation] but allows [intentStarter] to throw a
     * [PendingIntent.CanceledException] which must then be handled by the caller. This is useful
     * for Java caller starting a [PendingIntent].
     */
    @Throws(PendingIntent.CanceledException::class)
    @JvmOverloads
    fun startPendingIntentWithAnimation(
        controller: Controller?,
        scope: CoroutineScope,
        animate: Boolean = true,
        animateReturn: Boolean = false,
        showOverLockscreen: Boolean = false,
        intentStarter: PendingIntentStarter,
    ) {
        assertShellMigration()
        startIntentWithAnimation(controller, scope, animate, animateReturn, showOverLockscreen) {
            intentStarter.startPendingIntent(it)
        }
    }

    /**
     * Same as [startIntentWithAnimation] but allows [intentStarter] to throw a
     * [PendingIntent.CanceledException] which must then be handled by the caller. This is useful
@@ -558,7 +579,7 @@ constructor(
        animate: Boolean = true,
        packageName: String? = null,
        showOverLockscreen: Boolean = false,
        intentStarter: PendingIntentStarter,
        intentStarter: LegacyPendingIntentStarter,
    ) {
        startIntentWithAnimation(controller, animate, packageName, showOverLockscreen) {
            intentStarter.startPendingIntent(it)
@@ -792,6 +813,12 @@ constructor(
    }

    interface PendingIntentStarter {
        /** Start a pending intent using the provided [transition] and return the launch result. */
        @Throws(PendingIntent.CanceledException::class)
        fun startPendingIntent(transition: RemoteTransition?): Int
    }

    interface LegacyPendingIntentStarter {
        /**
         * Start a pending intent using the provided [animationAdapter] and return the launch
         * result.
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ constructor(
                    animate,
                    intent.creatorPackage,
                    actuallyShowOverLockscreen,
                    object : ActivityTransitionAnimator.PendingIntentStarter {
                    object : ActivityTransitionAnimator.LegacyPendingIntentStarter {
                        override fun startPendingIntent(
                            animationAdapter: RemoteAnimationAdapter?
                        ): Int {
+1 −1
Original line number Diff line number Diff line
@@ -340,7 +340,7 @@ constructor(
                    animate,
                    intent.creatorPackage,
                    actuallyShowOverLockscreen,
                    object : ActivityTransitionAnimator.PendingIntentStarter {
                    object : ActivityTransitionAnimator.LegacyPendingIntentStarter {
                        override fun startPendingIntent(
                            animationAdapter: RemoteAnimationAdapter?
                        ): Int {