Send RESULT_CANCELED immediately if start-activity-for-result across TaskFragments
The same reason we don't support it across Tasks. Bug: 236668365 Test: verified on sample app Change-Id: Iad6633d4e378e3a814af5cb650d4fa942b21c521
This commit is contained in:
@@ -2576,6 +2576,7 @@ class ActivityStarter {
|
||||
mInTask = null;
|
||||
}
|
||||
mInTaskFragment = inTaskFragment;
|
||||
sendNewTaskFragmentResultRequestIfNeeded();
|
||||
|
||||
mStartFlags = startFlags;
|
||||
// If the onlyIfNeeded flag is set, then we can do this if the activity being launched
|
||||
@@ -2618,6 +2619,18 @@ class ActivityStarter {
|
||||
}
|
||||
}
|
||||
|
||||
private void sendNewTaskFragmentResultRequestIfNeeded() {
|
||||
if (mStartActivity.resultTo != null && mInTaskFragment != null
|
||||
&& mInTaskFragment != mStartActivity.resultTo.getTaskFragment()) {
|
||||
Slog.w(TAG,
|
||||
"Activity is launching as a new TaskFragment, so cancelling activity result.");
|
||||
mStartActivity.resultTo.sendResult(INVALID_UID, mStartActivity.resultWho,
|
||||
mStartActivity.requestCode, RESULT_CANCELED,
|
||||
null /* data */, null /* dataGrants */);
|
||||
mStartActivity.resultTo = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void computeLaunchingTaskFlags() {
|
||||
// If the caller is not coming from another activity, but has given us an explicit task into
|
||||
// which they would like us to launch the new activity, then let's see about doing that.
|
||||
|
||||
Reference in New Issue
Block a user