Merge "Fix capturing mid-transition frames" into main
diff --git a/services/core/java/com/android/server/wm/ContentRecorder.java b/services/core/java/com/android/server/wm/ContentRecorder.java
index 8717098..a914c07 100644
--- a/services/core/java/com/android/server/wm/ContentRecorder.java
+++ b/services/core/java/com/android/server/wm/ContentRecorder.java
@@ -650,6 +650,14 @@
if (isCurrentlyRecording() && mLastRecordedBounds != null) {
mMediaProjectionManager.notifyActiveProjectionCapturedContentVisibilityChanged(
isVisibleRequested);
+
+ if (mContentRecordingSession.getContentToRecord() == RECORD_CONTENT_TASK) {
+ // If capturing a task, then the toggle visibility of the recorded surface to match
+ // visibility of the task, so we don't capture any mid-transition frames
+ mRecordedWindowContainer.getSyncTransaction()
+ .setVisibility(mRecordedSurface, isVisibleRequested);
+ mRecordedWindowContainer.scheduleAnimation();
+ }
}
}