Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +69 −66 Original line number Diff line number Diff line Loading @@ -2991,7 +2991,8 @@ public final class ActivityStackSupervisor implements DisplayListener { } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeStack_" + stackId); mWindowManager.deferSurfaceLayout(); try { ActivityRecord r = stack.topRunningActivityLocked(); mTmpBounds.clear(); Loading Loading @@ -3067,9 +3068,11 @@ public final class ActivityStackSupervisor implements DisplayListener { resumeTopActivitiesLocked(stack, null, null); } } } finally { mWindowManager.continueSurfaceLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); } } void resizeTaskLocked(TaskRecord task, Rect bounds, int resizeMode, boolean preserveWindow) { if (!task.mResizeable) { Loading services/core/java/com/android/server/wm/WindowManagerService.java +21 −1 Original line number Diff line number Diff line Loading @@ -4679,7 +4679,7 @@ public class WindowManagerService extends IWindowManager.Stub throw new IllegalArgumentException("resizeStack: stackId " + stackId + " not found."); } if (stack.setBounds(bounds, configs, taskBounds)) { if (stack.setBounds(bounds, configs, taskBounds) && stack.isVisibleLocked()) { stack.resizeWindows(); stack.getDisplayContent().layoutNeeded = true; mWindowPlacerLocked.performSurfacePlacement(); Loading Loading @@ -4732,6 +4732,26 @@ public class WindowManagerService extends IWindowManager.Stub } } /** * Starts deferring layout passes. Useful when doing multiple changes but to optimize * performance, only one layout pass should be done. This can be called multiple times, and * layouting will be resumed once the last caller has called {@link #continueSurfaceLayout} */ public void deferSurfaceLayout() { synchronized (mWindowMap) { mWindowPlacerLocked.deferLayout(); } } /** * Resumes layout passes after deferring them. See {@link #deferSurfaceLayout()} */ public void continueSurfaceLayout() { synchronized (mWindowMap) { mWindowPlacerLocked.continueLayout(); } } public void getTaskBounds(int taskId, Rect bounds) { synchronized (mWindowMap) { Task task = mTaskIdToTask.get(taskId); Loading services/core/java/com/android/server/wm/WindowSurfacePlacer.java +21 −0 Original line number Diff line number Diff line Loading @@ -112,13 +112,34 @@ class WindowSurfacePlacer { private int mPreferredModeId = 0; private boolean mTraversalScheduled; private int mDeferDepth = 0; public WindowSurfacePlacer(WindowManagerService service) { mService = service; mWallpaperControllerLocked = mService.mWallpaperControllerLocked; } /** * See {@link WindowManagerService#deferSurfaceLayout()} */ void deferLayout() { mDeferDepth++; } /** * See {@link WindowManagerService#continueSurfaceLayout()} */ void continueLayout() { mDeferDepth--; if (mDeferDepth <= 0) { performSurfacePlacement(); } } final void performSurfacePlacement() { if (mDeferDepth > 0) { return; } int loopCount = 6; do { mTraversalScheduled = false; Loading Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +69 −66 Original line number Diff line number Diff line Loading @@ -2991,7 +2991,8 @@ public final class ActivityStackSupervisor implements DisplayListener { } Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeStack_" + stackId); mWindowManager.deferSurfaceLayout(); try { ActivityRecord r = stack.topRunningActivityLocked(); mTmpBounds.clear(); Loading Loading @@ -3067,9 +3068,11 @@ public final class ActivityStackSupervisor implements DisplayListener { resumeTopActivitiesLocked(stack, null, null); } } } finally { mWindowManager.continueSurfaceLayout(); Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER); } } void resizeTaskLocked(TaskRecord task, Rect bounds, int resizeMode, boolean preserveWindow) { if (!task.mResizeable) { Loading
services/core/java/com/android/server/wm/WindowManagerService.java +21 −1 Original line number Diff line number Diff line Loading @@ -4679,7 +4679,7 @@ public class WindowManagerService extends IWindowManager.Stub throw new IllegalArgumentException("resizeStack: stackId " + stackId + " not found."); } if (stack.setBounds(bounds, configs, taskBounds)) { if (stack.setBounds(bounds, configs, taskBounds) && stack.isVisibleLocked()) { stack.resizeWindows(); stack.getDisplayContent().layoutNeeded = true; mWindowPlacerLocked.performSurfacePlacement(); Loading Loading @@ -4732,6 +4732,26 @@ public class WindowManagerService extends IWindowManager.Stub } } /** * Starts deferring layout passes. Useful when doing multiple changes but to optimize * performance, only one layout pass should be done. This can be called multiple times, and * layouting will be resumed once the last caller has called {@link #continueSurfaceLayout} */ public void deferSurfaceLayout() { synchronized (mWindowMap) { mWindowPlacerLocked.deferLayout(); } } /** * Resumes layout passes after deferring them. See {@link #deferSurfaceLayout()} */ public void continueSurfaceLayout() { synchronized (mWindowMap) { mWindowPlacerLocked.continueLayout(); } } public void getTaskBounds(int taskId, Rect bounds) { synchronized (mWindowMap) { Task task = mTaskIdToTask.get(taskId); Loading
services/core/java/com/android/server/wm/WindowSurfacePlacer.java +21 −0 Original line number Diff line number Diff line Loading @@ -112,13 +112,34 @@ class WindowSurfacePlacer { private int mPreferredModeId = 0; private boolean mTraversalScheduled; private int mDeferDepth = 0; public WindowSurfacePlacer(WindowManagerService service) { mService = service; mWallpaperControllerLocked = mService.mWallpaperControllerLocked; } /** * See {@link WindowManagerService#deferSurfaceLayout()} */ void deferLayout() { mDeferDepth++; } /** * See {@link WindowManagerService#continueSurfaceLayout()} */ void continueLayout() { mDeferDepth--; if (mDeferDepth <= 0) { performSurfacePlacement(); } } final void performSurfacePlacement() { if (mDeferDepth > 0) { return; } int loopCount = 6; do { mTraversalScheduled = false; Loading