Loading services/core/java/com/android/server/wm/ContentRecorder.java +6 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.content.Context.MEDIA_PROJECTION_SERVICE; import static android.content.res.Configuration.ORIENTATION_UNDEFINED; import static android.view.ContentRecordingSession.RECORD_CONTENT_DISPLAY; import static android.view.ContentRecordingSession.RECORD_CONTENT_TASK; import static android.view.ViewProtoEnums.DISPLAY_STATE_OFF; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONTENT_RECORDING; Loading Loading @@ -317,6 +318,11 @@ final class ContentRecorder implements WindowContainerListener { if (mContentRecordingSession.getContentToRecord() == RECORD_CONTENT_TASK) { mMediaProjectionManager.notifyActiveProjectionCapturedContentVisibilityChanged( mRecordedWindowContainer.asTask().isVisibleRequested()); } else { int currentDisplayState = mRecordedWindowContainer.asDisplayContent().getDisplay().getState(); mMediaProjectionManager.notifyActiveProjectionCapturedContentVisibilityChanged( currentDisplayState != DISPLAY_STATE_OFF); } // No need to clean up. In SurfaceFlinger, parents hold references to their children. The Loading services/tests/wmtests/src/com/android/server/wm/ContentRecorderTests.java +13 −1 Original line number Diff line number Diff line Loading @@ -280,7 +280,7 @@ public class ContentRecorderTests extends WindowTestsBase { } @Test public void testStartRecording_notifiesCallback() { public void testStartRecording_notifiesCallback_taskSession() { // WHEN a recording is ongoing. mContentRecorder.setContentRecordingSession(mTaskSession); mContentRecorder.updateRecording(); Loading @@ -291,6 +291,18 @@ public class ContentRecorderTests extends WindowTestsBase { .notifyActiveProjectionCapturedContentVisibilityChanged(true); } @Test public void testStartRecording_notifiesCallback_displaySession() { // WHEN a recording is ongoing. mContentRecorder.setContentRecordingSession(mDisplaySession); mContentRecorder.updateRecording(); assertThat(mContentRecorder.isCurrentlyRecording()).isTrue(); // THEN the visibility change callback is notified. verify(mMediaProjectionManagerWrapper) .notifyActiveProjectionCapturedContentVisibilityChanged(true); } @Test public void testOnVisibleRequestedChanged_notifiesCallback() { // WHEN a recording is ongoing. Loading Loading
services/core/java/com/android/server/wm/ContentRecorder.java +6 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.content.Context.MEDIA_PROJECTION_SERVICE; import static android.content.res.Configuration.ORIENTATION_UNDEFINED; import static android.view.ContentRecordingSession.RECORD_CONTENT_DISPLAY; import static android.view.ContentRecordingSession.RECORD_CONTENT_TASK; import static android.view.ViewProtoEnums.DISPLAY_STATE_OFF; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONTENT_RECORDING; Loading Loading @@ -317,6 +318,11 @@ final class ContentRecorder implements WindowContainerListener { if (mContentRecordingSession.getContentToRecord() == RECORD_CONTENT_TASK) { mMediaProjectionManager.notifyActiveProjectionCapturedContentVisibilityChanged( mRecordedWindowContainer.asTask().isVisibleRequested()); } else { int currentDisplayState = mRecordedWindowContainer.asDisplayContent().getDisplay().getState(); mMediaProjectionManager.notifyActiveProjectionCapturedContentVisibilityChanged( currentDisplayState != DISPLAY_STATE_OFF); } // No need to clean up. In SurfaceFlinger, parents hold references to their children. The Loading
services/tests/wmtests/src/com/android/server/wm/ContentRecorderTests.java +13 −1 Original line number Diff line number Diff line Loading @@ -280,7 +280,7 @@ public class ContentRecorderTests extends WindowTestsBase { } @Test public void testStartRecording_notifiesCallback() { public void testStartRecording_notifiesCallback_taskSession() { // WHEN a recording is ongoing. mContentRecorder.setContentRecordingSession(mTaskSession); mContentRecorder.updateRecording(); Loading @@ -291,6 +291,18 @@ public class ContentRecorderTests extends WindowTestsBase { .notifyActiveProjectionCapturedContentVisibilityChanged(true); } @Test public void testStartRecording_notifiesCallback_displaySession() { // WHEN a recording is ongoing. mContentRecorder.setContentRecordingSession(mDisplaySession); mContentRecorder.updateRecording(); assertThat(mContentRecorder.isCurrentlyRecording()).isTrue(); // THEN the visibility change callback is notified. verify(mMediaProjectionManagerWrapper) .notifyActiveProjectionCapturedContentVisibilityChanged(true); } @Test public void testOnVisibleRequestedChanged_notifiesCallback() { // WHEN a recording is ongoing. Loading