diff options
| author | 2024-01-15 14:32:17 +0000 | |
|---|---|---|
| committer | 2024-03-02 23:04:51 +0000 | |
| commit | 36b6c9dcd8045639e3dbf64bead330146407628c (patch) | |
| tree | 5c0a0883748f1fc53cd2bc09fcfcefd57f79164c | |
| parent | 2ce9e8b0482aa55031f5eef98fa3fbae67f8e188 (diff) | |
Fix capturing mid-transition frames
To stop capturing mid-transition frames, we listen to visibility changes which indicate an incoming transition to/away from the captured task, and toggle the visibility of the recorded surface accordingly. This allows the virtual display to stop sending new frames before a transition starts, so users will simply see a frozen frame from before the transition instead of the exact last frame before the window is no longer visible (which sometimes is a mid-transition frame).
Bug: 314262003
Flag: None
Test: Manual testing
Change-Id: I0a540cfa4c06b6e7cac628781c4b1773f6d6f9aa
| -rw-r--r-- | services/core/java/com/android/server/wm/ContentRecorder.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/ContentRecorder.java b/services/core/java/com/android/server/wm/ContentRecorder.java index 8717098ff8e8..a914c0712319 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 @@ final class ContentRecorder implements WindowContainerListener { 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(); + } } } |