Merge "Relax the result-to restriction if activity is finishing" into tm-qpr-dev
This commit is contained in:
@@ -586,7 +586,10 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
||||
}
|
||||
|
||||
// Cannot embed activity across TaskFragments for activity result.
|
||||
if (a.resultTo != null && a.resultTo.getTaskFragment() != this) {
|
||||
// If the activity that started for result is finishing, it's likely that this start mode
|
||||
// is used to place an activity in the same task. Since the finishing activity won't be
|
||||
// able to get the results, so it's OK to embed in a different TaskFragment.
|
||||
if (a.resultTo != null && !a.resultTo.finishing && a.resultTo.getTaskFragment() != this) {
|
||||
return EMBEDDING_DISALLOWED_NEW_TASK_FRAGMENT;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.never;
|
||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
|
||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
|
||||
import static com.android.server.wm.ActivityRecord.State.RESUMED;
|
||||
import static com.android.server.wm.TaskFragment.EMBEDDING_ALLOWED;
|
||||
import static com.android.server.wm.TaskFragment.EMBEDDING_DISALLOWED_MIN_DIMENSION_VIOLATION;
|
||||
import static com.android.server.wm.TaskFragment.EMBEDDING_DISALLOWED_NEW_TASK_FRAGMENT;
|
||||
import static com.android.server.wm.TaskFragment.EMBEDDING_DISALLOWED_UNTRUSTED_HOST;
|
||||
@@ -468,6 +469,10 @@ public class TaskFragmentTest extends WindowTestsBase {
|
||||
newActivity.resultTo = activity;
|
||||
assertEquals(EMBEDDING_DISALLOWED_NEW_TASK_FRAGMENT,
|
||||
newTaskFragment.isAllowedToEmbedActivity(newActivity));
|
||||
|
||||
// Allow embedding if the resultTo activity is finishing.
|
||||
activity.finishing = true;
|
||||
assertEquals(EMBEDDING_ALLOWED, newTaskFragment.isAllowedToEmbedActivity(newActivity));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user