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

Commit f6bffe56 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix ColorFade would be cut when turn off screen in landscape" into sc-dev am: c19e092b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14516714

Change-Id: I68b27c5a104b33104371b9ca69faf44284714390
parents 6e6073d4 c19e092b
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ final class ColorFade {
    private int mDisplayHeight;     // real height, not rotated
    private SurfaceControl mSurfaceControl;
    private Surface mSurface;
    private SurfaceControl mBLASTSurfaceControl;
    private BLASTBufferQueue mBLASTBufferQueue;
    private NaturalSurfaceLayout mSurfaceLayout;
    private EGLDisplay mEglDisplay;
@@ -576,7 +577,7 @@ final class ColorFade {
            if (mMode == MODE_FADE) {
                builder.setColorLayer();
            } else {
                builder.setBLASTLayer();
                builder.setContainerLayer();
            }
            mSurfaceControl = builder.build();
        } catch (OutOfResourcesException ex) {
@@ -592,7 +593,14 @@ final class ColorFade {
        mTransaction.apply();

        if (mMode != MODE_FADE) {
            mBLASTBufferQueue = new BLASTBufferQueue("ColorFade", mSurfaceControl,
            final SurfaceControl.Builder b = new SurfaceControl.Builder()
                    .setName("ColorFade BLAST")
                    .setParent(mSurfaceControl)
                    .setHidden(false)
                    .setSecure(isSecure)
                    .setBLASTLayer();
            mBLASTSurfaceControl = b.build();
            mBLASTBufferQueue = new BLASTBufferQueue("ColorFade", mBLASTSurfaceControl,
                    mDisplayWidth, mDisplayHeight, PixelFormat.TRANSLUCENT);
            mSurface = mBLASTBufferQueue.createSurface();
        }
@@ -723,10 +731,16 @@ final class ColorFade {
            mTransaction.remove(mSurfaceControl).apply();
            if (mSurface != null) {
                mSurface.release();
                mBLASTBufferQueue.destroy();
                mSurface = null;
            }

            if (mBLASTSurfaceControl != null) {
                mBLASTSurfaceControl.release();
                mBLASTSurfaceControl = null;
                mBLASTBufferQueue.destroy();
                mBLASTBufferQueue = null;
            }

            mSurfaceControl = null;
            mSurfaceVisible = false;
            mSurfaceAlpha = 0f;