Commit f69b5056 authored by Makoto Kato's avatar Makoto Kato
Browse files

Bug 1673681 - Software keyboard show/dimiss shouldn't be reentrant. r=agi, a=RyanVM

Originally, this issue was bug 1283739. But I guess that this might be
regression by bug 1464096.

Actually, reentrant code seems to be broken now, so I make it simple.

Differential Revision: https://phabricator.services.mozilla.com/D97266
parent 04c3acb5
Loading
Loading
Loading
Loading
+40 −46
Original line number Diff line number Diff line
@@ -1569,10 +1569,6 @@ import android.view.inputmethod.EditorInfo;
                    Log.d(LOGTAG, "restartInput(" + reason + ", " + toggleSoftInput + ')');
                }

                if (toggleSoftInput) {
                    mSoftInputReentrancyGuard.incrementAndGet();
                }

                final GeckoSession session = mSession.get();
                if (session != null) {
                    session.getTextInput().getDelegate().restartInput(session, reason);
@@ -1723,14 +1719,9 @@ import android.view.inputmethod.EditorInfo;
        ThreadUtils.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                final int reentrancyGuard = mSoftInputReentrancyGuard.decrementAndGet();
                final boolean isReentrant;
                if (reentrancyGuard < 0) {
                    mSoftInputReentrancyGuard.incrementAndGet();
                    isReentrant = false;
                } else {
                    isReentrant = reentrancyGuard > 0;
                }
                try {
                    final int reentrancyGuard = mSoftInputReentrancyGuard.incrementAndGet();
                    final boolean isReentrant =  reentrancyGuard > 1;

                    // When using Find In Page, we can still receive notifyIMEContext calls due to the
                    // selection changing when highlighting. However in this case we don't want to
@@ -1772,6 +1763,9 @@ import android.view.inputmethod.EditorInfo;
                        session.getEventDispatcher().dispatch("GeckoView:ZoomToInput", bundle);
                    }
                    session.getTextInput().getDelegate().showSoftInput(session);
                } finally {
                    mSoftInputReentrancyGuard.decrementAndGet();
                }
            }
        });
    }