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

Commit eadfad43 authored by wilsonshih's avatar wilsonshih
Browse files

Attemp to fix an NPE while transferStartingWindow.

The NPE scenario may happen when:
Start Task with activity(A), then start anoterh task with activity(B),
so there should be an app transition happen to Open B and Close A,
which will start the exit animation on A.
When Activity(A) receive onAnimationFinished, it will remove all
windows with onExitAnimationDone, thus remove the starting window on A.
So if there is another activity(C) below A and it will set to visible,
there will try to transfer the starting window to C.
We shouldn't allow that from happen because window is in the middle of
remove process.

Bug: 201019560
Test: presubmit
Change-Id: I5880896252ea3207d67753552aefa3f1c9f354b3
parent dfabfc61
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4003,6 +4003,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    private boolean transferStartingWindow(@NonNull ActivityRecord fromActivity) {
        final WindowState tStartingWindow = fromActivity.mStartingWindow;
        if (tStartingWindow != null && fromActivity.mStartingSurface != null) {
            if (tStartingWindow.getParent() == null) {
                // The window has been detached from the parent, so the window cannot be transfer
                // to another activity because it may be in the remove process.
                // Don't need to remove the starting window at this point because that will happen
                // at #postWindowRemoveCleanupLocked
                return false;
            }
            // In this case, the starting icon has already been displayed, so start
            // letting windows get shown immediately without any more transitions.
            if (fromActivity.mVisible) {