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

Commit 5deb763e authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Do not reset surface for forced layout

In general this removes commit b2e37802. Because since rotation
is a part of configuration, it is enough to redraw according to
the configuration change.

Otherwise because forceRelayout is also used for syncRedraw,
that will cause to drop pre-allocated buffers and increase the
time of the initial frames for reallocation.

Bug: 229366100
Test: ActivityRecordTests#testLandscapeSeascapeRotationByApp
Test: Rotate 180 degree with various apps and no upside down
      afterimage remains on the screen.
Change-Id: I3f03f7c8674ddc4a8c0b9c0b0528816114075732
parent 8116d485
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -2860,7 +2860,6 @@ public final class ViewRootImpl implements ViewParent,
        final int surfaceGenerationId = mSurface.getGenerationId();

        final boolean isViewVisible = viewVisibility == View.VISIBLE;
        final boolean windowRelayoutWasForced = mForceNextWindowRelayout;
        boolean surfaceSizeChanged = false;
        boolean surfaceCreated = false;
        boolean surfaceDestroyed = false;
@@ -3034,8 +3033,7 @@ public final class ViewRootImpl implements ViewParent,
                    if (isHardwareEnabled()) {
                        mAttachInfo.mThreadedRenderer.destroy();
                    }
                } else if ((surfaceReplaced
                        || surfaceSizeChanged || windowRelayoutWasForced)
                } else if ((surfaceReplaced || surfaceSizeChanged)
                        && mSurfaceHolder == null
                        && mAttachInfo.mThreadedRenderer != null
                        && mSurface.isValid()) {
+6 −6
Original line number Diff line number Diff line
@@ -2137,6 +2137,12 @@
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RecentsAnimationController.java"
    },
    "25888308": {
      "message": "Resize reasons for w=%s:  %s configChanged=%b dragResizingChanged=%b",
      "level": "VERBOSE",
      "group": "WM_DEBUG_RESIZE",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "35398067": {
      "message": "goodToGo(): onAnimationStart, transit=%s, apps=%d, wallpapers=%d, nonApps=%d",
      "level": "DEBUG",
@@ -2797,12 +2803,6 @@
      "group": "WM_DEBUG_FOCUS_LIGHT",
      "at": "com\/android\/server\/wm\/DisplayContent.java"
    },
    "625447638": {
      "message": "Resize reasons for w=%s:  %s configChanged=%b dragResizingChanged=%b reportOrientationChanged=%b",
      "level": "VERBOSE",
      "group": "WM_DEBUG_RESIZE",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "628276090": {
      "message": "Delaying app transition for screen rotation animation to finish",
      "level": "VERBOSE",
+0 −1
Original line number Diff line number Diff line
@@ -1997,7 +1997,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                ProtoLog.v(WM_DEBUG_ORIENTATION, "Set mOrientationChanging of %s", w);
                w.setOrientationChanging(true);
            }
            w.mReportOrientationChanged = true;
        }, true /* traverseTopToBottom */);

        for (int i = mWmService.mRotationWatchers.size() - 1; i >= 0; i--) {
+6 −20
Original line number Diff line number Diff line
@@ -615,11 +615,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
     */
    int mLastVisibleLayoutRotation = -1;

    /**
     * Set when we need to report the orientation change to client to trigger a relayout.
     */
    boolean mReportOrientationChanged;

    /**
     * How long we last kept the screen frozen.
     */
@@ -1541,13 +1536,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                || configChanged
                || insetsChanged
                || dragResizingChanged
                || mReportOrientationChanged
                || shouldSendRedrawForSync()) {
            ProtoLog.v(WM_DEBUG_RESIZE,
                        "Resize reasons for w=%s:  %s configChanged=%b "
                                + "dragResizingChanged=%b reportOrientationChanged=%b",
                        "Resize reasons for w=%s:  %s configChanged=%b dragResizingChanged=%b",
                        this, mWindowFrames.getInsetsChangedInfo(),
                        configChanged, dragResizingChanged, mReportOrientationChanged);
                        configChanged, dragResizingChanged);

            if (insetsChanged) {
                mWindowFrames.setInsetsChanged(false);
@@ -3592,10 +3585,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mAnimatingExit = false;
        ProtoLog.d(WM_DEBUG_ANIM, "Clear animatingExit: reason=destroySurface win=%s", this);

        // Clear the flag so the buffer requested for the next new surface won't be dropped by
        // mistaking the surface size needs to update.
        mReportOrientationChanged = false;

        if (useBLASTSync()) {
            immediatelyNotifyBlastSync();
        }
@@ -3914,12 +3903,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            ProtoLog.i(WM_DEBUG_ORIENTATION, "Resizing %s WITH DRAW PENDING", this);
        }

        final boolean reportOrientation = mReportOrientationChanged;
        // Always reset these states first, so if {@link IWindow#resized} fails, this
        // window won't be added to {@link WindowManagerService#mResizingWindows} and set
        // {@link #mOrientationChanging} to true again by {@link #updateResizingWindowIfNeeded}
        // that may cause WINDOW_FREEZE_TIMEOUT because resizing the client keeps failing.
        mReportOrientationChanged = false;
        mDragResizingChangeReported = true;
        mWindowFrames.clearReportResizeHints();

@@ -3928,7 +3915,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        final boolean syncRedraw = shouldSendRedrawForSync();
        final boolean reportDraw = syncRedraw || drawPending;
        final boolean isDragResizeChanged = isDragResizeChanged();
        final boolean forceRelayout = syncRedraw || reportOrientation || isDragResizeChanged;
        final boolean forceRelayout = syncRedraw || isDragResizeChanged;
        final DisplayContent displayContent = getDisplayContent();
        final boolean alwaysConsumeSystemBars =
                displayContent.getDisplayPolicy().areSystemBarsForcedShownLw();
@@ -3955,7 +3942,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            mClient.resized(mClientWindowFrames, reportDraw, mLastReportedConfiguration,
                    getCompatInsetsState(), forceRelayout, alwaysConsumeSystemBars, displayId,
                    mSyncSeqId, resizeMode);
            if (drawPending && reportOrientation && mOrientationChanging) {
            if (drawPending && mOrientationChanging) {
                mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
                ProtoLog.v(WM_DEBUG_ORIENTATION,
                        "Requested redraw for orientation change: %s", this);
@@ -4380,12 +4367,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
                    + " mDestroying=" + mDestroying
                    + " mRemoved=" + mRemoved);
        }
        if (getOrientationChanging() || mAppFreezing || mReportOrientationChanged) {
        if (getOrientationChanging() || mAppFreezing) {
            pw.println(prefix + "mOrientationChanging=" + mOrientationChanging
                    + " configOrientationChanging="
                    + (getLastReportedConfiguration().orientation != getConfiguration().orientation)
                    + " mAppFreezing=" + mAppFreezing
                    + " mReportOrientationChanged=" + mReportOrientationChanged);
                    + " mAppFreezing=" + mAppFreezing);
        }
        if (mLastFreezeDuration != 0) {
            pw.print(prefix + "mLastFreezeDuration=");