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

Commit ebc88082 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "ContentRecorder: fix NPE problem to avoid crash when start recording."...

Merge "ContentRecorder: fix NPE problem to avoid crash when start recording." into main am: 978dbf9c am: 736901f0

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3418419



Change-Id: I81a9dbdee4301432694be2ed6a1b89c5f57adfd2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c911c8dd 736901f0
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -368,6 +368,15 @@ final class ContentRecorder implements WindowContainerListener {
            return;
        }

        final SurfaceControl sourceSurface = mRecordedWindowContainer.getSurfaceControl();
        if (sourceSurface == null || !sourceSurface.isValid()) {
            ProtoLog.v(WM_DEBUG_CONTENT_RECORDING,
                    "Content Recording: Unable to start recording for display %d since the "
                            + "surface is null or have been released.",
                    mDisplayContent.getDisplayId());
            return;
        }

        final int contentToRecord = mContentRecordingSession.getContentToRecord();

        // TODO(b/297514518) Do not start capture if the app is in PIP, the bounds are inaccurate.
@@ -395,8 +404,7 @@ final class ContentRecorder implements WindowContainerListener {
                mDisplayContent.getDisplayId(), mDisplayContent.getDisplayInfo().state);

        // Create a mirrored hierarchy for the SurfaceControl of the DisplayArea to capture.
        mRecordedSurface = SurfaceControl.mirrorSurface(
                mRecordedWindowContainer.getSurfaceControl());
        mRecordedSurface = SurfaceControl.mirrorSurface(sourceSurface);
        SurfaceControl.Transaction transaction =
                mDisplayContent.mWmService.mTransactionFactory.get()
                        // Set the mMirroredSurface's parent to the root SurfaceControl for this