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

Commit 36fb9c92 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Stop mirroring display if display surface is migrated" into main

parents 02deb2e6 418c46ce
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -243,6 +243,19 @@ final class ContentRecorder implements WindowContainerListener {
        }
    }

    /** Called when the surface of display is changed to a different instance. */
    void resetRecordingDisplay(int displayId) {
        if (!isCurrentlyRecording()
                || mContentRecordingSession.getDisplayToRecord() != displayId) {
            return;
        }
        ProtoLog.v(WM_DEBUG_CONTENT_RECORDING,
                "Content Recording: Display %d changed surface so stop recording", displayId);
        mDisplayContent.mWmService.mTransactionFactory.get().remove(mRecordedSurface).apply();
        mRecordedSurface = null;
        // Do not un-set the token, in case new surface is ready and recording should begin again.
    }

    /**
     * Pauses recording on this display content. Note the session does not need to be updated,
     * since recording can be resumed still.
+7 −1
Original line number Diff line number Diff line
@@ -1272,7 +1272,13 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    @Override
    void migrateToNewSurfaceControl(Transaction t) {
        t.remove(mSurfaceControl);

        // Reset the recording displays which were mirroring this display.
        for (int i = mRootWindowContainer.getChildCount() - 1; i >= 0; i--) {
            final ContentRecorder recorder = mRootWindowContainer.getChildAt(i).mContentRecorder;
            if (recorder != null) {
                recorder.resetRecordingDisplay(mDisplayId);
            }
        }
        mLastSurfacePosition.set(0, 0);
        mLastDeltaRotation = Surface.ROTATION_0;