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

Commit 31317e8c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[BugFix]Fixed a fatal exception which cause IndexOutOfBoundsException." into main

parents 8cb72b51 73a8d0df
Loading
Loading
Loading
Loading
+31 −28
Original line number Diff line number Diff line
@@ -8010,26 +8010,33 @@ public class WindowManagerService extends IWindowManager.Stub
        @Override
        public void waitForAllWindowsDrawn(Message message, long timeout, int displayId) {
            Objects.requireNonNull(message.getTarget());
            boolean allWindowsDrawn = false;
            synchronized (mGlobalLock) {
                allWindowsDrawn = waitForAllWindowsDrawnLocked(message, timeout, displayId);
            }
            if (allWindowsDrawn) {
                message.sendToTarget();
            }
        }

        /** Return {@code true} if all windows have been drawn. */
        private boolean waitForAllWindowsDrawnLocked(Message message, long timeout, int displayId) {
            final WindowContainer<?> container = displayId == INVALID_DISPLAY
                    ? mRoot : mRoot.getDisplayContent(displayId);
            if (container == null) {
                // The waiting container doesn't exist, no need to wait to run the callback. Run and
                // return;
                message.sendToTarget();
                return;
                // The waiting container doesn't exist, no need to wait. Treat as drawn.
                return true;
            }
            boolean allWindowsDrawn = false;
            synchronized (mGlobalLock) {
            if (mRoot.getDefaultDisplay().mDisplayUpdater.waitForTransition(message)) {
                // Use the ready-to-play of transition as the signal.
                    return;
                return false;
            }
            container.waitForAllWindowsDrawn();
            mWindowPlacerLocked.requestTraversal();
            mH.removeMessages(H.WAITING_FOR_DRAWN_TIMEOUT, container);
            if (container.mWaitingForDrawn.isEmpty()) {
                    allWindowsDrawn = true;
                } else {
                return true;
            }
            if (Trace.isTagEnabled(TRACE_TAG_WINDOW_MANAGER)) {
                for (int i = 0; i < container.mWaitingForDrawn.size(); i++) {
                    traceStartWaitingForWindowDrawn(container.mWaitingForDrawn.get(i));
@@ -8039,11 +8046,7 @@ public class WindowManagerService extends IWindowManager.Stub
            mWaitingForDrawnCallbacks.put(container, message);
            mH.sendNewMessageDelayed(H.WAITING_FOR_DRAWN_TIMEOUT, container, timeout);
            checkDrawnWindowsLocked();
                }
            }
            if (allWindowsDrawn) {
                message.sendToTarget();
            }
            return false;
        }

        @Override