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

Commit 32a0b735 authored by Anthony Hugh's avatar Anthony Hugh Committed by android-build-merger
Browse files

DO NOT MERGE: Properly set FLAG_ACTIVITY_BROUGHT_TO_FRONT for onNewIntent() callback

am: f73d0853

Change-Id: I6d17a74e4030e20b7a08516d0b4ec90e31930c66
parents 04cbf97d f73d0853
Loading
Loading
Loading
Loading
+15 −6
Original line number Original line Diff line number Diff line
@@ -1077,6 +1077,10 @@ class ActivityStarter {
                        top.task.setIntent(mStartActivity);
                        top.task.setIntent(mStartActivity);
                    }
                    }
                    ActivityStack.logStartActivity(AM_NEW_INTENT, mStartActivity, top.task);
                    ActivityStack.logStartActivity(AM_NEW_INTENT, mStartActivity, top.task);

                    if (shouldActivityBeBroughtToFront(mReusedActivity)) {
                        mStartActivity.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
                    }
                    top.deliverNewIntentLocked(mCallingUid, mStartActivity.intent,
                    top.deliverNewIntentLocked(mCallingUid, mStartActivity.intent,
                            mStartActivity.launchedFromPackage);
                            mStartActivity.launchedFromPackage);
                }
                }
@@ -1509,6 +1513,16 @@ class ActivityStarter {
        return intentActivity;
        return intentActivity;
    }
    }


    private boolean shouldActivityBeBroughtToFront(ActivityRecord intentActivity) {
        final ActivityStack focusStack = mSupervisor.getFocusedStack();
        ActivityRecord curTop = (focusStack == null)
            ? null : focusStack.topRunningNonDelayedActivityLocked(mNotTop);

        return curTop != null
            && (curTop.task != intentActivity.task || curTop.task != focusStack.topTask())
            && !mAvoidMoveToFront;
    }

    private ActivityRecord setTargetStackAndMoveToFrontIfNeeded(ActivityRecord intentActivity) {
    private ActivityRecord setTargetStackAndMoveToFrontIfNeeded(ActivityRecord intentActivity) {
        mTargetStack = intentActivity.task.stack;
        mTargetStack = intentActivity.task.stack;
        mTargetStack.mLastPausedActivity = null;
        mTargetStack.mLastPausedActivity = null;
@@ -1517,13 +1531,8 @@ class ActivityStarter {
        // the same behavior as if a new instance was being started, which means not bringing it
        // the same behavior as if a new instance was being started, which means not bringing it
        // to the front if the caller is not itself in the front.
        // to the front if the caller is not itself in the front.
        final ActivityStack focusStack = mSupervisor.getFocusedStack();
        final ActivityStack focusStack = mSupervisor.getFocusedStack();
        ActivityRecord curTop = (focusStack == null)
                ? null : focusStack.topRunningNonDelayedActivityLocked(mNotTop);


        if (curTop != null
        if (shouldActivityBeBroughtToFront(intentActivity)) {
                && (curTop.task != intentActivity.task || curTop.task != focusStack.topTask())
                && !mAvoidMoveToFront) {
            mStartActivity.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
            if (mSourceRecord == null || (mSourceStack.topActivity() != null &&
            if (mSourceRecord == null || (mSourceStack.topActivity() != null &&
                    mSourceStack.topActivity().task == mSourceRecord.task)) {
                    mSourceStack.topActivity().task == mSourceRecord.task)) {
                // We really do want to push this one into the user's face, right now.
                // We really do want to push this one into the user's face, right now.