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

Commit 5b2f199c authored by Chong Zhang's avatar Chong Zhang
Browse files

Notify client of surface size change if it's changed from last relayout

Not just when it's changed during this relayout.

bug: 25596610

Also add the delayed surface to removal list regardless of the show
result, it won't be destroyed until window is ready to show but we
need to add it to the list first.

bug: 25666160

Change-Id: I6fceada1bdc1de0a5b5a4d6dc261957164817330
parent 0430f187
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2725,8 +2725,6 @@ public class WindowManagerService extends IWindowManager.Stub
                        WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
            }

            final int oldSurfaceResizeGeneration = winAnimator.mSurfaceResizeGeneration;

            win.setDisplayLayoutNeeded();
            win.mGivenInsetsPending = (flags&WindowManagerGlobal.RELAYOUT_INSETS_PENDING) != 0;
            configChanged = updateOrientationFromAppTokensLocked(false);
@@ -2739,7 +2737,8 @@ public class WindowManagerService extends IWindowManager.Stub
            if (win.mAppToken != null) {
                win.mAppToken.updateReportedVisibilityLocked();
            }
            if (winAnimator.mSurfaceResizeGeneration != oldSurfaceResizeGeneration) {
            if (winAnimator.mReportSurfaceResized) {
                winAnimator.mReportSurfaceResized = false;
                result |= WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED;
            }
            outFrame.set(win.mCompatFrame);
+9 −5
Original line number Diff line number Diff line
@@ -99,7 +99,11 @@ class WindowStateAnimator {
     * we must tell them application to resize (and thus redraw itself).
     */
    boolean mSurfaceResized;
    int mSurfaceResizeGeneration;
    /**
     * Whether we should inform the client on next relayoutWindow that
     * the surface has been resized since last time.
     */
    boolean mReportSurfaceResized;
    WindowSurfaceController mSurfaceController;
    private WindowSurfaceController mPendingDestroySurface;

@@ -497,7 +501,7 @@ class WindowStateAnimator {
        }
        if (mDrawState == DRAW_PENDING) {
            if (DEBUG_SURFACE_TRACE || DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION)
                Slog.v(TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + this + " in "
                Slog.v(TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + mWin + " in "
                        + mSurfaceController);
            if (DEBUG_STARTING_WINDOW && startingWindow) {
                Slog.v(TAG, "Draw state now committed in " + mWin);
@@ -529,7 +533,7 @@ class WindowStateAnimator {
                mWin.mAttrs.type == TYPE_APPLICATION_STARTING) {
            result = performShowLocked();
        }
        if (mDestroyPreservedSurfaceUponRedraw && result) {
        if (mDestroyPreservedSurfaceUponRedraw) {
            mService.mDestroyPreservedSurface.add(mWin);
        }
        return result;
@@ -1189,7 +1193,7 @@ class WindowStateAnimator {
                recoveringMemory);

        if (mSurfaceResized) {
            mSurfaceResizeGeneration++;
            mReportSurfaceResized = true;
            mAnimator.setPendingLayoutChanges(w.getDisplayId(),
                    WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER);
            w.applyDimLayerIfNeeded();
@@ -1418,7 +1422,7 @@ class WindowStateAnimator {
            // Force the show in the next prepareSurfaceLocked() call.
            mLastAlpha = -1;
            if (DEBUG_SURFACE_TRACE || DEBUG_ANIM)
                Slog.v(TAG, "performShowLocked: mDrawState=HAS_DRAWN in " + this);
                Slog.v(TAG, "performShowLocked: mDrawState=HAS_DRAWN in " + mWin);
            mDrawState = HAS_DRAWN;
            mService.scheduleAnimationLocked();