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

Commit 45dc5fd6 authored by Massimo Carli's avatar Massimo Carli
Browse files

Fix NPE on TaskFragment

We need to deregister the WindowContainerListener at an
earlier stage to avoid a translucent activity to have a
reference to an opaque one without a parent TaskFragment
which causes getTaskFragment() to return null.

Fixes: 278899220
Test: atest WmTests:SizeCompatTests

Change-Id: I06bef5f386cffdc7e89e7e39bd33b1eb3c0ff6b8
parent 4af5694e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -4281,6 +4281,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        mTaskSupervisor.getActivityMetricsLogger().notifyActivityRemoved(this);
        mTaskSupervisor.mStoppingActivities.remove(this);
        mLetterboxUiController.destroy();
        waitingToShow = false;

        // Defer removal of this activity when either a child is animating, or app transition is on
@@ -4350,8 +4351,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            mWmService.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL, true /*updateInputWindows*/);
        }

        mLetterboxUiController.destroy();

        if (!delayed) {
            updateReportedVisibilityLocked();
        }
+0 −1
Original line number Diff line number Diff line
@@ -406,7 +406,6 @@ public class SizeCompatTests extends WindowTestsBase {
        clearInvocations(translucentActivity.mLetterboxUiController);

        // We destroy the first opaque activity
        mActivity.setState(DESTROYED, "testing");
        mActivity.removeImmediately();

        // Check that updateInheritedLetterbox() is invoked again