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

Commit cb9a61bd authored by Svetoslav's avatar Svetoslav
Browse files

Display magnifier does not release its surface on destroy.

Change-Id: I0b9448c8859b0167632652060b08072dc8c9c0a5
parent 80943d8d
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -228,6 +228,10 @@ final class DisplayMagnifier {
        return spec;
    }

    public void destroyLocked() {
        mMagnifedViewport.destroyWindow();
    }

    /** NOTE: This has to be called within a surface transaction. */
    public void drawMagnifiedRegionBorderIfNeededLocked() {
        mMagnifedViewport.drawWindowIfNeededLocked();
@@ -258,7 +262,7 @@ final class DisplayMagnifier {
        private final int mBorderWidth;
        private final int mHalfBorderWidth;

        private ViewportWindow mWindow;
        private final ViewportWindow mWindow;

        private boolean mFullRedrawNeeded;

@@ -459,6 +463,10 @@ final class DisplayMagnifier {
            mWindow.drawIfNeeded();
        }

        public void destroyWindow() {
            mWindow.releaseSurface();
        }

        private final class ViewportWindow {
            private static final String SURFACE_TITLE = "Magnification Overlay";

@@ -640,6 +648,10 @@ final class DisplayMagnifier {
                    }
                }
            }

            public void releaseSurface() {
                mSurface.release();
            }
        }
    }

+4 −1
Original line number Diff line number Diff line
@@ -3039,7 +3039,10 @@ public class WindowManagerService extends IWindowManager.Stub
                mDisplayMagnifier = new DisplayMagnifier(this, callbacks);
            } else {
                if (callbacks == null) {
                    if (mDisplayMagnifier != null) {
                        mDisplayMagnifier.destroyLocked();
                        mDisplayMagnifier = null;
                    }
                } else {
                    throw new IllegalStateException("Magnification callbacks already set!");
                }