diff options
5 files changed, 65 insertions, 57 deletions
diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json index 16e94f8737d7..4bd69f188d4c 100644 --- a/data/etc/services.core.protolog.json +++ b/data/etc/services.core.protolog.json @@ -253,12 +253,6 @@ "group": "WM_DEBUG_BOOT", "at": "com\/android\/server\/wm\/WindowManagerService.java" }, - "-1883484959": { - "message": "Content Recording: Display %d state is now (%d), so update recording?", - "level": "VERBOSE", - "group": "WM_DEBUG_CONTENT_RECORDING", - "at": "com\/android\/server\/wm\/DisplayContent.java" - }, "-1872288685": { "message": "applyAnimation: anim=%s nextAppTransition=%s transit=%s isEntrance=%b Callers=%s", "level": "VERBOSE", @@ -2365,6 +2359,12 @@ "group": "WM_DEBUG_RECENTS_ANIMATIONS", "at": "com\/android\/server\/wm\/RecentsAnimationController.java" }, + "34106798": { + "message": "Content Recording: Display %d state was (%d), is now (%d), so update recording?", + "level": "VERBOSE", + "group": "WM_DEBUG_CONTENT_RECORDING", + "at": "com\/android\/server\/wm\/DisplayContent.java" + }, "34682671": { "message": "Not moving display (displayId=%d) to top. Top focused displayId=%d. Reason: FLAG_STEAL_TOP_FOCUS_DISABLED", "level": "INFO", diff --git a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java index 9f480b6f5e21..d76568f17667 100644 --- a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java +++ b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java @@ -161,6 +161,8 @@ public class VirtualDisplayAdapter extends DisplayAdapter { int width, int height, int densityDpi) { VirtualDisplayDevice device = mVirtualDisplayDevices.get(appToken); if (device != null) { + Slog.v(TAG, "Resize VirtualDisplay " + device.mName + " to " + width + + " " + height); device.resizeLocked(width, height, densityDpi); } } @@ -177,6 +179,7 @@ public class VirtualDisplayAdapter extends DisplayAdapter { public void setVirtualDisplaySurfaceLocked(IBinder appToken, Surface surface) { VirtualDisplayDevice device = mVirtualDisplayDevices.get(appToken); if (device != null) { + Slog.v(TAG, "Update surface for VirtualDisplay " + device.mName); device.setSurfaceLocked(surface); } } @@ -191,6 +194,7 @@ public class VirtualDisplayAdapter extends DisplayAdapter { public DisplayDevice releaseVirtualDisplayLocked(IBinder appToken) { VirtualDisplayDevice device = mVirtualDisplayDevices.remove(appToken); if (device != null) { + Slog.v(TAG, "Release VirtualDisplay " + device.mName); device.destroyLocked(true); appToken.unlinkToDeath(device, 0); } diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java index 802a7f2954af..72c6111cba9d 100644 --- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java @@ -956,6 +956,7 @@ public final class MediaProjectionManagerService extends SystemService if (callback == null) { throw new IllegalArgumentException("callback must not be null"); } + Slog.v(TAG, "Start the token instance " + this); // Cache result of calling into ActivityManagerService outside of the lock, to prevent // deadlock with WindowManagerService. final boolean hasFGS = mActivityManagerInternal.hasRunningForegroundService( diff --git a/services/core/java/com/android/server/wm/ContentRecorder.java b/services/core/java/com/android/server/wm/ContentRecorder.java index 7cd07d6f3a5f..ed3108e8e3ae 100644 --- a/services/core/java/com/android/server/wm/ContentRecorder.java +++ b/services/core/java/com/android/server/wm/ContentRecorder.java @@ -141,60 +141,62 @@ final class ContentRecorder implements WindowContainerListener { */ void onConfigurationChanged(@Configuration.Orientation int lastOrientation) { // Update surface for MediaProjection, if this DisplayContent is being used for recording. - if (isCurrentlyRecording() && mLastRecordedBounds != null) { - // Recording has already begun, but update recording since the display is now on. - if (mRecordedWindowContainer == null) { + if (!isCurrentlyRecording() || mLastRecordedBounds == null) { + return; + } + + // Recording has already begun, but update recording since the display is now on. + if (mRecordedWindowContainer == null) { + ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, + "Content Recording: Unexpectedly null window container; unable to update " + + "recording for display %d", + mDisplayContent.getDisplayId()); + return; + } + + // TODO(b/297514518) Do not start capture if the app is in PIP, the bounds are + // inaccurate. + if (mContentRecordingSession.getContentToRecord() == RECORD_CONTENT_TASK) { + final Task capturedTask = mRecordedWindowContainer.asTask(); + if (capturedTask.inPinnedWindowingMode()) { ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, - "Content Recording: Unexpectedly null window container; unable to update " - + "recording for display %d", + "Content Recording: Display %d was already recording, but " + + "pause capture since the task is in PIP", mDisplayContent.getDisplayId()); + pauseRecording(); return; } + } - // TODO(b/297514518) Do not start capture if the app is in PIP, the bounds are - // inaccurate. - if (mContentRecordingSession.getContentToRecord() == RECORD_CONTENT_TASK) { - final Task capturedTask = mRecordedWindowContainer.asTask(); - if (capturedTask.inPinnedWindowingMode()) { - ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, - "Content Recording: Display %d was already recording, but " - + "pause capture since the task is in PIP", - mDisplayContent.getDisplayId()); - pauseRecording(); - return; - } - } - - ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, - "Content Recording: Display %d was already recording, so apply " - + "transformations if necessary", - mDisplayContent.getDisplayId()); - // Retrieve the size of the region to record, and continue with the update - // if the bounds or orientation has changed. - final Rect recordedContentBounds = mRecordedWindowContainer.getBounds(); - @Configuration.Orientation int recordedContentOrientation = - mRecordedWindowContainer.getConfiguration().orientation; - if (!mLastRecordedBounds.equals(recordedContentBounds) - || lastOrientation != recordedContentOrientation) { - Point surfaceSize = fetchSurfaceSizeIfPresent(); - if (surfaceSize != null) { - ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, - "Content Recording: Going ahead with updating recording for display " - + "%d to new bounds %s and/or orientation %d.", - mDisplayContent.getDisplayId(), recordedContentBounds, - recordedContentOrientation); - updateMirroredSurface(mRecordedWindowContainer.getSyncTransaction(), - recordedContentBounds, surfaceSize); - } else { - // If the surface removed, do nothing. We will handle this via onDisplayChanged - // (the display will be off if the surface is removed). - ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, - "Content Recording: Unable to update recording for display %d to new " - + "bounds %s and/or orientation %d, since the surface is not " - + "available.", - mDisplayContent.getDisplayId(), recordedContentBounds, - recordedContentOrientation); - } + ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, + "Content Recording: Display %d was already recording, so apply " + + "transformations if necessary", + mDisplayContent.getDisplayId()); + // Retrieve the size of the region to record, and continue with the update + // if the bounds or orientation has changed. + final Rect recordedContentBounds = mRecordedWindowContainer.getBounds(); + @Configuration.Orientation int recordedContentOrientation = + mRecordedWindowContainer.getConfiguration().orientation; + if (!mLastRecordedBounds.equals(recordedContentBounds) + || lastOrientation != recordedContentOrientation) { + Point surfaceSize = fetchSurfaceSizeIfPresent(); + if (surfaceSize != null) { + ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, + "Content Recording: Going ahead with updating recording for display " + + "%d to new bounds %s and/or orientation %d.", + mDisplayContent.getDisplayId(), recordedContentBounds, + recordedContentOrientation); + updateMirroredSurface(mRecordedWindowContainer.getSyncTransaction(), + recordedContentBounds, surfaceSize); + } else { + // If the surface removed, do nothing. We will handle this via onDisplayChanged + // (the display will be off if the surface is removed). + ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, + "Content Recording: Unable to update recording for display %d to new " + + "bounds %s and/or orientation %d, since the surface is not " + + "available.", + mDisplayContent.getDisplayId(), recordedContentBounds, + recordedContentOrientation); } } } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 6925422722f0..47e90ceaca79 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -6061,8 +6061,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mOffTokenAcquirer.release(mDisplayId); } ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, - "Content Recording: Display %d state is now (%d), so update recording?", - mDisplayId, displayState); + "Content Recording: Display %d state was (%d), is now (%d), so update " + + "recording?", + mDisplayId, lastDisplayState, displayState); if (lastDisplayState != displayState) { // If state is on due to surface being added, then start recording. // If state is off due to surface being removed, then stop recording. |