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

Commit 53845068 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent leak of AppWindowTokens." into oc-dev

parents 094996a2 ed3e83b3
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -178,6 +178,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree


    private boolean mDisbalePreviewScreenshots;
    private boolean mDisbalePreviewScreenshots;


    Task mLastParent;

    AppWindowToken(WindowManagerService service, IApplicationToken token, boolean voiceInteraction,
    AppWindowToken(WindowManagerService service, IApplicationToken token, boolean voiceInteraction,
            DisplayContent dc, long inputDispatchingTimeoutNanos, boolean fullscreen,
            DisplayContent dc, long inputDispatchingTimeoutNanos, boolean fullscreen,
            boolean showForAllUsers, int targetSdk, int orientation, int rotationAnimationHint,
            boolean showForAllUsers, int targetSdk, int orientation, int rotationAnimationHint,
@@ -743,19 +745,21 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    void onParentSet() {
    void onParentSet() {
        super.onParentSet();
        super.onParentSet();


        final Task task = getTask();

        // When the associated task is {@code null}, the {@link AppWindowToken} can no longer
        // When the associated task is {@code null}, the {@link AppWindowToken} can no longer
        // access visual elements like the {@link DisplayContent}. We must remove any associations
        // access visual elements like the {@link DisplayContent}. We must remove any associations
        // such as animations.
        // such as animations.
        if (!mReparenting) {
        if (!mReparenting) {
            final Task task = getTask();
            if (task == null) {
            if (task == null) {
                // It is possible we have been marked as a closing app earlier. We must remove ourselves
                // It is possible we have been marked as a closing app earlier. We must remove ourselves
                // from this list so we do not participate in any future animations.
                // from this list so we do not participate in any future animations.
                mService.mClosingApps.remove(this);
                mService.mClosingApps.remove(this);
            } else if (task.mStack != null) {
            } else if (mLastParent != null && mLastParent.mStack != null) {
                task.mStack.mExitingAppTokens.remove(this);
                task.mStack.mExitingAppTokens.remove(this);
            }
            }
        }
        }
        mLastParent = task;
    }
    }


    void postWindowRemoveStartingWindowCleanup(WindowState win) {
    void postWindowRemoveStartingWindowCleanup(WindowState win) {