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

Commit 20e1f177 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 am: 1931d6d9 am: 4ca905ac

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



Change-Id: Ifd97df2398c4e3c8ff282359d3ed0f6c95a8793e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2cf3d4bb 4ca905ac
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -765,6 +765,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;
@@ -1573,6 +1579,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