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

Commit 70dd5302 authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Ensure reparent activity TaskFragment is always within the same Task"...

Merge "Ensure reparent activity TaskFragment is always within the same Task" into tm-dev am: 74beca1b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18330765



Change-Id: I6d3656f1242df89863d77e7f19978e46a69c6c66
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d544804c 74beca1b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -734,6 +734,12 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                    sendTaskFragmentOperationFailure(organizer, errorCallbackToken, exception);
                    break;
                }
                if (parent.getTask() != activity.getTask()) {
                    final Throwable exception = new SecurityException("The reparented activity is"
                            + " not in the same Task as the target TaskFragment.");
                    sendTaskFragmentOperationFailure(organizer, errorCallbackToken, exception);
                    break;
                }
                activity.reparent(parent, POSITION_TOP);
                effects |= TRANSACT_EFFECTS_LIFECYCLE;
                break;
@@ -1542,6 +1548,12 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
            sendTaskFragmentOperationFailure(organizer, errorCallbackToken, exception);
            return;
        }
        if (newParentTF.getTask() != oldParent.getTask()) {
            final Throwable exception = new SecurityException(
                    "The new parent is not in the same Task as the old parent.");
            sendTaskFragmentOperationFailure(organizer, errorCallbackToken, exception);
            return;
        }
        while (oldParent.hasChild()) {
            oldParent.getChildAt(0).reparent(newParentTF, POSITION_TOP);
        }
+3 −2
Original line number Diff line number Diff line
@@ -511,11 +511,12 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase {
    @Test
    public void testApplyTransaction_reparentActivityToTaskFragment_triggerLifecycleUpdate()
            throws RemoteException {
        final ActivityRecord activity = createActivityRecord(mDefaultDisplay);
        final Task task = createTask(mDisplayContent);
        final ActivityRecord activity = createActivityRecord(task);
        mOrganizer.applyTransaction(mTransaction);
        mController.registerOrganizer(mIOrganizer);
        mTaskFragment = new TaskFragmentBuilder(mAtm)
                .setCreateParentTask()
                .setParentTask(task)
                .setFragmentToken(mFragmentToken)
                .build();
        mAtm.mWindowOrganizerController.mLaunchTaskFragments