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

Commit 66763f37 authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Encapsulate mVisibleConnection in IMMS

This is a step in a refactoring and will be superseded
by follow-up commits.

Bug: 205676419
Test: make
Change-Id: Icb98e6e5a0fd517e61e12711a0aaf0a77d52f760
parent 2be64fc4
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -351,12 +351,18 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    @GuardedBy("mMethodMap")
    private int mMethodMapUpdateCount = 0;

    // Used to bring IME service up to visible adjustment while it is being shown.
    final ServiceConnection mVisibleConnection = new ServiceConnection() {
    /**
     * Used to bring IME service up to visible adjustment while it is being shown.
     */
    private ServiceConnection getVisibleConnection() {
        return mVisibleConnection;
    }

    private final ServiceConnection mVisibleConnection = new ServiceConnection() {
        @Override public void onBindingDied(ComponentName name) {
            synchronized (mMethodMap) {
                if (mVisibleBound) {
                    mContext.unbindService(mVisibleConnection);
                    mContext.unbindService(getVisibleConnection());
                    mVisibleBound = false;
                }
            }
@@ -2668,7 +2674,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    @GuardedBy("mMethodMap")
    void unbindCurrentMethodLocked() {
        if (mVisibleBound) {
            mContext.unbindService(mVisibleConnection);
            mContext.unbindService(getVisibleConnection());
            mVisibleBound = false;
        }

@@ -3242,7 +3248,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            mInputShown = true;
            if (hasConnection() && !mVisibleBound) {
                bindCurrentInputMethodServiceLocked(
                        getCurIntent(), mVisibleConnection, IME_VISIBLE_BIND_FLAGS);
                        getCurIntent(), getVisibleConnection(), IME_VISIBLE_BIND_FLAGS);
                mVisibleBound = true;
            }
            res = true;
@@ -3350,7 +3356,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            res = false;
        }
        if (hasConnection() && mVisibleBound) {
            mContext.unbindService(mVisibleConnection);
            mContext.unbindService(getVisibleConnection());
            mVisibleBound = false;
        }
        mInputShown = false;