diff options
| author | 2023-08-10 14:58:42 +0000 | |
|---|---|---|
| committer | 2023-08-10 14:58:42 +0000 | |
| commit | 6f7290371189b84b6fa2dd9441a7e6768cb012a7 (patch) | |
| tree | 8cc318d18936988b2ed59b2ce18f45cb4a2b1304 | |
| parent | e729480efeb81617aada31c7cad956398fa9c4b1 (diff) | |
| parent | 6fc8f3282f0021cfac3f145b97fe46b4d406dfb3 (diff) | |
Merge "Always updateRecording in ContentRecordingController#setContentRecordingSession" into udc-qpr-dev
| -rw-r--r-- | services/core/java/com/android/server/wm/ContentRecordingController.java | 9 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/ContentRecordingController.java b/services/core/java/com/android/server/wm/ContentRecordingController.java index f24ba5a45885..b5890856fa6f 100644 --- a/services/core/java/com/android/server/wm/ContentRecordingController.java +++ b/services/core/java/com/android/server/wm/ContentRecordingController.java @@ -117,10 +117,11 @@ 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) { - incomingDisplayContent.updateRecording(); - } + // 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) { diff --git a/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java index 52226c2be298..4473a31f0513 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ContentRecordingControllerTests.java @@ -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 |