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

Commit 7acd878f authored by Antonio Kantek's avatar Antonio Kantek
Browse files

Rename hasController by hasMainController

Fix: 289903759
Test: atest FrameworksInputMethodSystemServerTests:com.android.server.inputmethod.InputMethodBindingControllerTest
Change-Id: I595508b50e695fa637c50d3e32fe4862b9f45a2f
parent c6ed871e
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();