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

Commit 2bb1d264 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Fix issues with duplicate starting window add requests" into pi-dev

parents bf4d482c d8665f23
Loading
Loading
Loading
Loading
+65 −53
Original line number Diff line number Diff line
@@ -113,7 +113,10 @@ public class AppWindowContainerController
        mListener.onWindowsGone();
    };

    private final Runnable mAddStartingWindow = () -> {
    private final Runnable mAddStartingWindow = new Runnable() {

        @Override
        public void run() {
            final StartingData startingData;
            final AppWindowToken container;

@@ -123,19 +126,25 @@ public class AppWindowContainerController
                            + " add starting window");
                    return;
                }

                // There can only be one adding request, silly caller!
                mService.mAnimationHandler.removeCallbacks(this);

                startingData = mContainer.startingData;
                container = mContainer;
            }

            if (startingData == null) {
                // Animation has been canceled... do nothing.
            if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "startingData was nulled out before handling"
                if (DEBUG_STARTING_WINDOW)
                    Slog.v(TAG_WM, "startingData was nulled out before handling"
                            + " mAddStartingWindow: " + mContainer);
                return;
            }

            if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Add starting "
                + this + ": startingData=" + container.startingData);
                    + AppWindowContainerController.this + ": startingData="
                    + container.startingData);

            StartingSurface surface = null;
            try {
@@ -171,6 +180,7 @@ public class AppWindowContainerController
            } else if (DEBUG_STARTING_WINDOW) {
                Slog.v(TAG_WM, "Surface returned was null: " + mContainer);
            }
        }
    };

    public AppWindowContainerController(TaskWindowContainerController taskController,
@@ -558,9 +568,11 @@ public class AppWindowContainerController
        // Note: we really want to do sendMessageAtFrontOfQueue() because we
        // want to process the message ASAP, before any other queued
        // messages.
        if (!mService.mAnimationHandler.hasCallbacks(mAddStartingWindow)) {
            if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Enqueueing ADD_STARTING");
            mService.mAnimationHandler.postAtFrontOfQueue(mAddStartingWindow);
        }
    }

    private boolean createSnapshot(TaskSnapshot snapshot) {
        if (snapshot == null) {
+4 −0
Original line number Diff line number Diff line
@@ -1243,6 +1243,10 @@ public class WindowManagerService extends IWindowManager.Stub
                    Slog.w(TAG_WM, "Attempted to add window with exiting application token "
                          + token + ".  Aborting.");
                    return WindowManagerGlobal.ADD_APP_EXITING;
                } else if (type == TYPE_APPLICATION_STARTING && atoken.startingWindow != null) {
                    Slog.w(TAG_WM, "Attempted to add starting window to token with already existing"
                            + " starting window");
                    return WindowManagerGlobal.ADD_DUPLICATE_ADD;
                }
            } else if (rootType == TYPE_INPUT_METHOD) {
                if (token.windowType != TYPE_INPUT_METHOD) {