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

Commit 7c984faf authored by Bart Sears's avatar Bart Sears
Browse files

Revert "Update the server visibility before layout"

Revert submission 34124765-onprelayout-servervisibility

Reason for revert: b/427117834

Bug: b/427117834

Reverted changes: /q/submissionid:34124765-onprelayout-servervisibility

Change-Id: I19426afc4e5267767bda42108b8a7ae473236db6
parent 017b6b94
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ public class ImePerfTest extends ImePerfTestBase
            "IMMS.applyImeVisibility",
            "applyPostLayoutPolicy",
            "applyWindowSurfaceChanges",
            "ISC.onPreLayout",
            "ISC.onPostLayout"
    };

+0 −2
Original line number Diff line number Diff line
@@ -5082,8 +5082,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            setLayoutNeeded();
        }

        mInsetsStateController.onPreLayout();

        // Perform a layout, if needed.
        performLayout(true /* initial */, false /* updateInputWindows */);
        pendingLayoutChanges = 0;
+6 −21
Original line number Diff line number Diff line
@@ -70,12 +70,6 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
     */
    private boolean mServerVisible;

    /**
     * The server visibility of the source provider's window before the latest
     * {@link #onPreLayout} call.
     */
    private boolean mServerVisiblePreLayout;

    /**
     * When the IME is not ready, it has givenInsetsPending. However, this could happen again,
     * after it became serverVisible. This flag indicates is used to determine if it is
@@ -97,17 +91,12 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
    }

    @Override
    void onPreLayout() {
        mServerVisiblePreLayout = mServerVisible;
        super.onPreLayout();
    void onPostLayout() {
        boolean wasServerVisible = mServerVisible;
        super.onPostLayout();

        mLastDrawn = mWin != null && mWin.isDrawn();
    }

    @Override
    boolean onPostLayout() {
        final boolean controlDispatched = super.onPostLayout();
        final boolean givenInsetsPending = mWin != null && mWin.mGivenInsetsPending;
        mLastDrawn = mWin != null && mWin.isDrawn();

        // isLeashReadyForDispatching (used to dispatch the leash of the control) is
        // depending on mGivenInsetsReady. Therefore, triggering notifyControlChanged here
@@ -120,12 +109,9 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
            mGivenInsetsReady = true;
            ImeTracker.forLogging().onProgress(mStatsToken,
                    ImeTracker.PHASE_WM_POST_LAYOUT_NOTIFY_CONTROLS_CHANGED);
            if (!controlDispatched) {
            mStateController.notifyControlChanged(mControlTarget, this);
            }
            setImeShowing(true);
            return true;
        } else if (mServerVisiblePreLayout && isServerVisible() && mGivenInsetsReady
        } else if (wasServerVisible && isServerVisible() && mGivenInsetsReady
                && givenInsetsPending) {
            // If the server visibility didn't change (still visible), and mGivenInsetsReady
            // is set, we won't call into notifyControlChanged. Therefore, we can reset the
@@ -141,7 +127,6 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
                    mControlTarget);
            setImeShowing(false);
        }
        return controlDispatched;
    }

    @Nullable
+9 −22
Original line number Diff line number Diff line
@@ -366,41 +366,28 @@ class InsetsSourceProvider {
    }

    /**
     * Called before a layout pass will occur.
     * Called when a layout pass has occurred.
     */
    void onPreLayout() {
    void onPostLayout() {
        if (mWin == null) {
            return;
        }
        setServerVisible(isSurfaceVisible());
    }
        final boolean isServerVisible = isSurfaceVisible();

    /**
     * Called after a layout pass has occurred.
     *
     * @return {@code true} if {@link InsetsStateController#notifyControlChanged} was called or
     * was scheduled to be called within this method, else {@code false}.
     */
    boolean onPostLayout() {
        if (mWin == null) {
            return false;
        }
        final boolean serverVisibleChanged = mServerVisible != isServerVisible;
        setServerVisible(isServerVisible);
        if (mControl != null && mControlTarget != null) {
            final boolean positionChanged = updateInsetsControlPosition(mWin);
            if (positionChanged || mHasPendingPosition) {
                return true;
            }
            if (!(positionChanged || mHasPendingPosition)
                    // The insets hint would be updated while changing the position. Here updates it
            // for the possible change of the bounds.
            if (updateInsetsHint(mControl)) {
                    // for the possible change of the bounds or the server visibility.
                    && (updateInsetsHint(mControl) || serverVisibleChanged)) {
                // Only call notifyControlChanged here when the position hasn't been or won't be
                // changed. Otherwise, it has been called or scheduled to be called during
                // updateInsetsControlPosition.
                mStateController.notifyControlChanged(mControlTarget, this);
                return true;
            }
        }
        return false;
    }

    /**
+1 −12
Original line number Diff line number Diff line
@@ -188,18 +188,7 @@ class InsetsStateController {
    }

    /**
     * Called before a layout pass will occur.
     */
    void onPreLayout() {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "ISC.onPreLayout");
        for (int i = mProviders.size() - 1; i >= 0; i--) {
            mProviders.valueAt(i).onPreLayout();
        }
        Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
    }

    /**
     * Called after a layout pass has occurred.
     * Called when a layout pass has occurred.
     */
    void onPostLayout() {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "ISC.onPostLayout");
Loading