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