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

Commit 8f3978fc authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Fix windows disappearing when resizing freeform or docked."

parents 22e27ccf 10a80e0b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -8851,7 +8851,7 @@ public class WindowManagerService extends IWindowManager.Stub
                                    + " pid=" + ws.mSession.mPid
                                    + " uid=" + ws.mSession.mUid);
                            wsa.destroySurface();
                            ws.mHasSurface = false;
                            ws.setHasSurface(false);
                            mForceRemoves.add(ws);
                            leakedSurface = true;
                        } else if (ws.mAppToken != null && ws.mAppToken.clientHidden) {
@@ -8861,7 +8861,7 @@ public class WindowManagerService extends IWindowManager.Stub
                                    + " saved=" + ws.mAppToken.mHasSavedSurface);
                            if (SHOW_TRANSACTIONS) logSurface(ws, "LEAK DESTROY", null);
                            wsa.destroySurface();
                            ws.mHasSurface = false;
                            ws.setHasSurface(false);
                            ws.mAppToken.mHasSavedSurface = false;
                            leakedSurface = true;
                        }
@@ -8908,7 +8908,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) logSurface(winAnimator.mWin,
                            "RECOVER DESTROY", null);
                    surfaceController.destroyInTransaction();
                    winAnimator.mWin.mHasSurface = false;
                    winAnimator.mWin.setHasSurface(false);
                    scheduleRemoveStartingWindowLocked(winAnimator.mWin.mAppToken);
                }

+4 −0
Original line number Diff line number Diff line
@@ -1295,6 +1295,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        mConfigHasChanged = false;
    }

    void setHasSurface(boolean hasSurface) {
        mHasSurface = hasSurface;
    }

    private final class DeadWindowEventReceiver extends InputEventReceiver {
        DeadWindowEventReceiver(InputChannel inputChannel) {
            super(inputChannel, mService.mH.getLooper());
+13 −6
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ class WindowStateAnimator {
     */
    boolean mSurfaceResized;
    WindowSurfaceController mSurfaceController;
    WindowSurfaceController mPendingDestroySurface;
    private WindowSurfaceController mPendingDestroySurface;

    /**
     * Set if the client has asked that the destroy of its surface be delayed
@@ -110,7 +110,7 @@ class WindowStateAnimator {
     */
    boolean mSurfaceDestroyDeferred;

    boolean mDestroyPreservedSurfaceUponRedraw;
    private boolean mDestroyPreservedSurfaceUponRedraw;
    float mShownAlpha = 0;
    float mAlpha = 0;
    float mLastAlpha = 0;
@@ -654,7 +654,7 @@ class WindowStateAnimator {
                        attrs.getTitle().toString(),
                        width, height, format, flags, this);

                w.mHasSurface = true;
                w.setHasSurface(true);

                if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
                    Slog.i(TAG, "  CREATE SURFACE "
@@ -666,13 +666,13 @@ class WindowStateAnimator {
                            + " / " + this);
                }
            } catch (OutOfResourcesException e) {
                w.mHasSurface = false;
                w.setHasSurface(false);
                Slog.w(TAG, "OutOfResourcesException creating surface");
                mService.reclaimSomeSurfaceMemoryLocked(this, "create", true);
                mDrawState = NO_SURFACE;
                return null;
            } catch (Exception e) {
                w.mHasSurface = false;
                w.setHasSurface(false);
                Slog.e(TAG, "Exception creating surface", e);
                mDrawState = NO_SURFACE;
                return null;
@@ -759,7 +759,14 @@ class WindowStateAnimator {
                    + ": " + e.toString());
            }

            mWin.mHasSurface = false;
            // Whether the surface was preserved (and copied to mPendingDestroySurface) or not, it
            // needs to be cleared to match the WindowState.mHasSurface state. It is also necessary
            // so it can be recreated successfully in mPendingDestroySurface case.
            mWin.setHasSurface(false);
            if (mSurfaceController != null) {
                mSurfaceController.setShown(false);
            }
            mSurfaceController = null;
            mDrawState = NO_SURFACE;
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -364,6 +364,10 @@ class WindowSurfaceController {
        return mSurfaceShown;
    }

    void setShown(boolean surfaceShown) {
        mSurfaceShown = surfaceShown;
    }

    float getX() {
        return mSurfaceX;
    }