Merge "DO NOT MERGE: Properly set FLAG_ACTIVITY_BROUGHT_TO_FRONT for onNewIntent() callback" into cw-f-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
75bf81458e
@@ -1077,6 +1077,10 @@ class ActivityStarter {
|
||||
top.task.setIntent(mStartActivity);
|
||||
}
|
||||
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,
|
||||
mStartActivity.launchedFromPackage);
|
||||
}
|
||||
@@ -1509,6 +1513,16 @@ class ActivityStarter {
|
||||
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) {
|
||||
mTargetStack = intentActivity.task.stack;
|
||||
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
|
||||
// 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);
|
||||
|
||||
if (curTop != null
|
||||
&& (curTop.task != intentActivity.task || curTop.task != focusStack.topTask())
|
||||
&& !mAvoidMoveToFront) {
|
||||
mStartActivity.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
|
||||
if (shouldActivityBeBroughtToFront(intentActivity)) {
|
||||
if (mSourceRecord == null || (mSourceStack.topActivity() != null &&
|
||||
mSourceStack.topActivity().task == mSourceRecord.task)) {
|
||||
// We really do want to push this one into the user's face, right now.
|
||||
|
||||
Reference in New Issue
Block a user