Loading services/core/java/com/android/server/wm/WindowManagerService.java +31 −28 Original line number Diff line number Diff line Loading @@ -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)); Loading @@ -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 Loading Loading
services/core/java/com/android/server/wm/WindowManagerService.java +31 −28 Original line number Diff line number Diff line Loading @@ -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)); Loading @@ -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 Loading