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

Commit 0cbe4b39 authored by Daniel Akinola's avatar Daniel Akinola Committed by Automerger Merge Worker
Browse files

Merge "Always updateRecording in...

Merge "Always updateRecording in ContentRecordingController#setContentRecordingSession" into udc-qpr-dev am: 6f729037 am: a5a91767

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



Change-Id: I6eab59fc7d199ef67e2875893a86193cd4270ae7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5a75a3f0 a5a91767
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -117,11 +117,12 @@ final class ContentRecordingController {
            }
            incomingDisplayContent.setContentRecordingSession(incomingSession);
            // Updating scenario: Explicitly ask ContentRecorder to update, since no config or
            // display change will trigger an update from the DisplayContent.
            if (hasSessionUpdatedWithConsent) {
            // display change will trigger an update from the DisplayContent. There exists a
            // scenario where a DisplayContent is created, but it's ContentRecordingSession hasn't
            // been set yet due to a race condition. On creation, updateRecording fails to start
            // recording, so now this call guarantees recording will be started from somewhere.
            incomingDisplayContent.updateRecording();
        }
        }
        // Takeover and stopping scenario: stop recording on the pre-existing session.
        if (mSession != null && !hasSessionUpdatedWithConsent) {
            ProtoLog.v(WM_DEBUG_CONTENT_RECORDING,
+2 −1
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ public class ContentRecordingControllerTests extends WindowTestsBase {
        controller.setContentRecordingSessionLocked(mWaitingDisplaySession, mWm);
        verify(mVirtualDisplayContent, atLeastOnce()).setContentRecordingSession(
                mWaitingDisplaySession);
        verify(mVirtualDisplayContent).updateRecording();

        // WHEN updating the session on the same display, so no longer waiting to record.
        ContentRecordingSession sessionUpdate = ContentRecordingSession.createTaskSession(
@@ -135,7 +136,7 @@ public class ContentRecordingControllerTests extends WindowTestsBase {
        // THEN the session was accepted.
        assertThat(resultingSession).isEqualTo(sessionUpdate);
        verify(mVirtualDisplayContent, atLeastOnce()).setContentRecordingSession(sessionUpdate);
        verify(mVirtualDisplayContent).updateRecording();
        verify(mVirtualDisplayContent, atLeastOnce()).updateRecording();
    }

    @Test