Loading services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +11 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } /** Loading Loading @@ -369,7 +369,7 @@ final class InputMethodBindingController { unbindVisibleConnection(); } if (hasConnection()) { if (hasMainConnection()) { unbindMainConnection(); } Loading Loading @@ -464,7 +464,7 @@ final class InputMethodBindingController { @GuardedBy("ImfLock.class") private void unbindMainConnection() { mContext.unbindService(mMainConnection); mHasConnection = false; mHasMainConnection = false; } @GuardedBy("ImfLock.class") Loading @@ -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; } /** Loading @@ -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); } Loading @@ -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."); } Loading @@ -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)); } } Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -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. */ Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodBindingControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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(); } Loading Loading @@ -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(); Loading Loading
services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +11 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } /** Loading Loading @@ -369,7 +369,7 @@ final class InputMethodBindingController { unbindVisibleConnection(); } if (hasConnection()) { if (hasMainConnection()) { unbindMainConnection(); } Loading Loading @@ -464,7 +464,7 @@ final class InputMethodBindingController { @GuardedBy("ImfLock.class") private void unbindMainConnection() { mContext.unbindService(mMainConnection); mHasConnection = false; mHasMainConnection = false; } @GuardedBy("ImfLock.class") Loading @@ -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; } /** Loading @@ -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); } Loading @@ -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."); } Loading @@ -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)); } } Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -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. */ Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodBindingControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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(); } Loading Loading @@ -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(); Loading