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

Commit c19e092b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

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


        if (mMode != MODE_FADE) {
        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);
                    mDisplayWidth, mDisplayHeight, PixelFormat.TRANSLUCENT);
            mSurface = mBLASTBufferQueue.createSurface();
            mSurface = mBLASTBufferQueue.createSurface();
        }
        }
@@ -723,10 +731,16 @@ final class ColorFade {
            mTransaction.remove(mSurfaceControl).apply();
            mTransaction.remove(mSurfaceControl).apply();
            if (mSurface != null) {
            if (mSurface != null) {
                mSurface.release();
                mSurface.release();
                mBLASTBufferQueue.destroy();
                mSurface = null;
                mSurface = null;
            }

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

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