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

Commit ed3db6d4 authored by Josh Yang's avatar Josh Yang
Browse files

Bug fix in OriginTransitionSession.

1. Pass transaction token only if the intent is actually launched.
2. Catch security exception when launching intent.

Flag: EXEMPTED - trivial change
Bug: 411097296
Test: atest PlatformAnimationLibCoreTests
Test: manual test
Change-Id: I6dd2e9c6b36c6529c52fdf0aa813974e6177d900
parent 5f64c533
Loading
Loading
Loading
Loading
+29 −14
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ public class OriginTransitionSession {
            throw new IllegalArgumentException(
                    "Entry transition must be supplied if you want to play an exit transition!");
        }

    }

    /**
@@ -97,8 +96,6 @@ public class OriginTransitionSession {
            return false;
        }

        setupTransactionQueues();

        RemoteTransition remoteTransition = null;
        if (hasEntryTransition() && hasExitTransition()) {
            logD("start: starting with entry and exit transition.");
@@ -108,25 +105,43 @@ public class OriginTransitionSession {
                                mOriginTransitions.makeOriginTransition(
                                        new RemoteTransition(mEntryTransition, mName + "-entry"),
                                        new RemoteTransition(mExitTransition, mName + "-exit"));
            } catch (RemoteException e) {
            } catch (Exception e) {
                logE("Unable to create origin transition!", e);
            }
        } else if (hasEntryTransition()) {
        }
        if (remoteTransition == null && hasEntryTransition()) {
            // If we failed to create a full origin transition (entry + exit), fallback to use the
            // entry transition only.
            logD("start: starting with entry transition.");
            remoteTransition = new RemoteTransition(mEntryTransition, mName + "-entry");
        }

        } else {
        if (remoteTransition == null) {
            // If both entry and exit transitions are not provided, we will fallback to start the
            // activity without transition.
            logD("start: starting without transition.");
        }

        try {
            if (mIntentStarter.test(remoteTransition)) {
                logD("start: intent launched!");
                if (remoteTransition != null) {
                    // If the intent is successfully launched with a remote transition, setup the
                    // transaction queues for the entry and exit transitions.
                    setupTransactionQueues();
                }
                return true;
            } else {
                // Animation is cancelled by intent starter.
                logD("start: cancelled by intent starter!");
            }
        } catch (Exception e) {
            logE("Unable to launch intent!", e);
        }
        // Cancel the session since the intent was not launched.
        cancel();
        return false;
    }
    }

    /**
     * Cancel the current transition and the registered exit transition if it exists. After this
@@ -167,7 +182,7 @@ public class OriginTransitionSession {
        final IBinder shellApplyToken;
        try {
            shellApplyToken = mOriginTransitions.getDefaultTransactionApplyToken();
        } catch (RemoteException e) {
        } catch (Exception e) {
            Log.e(TAG, "Error getting server side (shell) apply token", e);
            return;
        }