Loading services/core/java/com/android/server/wm/TaskSnapshotController.java +22 −1 Original line number Diff line number Diff line Loading @@ -223,6 +223,27 @@ class TaskSnapshotController { return null; } if (top.hasCommittedReparentToAnimationLeash()) { if (DEBUG_SCREENSHOT) { Slog.w(TAG_WM, "Failed to take screenshot. App is animating " + top); } return null; } final boolean hasVisibleChild = top.forAllWindows( // Ensure at least one window for the top app is visible before attempting to take // a screenshot. Visible here means that the WSA surface is shown and has an alpha // greater than 0. ws -> ws.mWinAnimator != null && ws.mWinAnimator.getShown() && ws.mWinAnimator.mLastAlpha > 0f, true); if (!hasVisibleChild) { if (DEBUG_SCREENSHOT) { Slog.w(TAG_WM, "Failed to take screenshot. No visible windows for " + task); } return null; } final boolean isLowRamDevice = ActivityManager.isLowRamDeviceStatic(); final float scaleFraction = isLowRamDevice ? REDUCED_SCALE : 1f; task.getBounds(mTmpRect); Loading @@ -233,7 +254,7 @@ class TaskSnapshotController { if (buffer == null || buffer.getWidth() <= 1 || buffer.getHeight() <= 1) { if (DEBUG_SCREENSHOT) { Slog.w(TAG_WM, "Failed to take screenshot"); Slog.w(TAG_WM, "Failed to take screenshot for " + task); } return null; } Loading services/core/java/com/android/server/wm/WindowContainer.java +18 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< /** Total number of elements in this subtree, including our own hierarchy element. */ private int mTreeWeight = 1; /** * Indicates whether we are animating and have committed the transaction to reparent our * surface to the animation leash */ private boolean mCommittedReparentToAnimationLeash; WindowContainer(WindowManagerService service) { mService = service; mPendingTransaction = service.mTransactionFactory.make(); Loading Loading @@ -1025,11 +1031,23 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< */ void prepareSurfaces() { SurfaceControl.mergeToGlobalTransaction(getPendingTransaction()); // If a leash has been set when the transaction was committed, then the leash reparent has // been committed. mCommittedReparentToAnimationLeash = mSurfaceAnimator.hasLeash(); for (int i = 0; i < mChildren.size(); i++) { mChildren.get(i).prepareSurfaces(); } } /** * @return true if the reparent to animation leash transaction has been committed, false * otherwise. */ boolean hasCommittedReparentToAnimationLeash() { return mCommittedReparentToAnimationLeash; } /** * Trigger a call to prepareSurfaces from the animation thread, such that * mPendingTransaction will be applied. Loading Loading
services/core/java/com/android/server/wm/TaskSnapshotController.java +22 −1 Original line number Diff line number Diff line Loading @@ -223,6 +223,27 @@ class TaskSnapshotController { return null; } if (top.hasCommittedReparentToAnimationLeash()) { if (DEBUG_SCREENSHOT) { Slog.w(TAG_WM, "Failed to take screenshot. App is animating " + top); } return null; } final boolean hasVisibleChild = top.forAllWindows( // Ensure at least one window for the top app is visible before attempting to take // a screenshot. Visible here means that the WSA surface is shown and has an alpha // greater than 0. ws -> ws.mWinAnimator != null && ws.mWinAnimator.getShown() && ws.mWinAnimator.mLastAlpha > 0f, true); if (!hasVisibleChild) { if (DEBUG_SCREENSHOT) { Slog.w(TAG_WM, "Failed to take screenshot. No visible windows for " + task); } return null; } final boolean isLowRamDevice = ActivityManager.isLowRamDeviceStatic(); final float scaleFraction = isLowRamDevice ? REDUCED_SCALE : 1f; task.getBounds(mTmpRect); Loading @@ -233,7 +254,7 @@ class TaskSnapshotController { if (buffer == null || buffer.getWidth() <= 1 || buffer.getHeight() <= 1) { if (DEBUG_SCREENSHOT) { Slog.w(TAG_WM, "Failed to take screenshot"); Slog.w(TAG_WM, "Failed to take screenshot for " + task); } return null; } Loading
services/core/java/com/android/server/wm/WindowContainer.java +18 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< /** Total number of elements in this subtree, including our own hierarchy element. */ private int mTreeWeight = 1; /** * Indicates whether we are animating and have committed the transaction to reparent our * surface to the animation leash */ private boolean mCommittedReparentToAnimationLeash; WindowContainer(WindowManagerService service) { mService = service; mPendingTransaction = service.mTransactionFactory.make(); Loading Loading @@ -1025,11 +1031,23 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< */ void prepareSurfaces() { SurfaceControl.mergeToGlobalTransaction(getPendingTransaction()); // If a leash has been set when the transaction was committed, then the leash reparent has // been committed. mCommittedReparentToAnimationLeash = mSurfaceAnimator.hasLeash(); for (int i = 0; i < mChildren.size(); i++) { mChildren.get(i).prepareSurfaces(); } } /** * @return true if the reparent to animation leash transaction has been committed, false * otherwise. */ boolean hasCommittedReparentToAnimationLeash() { return mCommittedReparentToAnimationLeash; } /** * Trigger a call to prepareSurfaces from the animation thread, such that * mPendingTransaction will be applied. Loading