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

Commit fe77fdf8 authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

Merge "If resume occurs, force finish of exiting activity." into nyc-dev

parents 20d51f55 bdc4d8dc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1249,7 +1249,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;
        }
    }