diff --git a/media/java/android/media/projection/MediaProjection.java b/media/java/android/media/projection/MediaProjection.java index 985ac3ca7d6ec..9e9012e431119 100644 --- a/media/java/android/media/projection/MediaProjection.java +++ b/media/java/android/media/projection/MediaProjection.java @@ -253,23 +253,19 @@ public final class MediaProjection { public void onStop() { } /** - * Indicates the width and height of the captured region in pixels. Called immediately after - * capture begins to provide the app with accurate sizing for the stream. Also called - * when the region captured in this MediaProjection session is resized. + * Invoked immediately after capture begins or when the size of the captured region changes, + * providing the accurate sizing for the streamed capture. *
* The given width and height, in pixels, corresponds to the same width and height that - * would be returned from {@link android.view.WindowMetrics#getBounds()} + * would be returned from {@link android.view.WindowMetrics#getBounds()} of the captured + * region. *
*- * Without the application resizing the {@link VirtualDisplay} (returned from - * {@code MediaProjection#createVirtualDisplay}) and output {@link Surface} (provided - * to {@code MediaProjection#createVirtualDisplay}), the captured stream will have - * letterboxing (black bars) around the recorded content to make up for the - * difference in aspect ratio. - *
- *- * The application can prevent the letterboxing by overriding this method, and - * updating the size of both the {@link VirtualDisplay} and output {@link Surface}: + * If the recorded content has a different aspect ratio from either the + * {@link VirtualDisplay} or output {@link Surface}, the captured stream has letterboxing + * (black bars) around the recorded content. The application can avoid the letterboxing + * around the recorded content by updating the size of both the {@link VirtualDisplay} and + * output {@link Surface}: *
* *
@@ -293,27 +289,29 @@ public final class MediaProjection {
public void onCapturedContentResize(int width, int height) { }
/**
- * Indicates the visibility of the captured region has changed. Called immediately after
- * capture begins with the initial visibility state, and when visibility changes. Provides
- * the app with accurate state for presenting its own UI. The application can take advantage
- * of this by showing or hiding the captured content, based on if the captured region is
- * currently visible to the user.
+ * Invoked immediately after capture begins or when the visibility of the captured region
+ * changes, providing the current visibility of the captured region.
+ *
+ * Applications can take advantage of this callback by showing or hiding the captured
+ * content from the output {@link Surface}, based on if the captured region is currently
+ * visible to the user.
+ *
*
* For example, if the user elected to capture a single app (from the activity shown from
- * {@link MediaProjectionManager#createScreenCaptureIntent()}), the callback may be
- * triggered for the following reasons:
+ * {@link MediaProjectionManager#createScreenCaptureIntent()}), the following scenarios
+ * trigger the callback:
*