Merge "Keep PIP screenshot layer below input consumer layer" into sc-dev am: f369d35b27
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14667204 Change-Id: Iaa5b8ab344b62bda95eece3af3670783740cb078
This commit is contained in:
@@ -32,11 +32,12 @@ public class ScreenshotUtils {
|
||||
* @param t the transaction used to set changes on the resulting screenshot.
|
||||
* @param sc the SurfaceControl to take a screenshot of
|
||||
* @param crop the crop to use when capturing the screenshot
|
||||
* @param layer the layer to place the screenshot
|
||||
*
|
||||
* @return A SurfaceControl where the screenshot will be attached, or null if failed.
|
||||
*/
|
||||
public static SurfaceControl takeScreenshot(SurfaceControl.Transaction t, SurfaceControl sc,
|
||||
Rect crop) {
|
||||
Rect crop, int layer) {
|
||||
final SurfaceControl.ScreenshotHardwareBuffer buffer = SurfaceControl.captureLayers(
|
||||
new SurfaceControl.LayerCaptureArgs.Builder(sc)
|
||||
.setSourceCrop(crop)
|
||||
@@ -60,7 +61,7 @@ public class ScreenshotUtils {
|
||||
t.setBuffer(screenshot, graphicBuffer);
|
||||
t.setColorSpace(screenshot, buffer.getColorSpace());
|
||||
t.reparent(screenshot, sc);
|
||||
t.setLayer(screenshot, Integer.MAX_VALUE);
|
||||
t.setLayer(screenshot, layer);
|
||||
t.show(screenshot);
|
||||
t.apply();
|
||||
return screenshot;
|
||||
|
||||
@@ -1159,8 +1159,11 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
||||
preResizeBounds.offsetTo(0, 0);
|
||||
final Rect snapshotDest = new Rect(0, 0, destinationBounds.width(),
|
||||
destinationBounds.height());
|
||||
// Note: Put this at layer=MAX_VALUE-2 since the input consumer for PIP is placed at
|
||||
// MAX_VALUE-1
|
||||
final SurfaceControl snapshotSurface = ScreenshotUtils.takeScreenshot(
|
||||
mSurfaceControlTransactionFactory.getTransaction(), mLeash, preResizeBounds);
|
||||
mSurfaceControlTransactionFactory.getTransaction(), mLeash, preResizeBounds,
|
||||
Integer.MAX_VALUE - 2);
|
||||
if (snapshotSurface != null) {
|
||||
mSyncTransactionQueue.queue(wct);
|
||||
mSyncTransactionQueue.runInSync(t -> {
|
||||
|
||||
Reference in New Issue
Block a user