Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30d3cfc4 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Extract common operations for screenshot layer" into udc-dev am: 4e72786e

parents 6e2a5b2b 4e72786e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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)
+3 −5
Original line number Diff line number Diff line
@@ -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();
            }
+1 −3
Original line number Diff line number Diff line
@@ -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.