Loading core/java/com/android/internal/policy/TransitionAnimation.java +8 −3 Original line number Diff line number Diff line Loading @@ -1279,11 +1279,16 @@ public class TransitionAnimation { public static float getBorderLuma(SurfaceControl surfaceControl, int w, int h) { final ScreenCapture.ScreenshotHardwareBuffer buffer = ScreenCapture.captureLayers(surfaceControl, new Rect(0, 0, w, h), 1); if (buffer != null) { return getBorderLuma(buffer.getHardwareBuffer(), buffer.getColorSpace()); } if (buffer == null) { return 0; } final HardwareBuffer hwBuffer = buffer.getHardwareBuffer(); final float luma = getBorderLuma(hwBuffer, buffer.getColorSpace()); if (hwBuffer != null) { hwBuffer.close(); } return luma; } /** Returns the luminance in 0~1. */ public static float getBorderLuma(HardwareBuffer hwBuffer, ColorSpace colorSpace) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java +1 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,7 @@ class ScreenRotationAnimation { if (!isCustomRotate()) { mStartLuma = TransitionAnimation.getBorderLuma(hardwareBuffer, colorSpace); } hardwareBuffer.close(); } t.setLayer(mAnimLeash, SCREEN_FREEZE_LAYER_BASE); Loading services/core/java/com/android/server/wm/ScreenRotationAnimation.java +2 −5 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import static com.android.server.wm.utils.CoordinateTransforms.computeRotationMa import android.animation.ArgbEvaluator; import android.content.Context; import android.graphics.Color; import android.graphics.GraphicBuffer; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; Loading Loading @@ -251,9 +250,6 @@ class ScreenRotationAnimation { screenshotBuffer.getColorSpace()); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); GraphicBuffer buffer = GraphicBuffer.createFromHardwareBuffer( screenshotBuffer.getHardwareBuffer()); t.setLayer(mScreenshotLayer, SCREEN_FREEZE_LAYER_BASE); t.reparent(mBackColorSurface, displayContent.getSurfaceControl()); // If hdr layers are on-screen, e.g. picture-in-picture mode, the screenshot of Loading @@ -263,10 +259,11 @@ class ScreenRotationAnimation { t.setLayer(mBackColorSurface, -1); t.setColor(mBackColorSurface, new float[]{mStartLuma, mStartLuma, mStartLuma}); t.setAlpha(mBackColorSurface, 1); t.setBuffer(mScreenshotLayer, buffer); t.setBuffer(mScreenshotLayer, hardwareBuffer); t.setColorSpace(mScreenshotLayer, screenshotBuffer.getColorSpace()); t.show(mScreenshotLayer); t.show(mBackColorSurface); hardwareBuffer.close(); if (mRoundedCornerOverlay != null) { for (SurfaceControl sc : mRoundedCornerOverlay) { Loading services/core/java/com/android/server/wm/Transition.java +2 −1 Original line number Diff line number Diff line Loading @@ -2406,7 +2406,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { if (isDisplayRotation) { // This isn't cheap, so only do it for display rotations. changeInfo.mSnapshotLuma = TransitionAnimation.getBorderLuma( screenshotBuffer.getHardwareBuffer(), screenshotBuffer.getColorSpace()); buffer, screenshotBuffer.getColorSpace()); } SurfaceControl.Transaction t = wc.mWmService.mTransactionFactory.get(); Loading @@ -2418,6 +2418,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { t.setLayer(snapshotSurface, Integer.MAX_VALUE); t.apply(); t.close(); buffer.close(); // Detach the screenshot on the sync transaction (the screenshot is just meant to // freeze the window until the sync transaction is applied (with all its other Loading Loading
core/java/com/android/internal/policy/TransitionAnimation.java +8 −3 Original line number Diff line number Diff line Loading @@ -1279,11 +1279,16 @@ public class TransitionAnimation { public static float getBorderLuma(SurfaceControl surfaceControl, int w, int h) { final ScreenCapture.ScreenshotHardwareBuffer buffer = ScreenCapture.captureLayers(surfaceControl, new Rect(0, 0, w, h), 1); if (buffer != null) { return getBorderLuma(buffer.getHardwareBuffer(), buffer.getColorSpace()); } if (buffer == null) { return 0; } final HardwareBuffer hwBuffer = buffer.getHardwareBuffer(); final float luma = getBorderLuma(hwBuffer, buffer.getColorSpace()); if (hwBuffer != null) { hwBuffer.close(); } return luma; } /** Returns the luminance in 0~1. */ public static float getBorderLuma(HardwareBuffer hwBuffer, ColorSpace colorSpace) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/ScreenRotationAnimation.java +1 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,7 @@ class ScreenRotationAnimation { if (!isCustomRotate()) { mStartLuma = TransitionAnimation.getBorderLuma(hardwareBuffer, colorSpace); } hardwareBuffer.close(); } t.setLayer(mAnimLeash, SCREEN_FREEZE_LAYER_BASE); Loading
services/core/java/com/android/server/wm/ScreenRotationAnimation.java +2 −5 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import static com.android.server.wm.utils.CoordinateTransforms.computeRotationMa import android.animation.ArgbEvaluator; import android.content.Context; import android.graphics.Color; import android.graphics.GraphicBuffer; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; Loading Loading @@ -251,9 +250,6 @@ class ScreenRotationAnimation { screenshotBuffer.getColorSpace()); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); GraphicBuffer buffer = GraphicBuffer.createFromHardwareBuffer( screenshotBuffer.getHardwareBuffer()); t.setLayer(mScreenshotLayer, SCREEN_FREEZE_LAYER_BASE); t.reparent(mBackColorSurface, displayContent.getSurfaceControl()); // If hdr layers are on-screen, e.g. picture-in-picture mode, the screenshot of Loading @@ -263,10 +259,11 @@ class ScreenRotationAnimation { t.setLayer(mBackColorSurface, -1); t.setColor(mBackColorSurface, new float[]{mStartLuma, mStartLuma, mStartLuma}); t.setAlpha(mBackColorSurface, 1); t.setBuffer(mScreenshotLayer, buffer); t.setBuffer(mScreenshotLayer, hardwareBuffer); t.setColorSpace(mScreenshotLayer, screenshotBuffer.getColorSpace()); t.show(mScreenshotLayer); t.show(mBackColorSurface); hardwareBuffer.close(); if (mRoundedCornerOverlay != null) { for (SurfaceControl sc : mRoundedCornerOverlay) { Loading
services/core/java/com/android/server/wm/Transition.java +2 −1 Original line number Diff line number Diff line Loading @@ -2406,7 +2406,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { if (isDisplayRotation) { // This isn't cheap, so only do it for display rotations. changeInfo.mSnapshotLuma = TransitionAnimation.getBorderLuma( screenshotBuffer.getHardwareBuffer(), screenshotBuffer.getColorSpace()); buffer, screenshotBuffer.getColorSpace()); } SurfaceControl.Transaction t = wc.mWmService.mTransactionFactory.get(); Loading @@ -2418,6 +2418,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { t.setLayer(snapshotSurface, Integer.MAX_VALUE); t.apply(); t.close(); buffer.close(); // Detach the screenshot on the sync transaction (the screenshot is just meant to // freeze the window until the sync transaction is applied (with all its other Loading