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

Commit ad0a4a22 authored by Tarandeep Singh's avatar Tarandeep Singh Committed by Taran Singh
Browse files

DO NOT MERGE: Freeup lock when IME is set inactive and unbound

Any pending windowGainedFocus future should be cancelled when IME is
switched/unbound.
Additinally, startInputInner() inside synchronized block blocked
WINDOW_FOCUS_GAIN from executing. Its fine to remove synchronization
here since startInputInner() already has relevant synchronized blocks.

Change-Id: I98cb044d8cbfb80480312a3923f168aefa9b7e7d
Fix: 144103599
Bug: 139806621
Test: Manually using the steps in bug.
(cherry picked from commit 322ee9bf)
parent 659f477f
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -645,6 +645,7 @@ public final class InputMethodManager {
                            } catch (RemoteException e) {
                            }
                        }
                    }
                    // Check focus again in case that "onWindowFocus" is called before
                    // handling this message.
                    if (mServedView != null && canStartInput(mServedView)) {
@@ -654,7 +655,6 @@ public final class InputMethodManager {
                            startInputInner(reason, null, 0, 0, 0);
                        }
                    }
                    }
                    return;
                }
                case MSG_SEND_INPUT_EVENT: {
@@ -1215,6 +1215,10 @@ public final class InputMethodManager {
     */
    void clearBindingLocked() {
        if (DEBUG) Log.v(TAG, "Clearing binding!");
        if (mWindowFocusGainFuture != null) {
            mWindowFocusGainFuture.cancel(false /* mayInterruptIfRunning */);
            mWindowFocusGainFuture = null;
        }
        clearConnectionLocked();
        setInputChannelLocked(null);
        mBindSequence = -1;