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

Commit 9ed8c2c1 authored by Felix Stern's avatar Felix Stern Committed by Android (Google) Code Review
Browse files

Merge "Fix flicker after unlocking when IME was showing" into main

parents 2ed42dc6 3246c758
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -212,8 +212,7 @@ public class InsetsSourceControl implements Parcelable {
                && mInitiallyVisible == that.mInitiallyVisible
                && mSurfacePosition.equals(that.mSurfacePosition)
                && mInsetsHint.equals(that.mInsetsHint)
                && mSkipAnimationOnce == that.mSkipAnimationOnce
                && Objects.equals(mImeStatsToken, that.mImeStatsToken);
                && mSkipAnimationOnce == that.mSkipAnimationOnce;
    }

    @Override
+3 −3
Original line number Diff line number Diff line
@@ -1735,9 +1735,9 @@ public class DisplayPolicy {
        }

        // Show IME over the keyguard if the target allows it.
        final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisible()
                && win.mIsImWindow && (imeTarget.canShowWhenLocked()
                        || !imeTarget.canBeHiddenByKeyguard());
        final boolean showImeOverKeyguard =
                imeTarget != null && imeTarget.isOnScreen() && win.mIsImWindow && (
                        imeTarget.canShowWhenLocked() || !imeTarget.canBeHiddenByKeyguard());
        if (showImeOverKeyguard) {
            return false;
        }
+8 −4
Original line number Diff line number Diff line
@@ -100,13 +100,13 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
            // isLeashReadyForDispatching (used to dispatch the leash of the control) is
            // depending on mGivenInsetsReady. Therefore, triggering notifyControlChanged here
            // again, so that the control with leash can be eventually dispatched
            if (!mGivenInsetsReady && mServerVisible && !givenInsetsPending) {
            if (!mGivenInsetsReady && isServerVisible() && !givenInsetsPending) {
                mGivenInsetsReady = true;
                ImeTracker.forLogging().onProgress(mStatsToken,
                        ImeTracker.PHASE_WM_POST_LAYOUT_NOTIFY_CONTROLS_CHANGED);
                mStateController.notifyControlChanged(mControlTarget, this);
                setImeShowing(true);
            } else if (wasServerVisible && mServerVisible && 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
@@ -114,7 +114,7 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
                ImeTracker.forLogging().onCancelled(mStatsToken,
                        ImeTracker.PHASE_WM_POST_LAYOUT_NOTIFY_CONTROLS_CHANGED);
                mStatsToken = null;
            } else if (wasServerVisible && !mServerVisible) {
            } else if (wasServerVisible && !isServerVisible()) {
                setImeShowing(false);
            }
        }
@@ -134,11 +134,15 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
    @Override
    protected boolean isLeashReadyForDispatching() {
        if (android.view.inputmethod.Flags.refactorInsetsController()) {
            // We should only dispatch the leash, if the following conditions are fulfilled:
            // 1. parent isLeashReadyForDispatching, 2. mGivenInsetsReady (means there are no
            // givenInsetsPending), 3. the IME surface is drawn, 4. either the IME is
            // serverVisible (the unfrozen state)
            final WindowState ws =
                    mWindowContainer != null ? mWindowContainer.asWindowState() : null;
            final boolean isDrawn = ws != null && ws.isDrawn();
            return super.isLeashReadyForDispatching()
                    && mServerVisible && isDrawn && mGivenInsetsReady;
                    && isServerVisible() && isDrawn && mGivenInsetsReady;
        } else {
            return super.isLeashReadyForDispatching();
        }
+4 −0
Original line number Diff line number Diff line
@@ -730,6 +730,10 @@ class InsetsSourceProvider {
        return mFakeControlTarget;
    }

    boolean isServerVisible() {
        return mServerVisible;
    }

    boolean isClientVisible() {
        return mClientVisible;
    }