Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36b6c9dc authored by dakinola's avatar dakinola
Browse files

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
parent 2ce9e8b0
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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();
            }
        }
    }