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

Commit a4736e35 authored by Antonio Kantek's avatar Antonio Kantek Committed by Android (Google) Code Review
Browse files

Merge "Rename hasController by hasMainController" into main

parents b03c0d4a 7acd878f
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ final class InputMethodBindingController {
    @NonNull private final WindowManagerInternal mWindowManagerInternal;

    @GuardedBy("ImfLock.class") private long mLastBindTime;
    @GuardedBy("ImfLock.class") private boolean mHasConnection;
    @GuardedBy("ImfLock.class") private boolean mHasMainConnection;
    @GuardedBy("ImfLock.class") @Nullable private String mCurId;
    @GuardedBy("ImfLock.class") @Nullable private String mSelectedMethodId;
    @GuardedBy("ImfLock.class") @Nullable private Intent mCurIntent;
@@ -137,8 +137,8 @@ final class InputMethodBindingController {
     * a service (whether or not we have gotten its IBinder back yet).
     */
    @GuardedBy("ImfLock.class")
    boolean hasConnection() {
        return mHasConnection;
    boolean hasMainConnection() {
        return mHasMainConnection;
    }

    /**
@@ -369,7 +369,7 @@ final class InputMethodBindingController {
            unbindVisibleConnection();
        }

        if (hasConnection()) {
        if (hasMainConnection()) {
            unbindMainConnection();
        }

@@ -464,7 +464,7 @@ final class InputMethodBindingController {
    @GuardedBy("ImfLock.class")
    private void unbindMainConnection() {
        mContext.unbindService(mMainConnection);
        mHasConnection = false;
        mHasMainConnection = false;
    }

    @GuardedBy("ImfLock.class")
@@ -485,8 +485,9 @@ final class InputMethodBindingController {

    @GuardedBy("ImfLock.class")
    private boolean bindCurrentInputMethodServiceMainConnection() {
        mHasConnection = bindCurrentInputMethodService(mMainConnection, mImeConnectionBindFlags);
        return mHasConnection;
        mHasMainConnection = bindCurrentInputMethodService(mMainConnection,
                mImeConnectionBindFlags);
        return mHasMainConnection;
    }

    /**
@@ -499,7 +500,7 @@ final class InputMethodBindingController {
    void setCurrentMethodVisible() {
        if (mCurMethod != null) {
            if (DEBUG) Slog.d(TAG, "setCurrentMethodVisible: mCurToken=" + mCurToken);
            if (hasConnection() && !isVisibleBound()) {
            if (hasMainConnection() && !isVisibleBound()) {
                mVisibleBound = bindCurrentInputMethodService(mVisibleConnection,
                        IME_VISIBLE_BIND_FLAGS);
            }
@@ -507,7 +508,7 @@ final class InputMethodBindingController {
        }

        // No IME is currently connected. Reestablish the main connection.
        if (!hasConnection()) {
        if (!hasMainConnection()) {
            if (DEBUG) {
                Slog.d(TAG, "Cannot show input: no IME bound. Rebinding.");
            }
@@ -528,7 +529,7 @@ final class InputMethodBindingController {
            bindCurrentInputMethodServiceMainConnection();
        } else {
            if (DEBUG) {
                Slog.d(TAG, "Can't show input: connection = " + mHasConnection + ", time = "
                Slog.d(TAG, "Can't show input: connection = " + mHasMainConnection + ", time = "
                        + (TIME_TO_RECONNECT - bindingDuration));
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -603,7 +603,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
     */
    @GuardedBy("ImfLock.class")
    private boolean hasConnectionLocked() {
        return mBindingController.hasConnection();
        return mBindingController.hasMainConnection();
    }

    /** The token tracking the current IME request or {@code null} otherwise. */
+2 −2
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class InputMethodBindingControllerTest extends InputMethodManagerServiceT
        assertThat(result.result).isEqualTo(InputBindResult.ResultCode.SUCCESS_WAITING_IME_BINDING);
        assertThat(result.id).isEqualTo(info.getId());
        synchronized (ImfLock.class) {
            assertThat(mBindingController.hasConnection()).isTrue();
            assertThat(mBindingController.hasMainConnection()).isTrue();
            assertThat(mBindingController.getCurId()).isEqualTo(info.getId());
            assertThat(mBindingController.getCurToken()).isNotNull();
        }
@@ -202,7 +202,7 @@ public class InputMethodBindingControllerTest extends InputMethodManagerServiceT

        synchronized (ImfLock.class) {
            // Unbind both main connection and visible connection
            assertThat(mBindingController.hasConnection()).isFalse();
            assertThat(mBindingController.hasMainConnection()).isFalse();
            assertThat(mBindingController.isVisibleBound()).isFalse();
            verify(mContext, times(2)).unbindService(any(ServiceConnection.class));
            assertThat(mBindingController.getCurToken()).isNull();