Merge "Extract common operations for screenshot layer" into udc-dev
This commit is contained in:
@@ -1297,6 +1297,17 @@ public class TransitionAnimation {
|
||||
return set;
|
||||
}
|
||||
|
||||
/** Sets the default attributes of the screenshot layer used for animation. */
|
||||
public static void configureScreenshotLayer(SurfaceControl.Transaction t, SurfaceControl layer,
|
||||
ScreenCapture.ScreenshotHardwareBuffer buffer) {
|
||||
t.setBuffer(layer, buffer.getHardwareBuffer());
|
||||
t.setDataSpace(layer, buffer.getColorSpace().getDataSpace());
|
||||
// Avoid showing dimming effect for HDR content when running animation.
|
||||
if (buffer.containsHdrLayers()) {
|
||||
t.setDimmingEnabled(layer, false);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns whether the hardware buffer passed in is marked as protected. */
|
||||
public static boolean hasProtectedContent(HardwareBuffer hardwareBuffer) {
|
||||
return (hardwareBuffer.getUsage() & HardwareBuffer.USAGE_PROTECTED_CONTENT)
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.animation.ValueAnimator;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorSpace;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.HardwareBuffer;
|
||||
@@ -162,13 +161,12 @@ class ScreenRotationAnimation {
|
||||
.setName("RotationLayer")
|
||||
.build();
|
||||
|
||||
final ColorSpace colorSpace = screenshotBuffer.getColorSpace();
|
||||
TransitionAnimation.configureScreenshotLayer(t, mScreenshotLayer, screenshotBuffer);
|
||||
final HardwareBuffer hardwareBuffer = screenshotBuffer.getHardwareBuffer();
|
||||
t.setDataSpace(mScreenshotLayer, colorSpace.getDataSpace());
|
||||
t.setBuffer(mScreenshotLayer, hardwareBuffer);
|
||||
t.show(mScreenshotLayer);
|
||||
if (!isCustomRotate()) {
|
||||
mStartLuma = TransitionAnimation.getBorderLuma(hardwareBuffer, colorSpace);
|
||||
mStartLuma = TransitionAnimation.getBorderLuma(hardwareBuffer,
|
||||
screenshotBuffer.getColorSpace());
|
||||
}
|
||||
hardwareBuffer.close();
|
||||
}
|
||||
|
||||
@@ -2732,9 +2732,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
|
||||
buffer, screenshotBuffer.getColorSpace());
|
||||
}
|
||||
SurfaceControl.Transaction t = wc.mWmService.mTransactionFactory.get();
|
||||
|
||||
t.setBuffer(snapshotSurface, buffer);
|
||||
t.setDataSpace(snapshotSurface, screenshotBuffer.getColorSpace().getDataSpace());
|
||||
TransitionAnimation.configureScreenshotLayer(t, snapshotSurface, screenshotBuffer);
|
||||
t.show(snapshotSurface);
|
||||
|
||||
// Place it on top of anything else in the container.
|
||||
|
||||
Reference in New Issue
Block a user