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

Commit 25038e1d authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Extract and move unbinding visibly to controller

This also slightly reduces coupling between IMMS and the controller.

Bug: 205676419
Test: make
Change-Id: I8731910185c6f76a91a4b43e827ffe371db86674
parent 9fdc4569
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ final class InputMethodBindingController {
    }

    /**
     * Indicates whether {@link #getVisibleConnection} is currently in use.
     * Indicates whether {@link #mVisibleConnection} is currently in use.
     */
    boolean isVisibleBound() {
        return mVisibleBound;
@@ -253,11 +253,6 @@ final class InputMethodBindingController {
    /**
     * Used to bring IME service up to visible adjustment while it is being shown.
     */
    @NonNull
    ServiceConnection getVisibleConnection() {
        return mVisibleConnection;
    }

    private final ServiceConnection mVisibleConnection = new ServiceConnection() {
        @Override public void onBindingDied(ComponentName name) {
            synchronized (mMethodMap) {
@@ -513,4 +508,14 @@ final class InputMethodBindingController {
            }
        }
    }

    /**
     * Remove the binding needed for the IME to be shown.
     */
    @GuardedBy("mMethodMap")
    void setCurrentMethodNotVisibleLocked() {
        if (mVisibleBound) {
            unbindVisibleConnectionLocked();
        }
    }
}
+3 −12
Original line number Diff line number Diff line
@@ -311,14 +311,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    @GuardedBy("mMethodMap")
    private int mMethodMapUpdateCount = 0;

    /**
     * Indicates whether {@link InputMethodBindingController#getVisibleConnection} is currently
     * in use.
     */
    private boolean isVisibleBound() {
        return mBindingController.isVisibleBound();
    }

    // Ongoing notification
    private NotificationManager mNotificationManager;
    KeyguardManager mKeyguardManager;
@@ -3143,9 +3135,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        } else {
            res = false;
        }
        if (hasConnection() && isVisibleBound()) {
            mBindingController.unbindVisibleConnectionLocked();
        }
        mBindingController.setCurrentMethodNotVisibleLocked();
        mInputShown = false;
        mShowRequested = false;
        mShowExplicitlyRequested = false;
@@ -5091,7 +5081,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                    + " client=" + mCurFocusedWindowClient);
            focusedWindowClient = mCurFocusedWindowClient;
            p.println("  mCurId=" + getCurId() + " mHaveConnection=" + hasConnection()
                    + " mBoundToMethod=" + mBoundToMethod + " mVisibleBound=" + isVisibleBound());
                    + " mBoundToMethod=" + mBoundToMethod + " mVisibleBound="
                    + mBindingController.isVisibleBound());
            p.println("  mCurToken=" + getCurToken());
            p.println("  mCurTokenDisplayId=" + mCurTokenDisplayId);
            p.println("  mCurHostInputToken=" + mCurHostInputToken);