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

Commit 660c79a3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE: Properly set FLAG_ACTIVITY_BROUGHT_TO_FRONT for...

Merge "DO NOT MERGE: Properly set FLAG_ACTIVITY_BROUGHT_TO_FRONT for onNewIntent() callback" into oc-wear-dev
parents 823b0023 8c5c7cc2
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -1128,6 +1128,9 @@ class ActivityStarter {
                        top.getTask().setIntent(mStartActivity);
                    }
                    ActivityStack.logStartActivity(AM_NEW_INTENT, mStartActivity, top.getTask());
                    if (shouldActivityBeBroughtToFront(reusedActivity)) {
                        mStartActivity.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
                    }
                    top.deliverNewIntentLocked(mCallingUid, mStartActivity.intent,
                            mStartActivity.launchedFromPackage);
                }
@@ -1599,6 +1602,16 @@ class ActivityStarter {
        return DEFAULT_DISPLAY;
    }

    private boolean shouldActivityBeBroughtToFront(ActivityRecord intentActivity) {
        final ActivityStack focusStack = mSupervisor.getFocusedStack();
        ActivityRecord curTop = (focusStack == null)
                ? null : focusStack.topRunningNonDelayedActivityLocked(mNotTop);
        final TaskRecord topTask = curTop != null ? curTop.getTask() : null;
        return topTask != null
                && (topTask != intentActivity.getTask() || topTask != focusStack.topTask())
                && !mAvoidMoveToFront;
    }

    /**
     * Figure out which task and activity to bring to front when we have found an existing matching
     * activity record in history. May also clear the task if needed.
@@ -1613,14 +1626,8 @@ class ActivityStarter {
        // 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.
        final ActivityStack focusStack = mSupervisor.getFocusedStack();
        ActivityRecord curTop = (focusStack == null)
                ? null : focusStack.topRunningNonDelayedActivityLocked(mNotTop);

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