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

Commit bdc4d8dc authored by George Mount's avatar George Mount
Browse files

If resume occurs, force finish of exiting activity.

Bug 27231404
Bug 27274246

Change-Id: Ia92fe6fdebced3e5a1fc9d165212ac1196f395bd
parent 52ff2b77
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1246,7 +1246,7 @@ public class Activity extends ContextThemeWrapper
    protected void onResume() {
        if (DEBUG_LIFECYCLE) Slog.v(TAG, "onResume " + this);
        getApplication().dispatchActivityResumed(this);
        mActivityTransitionState.onResume();
        mActivityTransitionState.onResume(this, isTopOfTask());
        mCalled = true;
    }

+21 −3
Original line number Diff line number Diff line
@@ -236,10 +236,28 @@ class ActivityTransitionState {
        }
    }

    public void onResume() {
    public void onResume(Activity activity, boolean isTopOfTask) {
        // After orientation change, the onResume can come in before the top Activity has
        // left, so if the Activity is not top, wait a second for the top Activity to exit.
        if (mCalledExitCoordinator == null) {
            return; // This is the called activity
        }
        if (isTopOfTask || mEnterTransitionCoordinator == null) {
            restoreExitedViews();
            restoreReenteringViews();
        } else {
            activity.mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (mEnterTransitionCoordinator == null ||
                            mEnterTransitionCoordinator.isWaitingForRemoteExit()) {
                        restoreExitedViews();
                        restoreReenteringViews();
                    }
                }
            }, 1000);
        }
    }

    public void clear() {
        mEnteringNames = null;
+8 −0
Original line number Diff line number Diff line
@@ -244,6 +244,10 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
        }
    }

    public boolean isWaitingForRemoteExit() {
        return mIsReturning && mResultReceiver != null;
    }

    /**
     * This is called onResume. If an Activity is resuming and the transitions
     * haven't started yet, force the views to appear. This is likely to be
@@ -288,6 +292,10 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
            cancelPendingTransitions();
        }
        mAreViewsReady = true;
        if (mResultReceiver != null) {
            mResultReceiver.send(MSG_CANCEL, null);
            mResultReceiver = null;
        }
    }

    private void cancel() {
+4 −0
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
                mExitSharedElementBundle = resultData;
                sharedElementExitBack();
                break;
            case MSG_CANCEL:
                mIsCanceled = true;
                finish();
                break;
        }
    }