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

Commit 624688c9 authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Destroy ActivityRecord when it is removed from the hierarchy" into...

Merge "Destroy ActivityRecord when it is removed from the hierarchy" into sc-v2-dev am: 8d0616af am: 510dcd6f

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

Change-Id: Icbf68e3f18c9ec53defabdf3a600cf89e86c0662
parents fd992641 510dcd6f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3687,7 +3687,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    @Override
    void removeImmediately() {
        if (!finishing) {
        if (!isState(DESTROYING, DESTROYED)) {
            // If Task#removeImmediately is called directly with alive activities, ensure that the
            // activities are destroyed and detached from process.
            destroyImmediately("removeImmediately");
+15 −0
Original line number Diff line number Diff line
@@ -1615,6 +1615,21 @@ public class ActivityRecordTests extends WindowTestsBase {
        assertFalse(wpc.hasActivities());
    }

    @Test
    public void testRemoveImmediatelyWithFinishingActivity() throws RemoteException {
        final ActivityRecord activity = createActivityWithTask();
        final WindowProcessController wpc = activity.app;
        activity.makeFinishingLocked();
        assertTrue(activity.finishing);

        activity.getTask().removeImmediately("test");

        verify(mAtm.getLifecycleManager()).scheduleTransaction(any(), eq(activity.appToken),
                isA(DestroyActivityItem.class));
        assertFalse(wpc.hasActivities());
        assertEquals(DESTROYING, activity.getState());
    }

    @Test
    public void testRemoveFromHistory() {
        final ActivityRecord activity = createActivityWithTask();