Merge "Trigger hidden/visible callback when start display recording."
This commit is contained in:
committed by
Android (Google) Code Review
commit
979347463a
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user