Loading services/core/java/com/android/server/wm/WindowState.java +24 −25 Original line number Diff line number Diff line Loading @@ -770,7 +770,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP static final int BLAST_TIMEOUT_DURATION = 5000; /* milliseconds */ class DrawHandler { static class DrawHandler { final Consumer<SurfaceControl.Transaction> mConsumer; final int mSeqId; Loading @@ -779,7 +779,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mConsumer = consumer; } } private final List<DrawHandler> mDrawHandlers = new ArrayList<>(); private final ArrayList<DrawHandler> mDrawHandlers = new ArrayList<>(); /** * Indicates whether inset animations are currently running within the Window. Loading Loading @@ -3290,12 +3290,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP boolean destroySurface(boolean cleanupOnResume, boolean appStopped) { boolean destroyedSomething = false; if (!mChildren.isEmpty()) { // Copying to a different list as multiple children can be removed. final ArrayList<WindowState> childWindows = new ArrayList<>(mChildren); for (int i = childWindows.size() - 1; i >= 0; --i) { final WindowState c = childWindows.get(i); destroyedSomething |= c.destroySurface(cleanupOnResume, appStopped); } } if (!(appStopped || mWindowRemovalAllowed || cleanupOnResume)) { return destroyedSomething; Loading Loading @@ -6024,41 +6026,38 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP /** * Drain the draw handlers, called from finishDrawing() * See {@link WindowState#mPendingDrawHandlers} */ boolean executeDrawHandlers(SurfaceControl.Transaction t, int seqId) { boolean hadHandlers = false; private boolean executeDrawHandlers(@Nullable SurfaceControl.Transaction t, int seqId) { final int numDrawHandlers = mDrawHandlers.size(); if (numDrawHandlers == 0) { return false; } boolean applyHere = false; if (t == null) { t = mTmpTransaction; applyHere = true; } final List<DrawHandler> handlersToRemove = new ArrayList<>(); // Iterate forwards to ensure we process in the same order // we added. for (int i = 0; i < mDrawHandlers.size(); i++) { final ArrayList<DrawHandler> consumedHandlers = new ArrayList<>(); // Iterate in the order the handlers were added. for (int i = 0; i < numDrawHandlers; i++) { final DrawHandler h = mDrawHandlers.get(i); if (h.mSeqId <= seqId) { h.mConsumer.accept(t); handlersToRemove.add(h); hadHandlers = true; consumedHandlers.add(h); } } for (int i = 0; i < handlersToRemove.size(); i++) { final DrawHandler h = handlersToRemove.get(i); mDrawHandlers.remove(h); if (consumedHandlers.isEmpty()) { return false; } if (hadHandlers) { mDrawHandlers.removeAll(consumedHandlers); mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this); } if (applyHere) { t.apply(); } return hadHandlers; return true; } /** Loading Loading
services/core/java/com/android/server/wm/WindowState.java +24 −25 Original line number Diff line number Diff line Loading @@ -770,7 +770,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP static final int BLAST_TIMEOUT_DURATION = 5000; /* milliseconds */ class DrawHandler { static class DrawHandler { final Consumer<SurfaceControl.Transaction> mConsumer; final int mSeqId; Loading @@ -779,7 +779,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mConsumer = consumer; } } private final List<DrawHandler> mDrawHandlers = new ArrayList<>(); private final ArrayList<DrawHandler> mDrawHandlers = new ArrayList<>(); /** * Indicates whether inset animations are currently running within the Window. Loading Loading @@ -3290,12 +3290,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP boolean destroySurface(boolean cleanupOnResume, boolean appStopped) { boolean destroyedSomething = false; if (!mChildren.isEmpty()) { // Copying to a different list as multiple children can be removed. final ArrayList<WindowState> childWindows = new ArrayList<>(mChildren); for (int i = childWindows.size() - 1; i >= 0; --i) { final WindowState c = childWindows.get(i); destroyedSomething |= c.destroySurface(cleanupOnResume, appStopped); } } if (!(appStopped || mWindowRemovalAllowed || cleanupOnResume)) { return destroyedSomething; Loading Loading @@ -6024,41 +6026,38 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP /** * Drain the draw handlers, called from finishDrawing() * See {@link WindowState#mPendingDrawHandlers} */ boolean executeDrawHandlers(SurfaceControl.Transaction t, int seqId) { boolean hadHandlers = false; private boolean executeDrawHandlers(@Nullable SurfaceControl.Transaction t, int seqId) { final int numDrawHandlers = mDrawHandlers.size(); if (numDrawHandlers == 0) { return false; } boolean applyHere = false; if (t == null) { t = mTmpTransaction; applyHere = true; } final List<DrawHandler> handlersToRemove = new ArrayList<>(); // Iterate forwards to ensure we process in the same order // we added. for (int i = 0; i < mDrawHandlers.size(); i++) { final ArrayList<DrawHandler> consumedHandlers = new ArrayList<>(); // Iterate in the order the handlers were added. for (int i = 0; i < numDrawHandlers; i++) { final DrawHandler h = mDrawHandlers.get(i); if (h.mSeqId <= seqId) { h.mConsumer.accept(t); handlersToRemove.add(h); hadHandlers = true; consumedHandlers.add(h); } } for (int i = 0; i < handlersToRemove.size(); i++) { final DrawHandler h = handlersToRemove.get(i); mDrawHandlers.remove(h); if (consumedHandlers.isEmpty()) { return false; } if (hadHandlers) { mDrawHandlers.removeAll(consumedHandlers); mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this); } if (applyHere) { t.apply(); } return hadHandlers; return true; } /** Loading