From 713036b6e2a15134f7ab68387c733b2524ce10ab Mon Sep 17 00:00:00 2001 From: Nikolas Havrikov Date: Thu, 11 Nov 2021 18:30:20 +0100 Subject: [PATCH] Move connectedness booleans into controller This slightly changes the semantics of the call sites, and thus warrants a more thorough review. Bug: 205676419 Test: make Change-Id: If494009ad161cd065de28550d241b6a2757ecdb1 --- .../inputmethod/InputMethodBindingController.java | 14 ++++---------- .../inputmethod/InputMethodManagerService.java | 6 ------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java b/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java index be00a16258be7..1fb7eff087afc 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java @@ -144,10 +144,6 @@ final class InputMethodBindingController { return mHasConnection; } - void setHasConnection(boolean hasConnection) { - mHasConnection = hasConnection; - } - /** * Id obtained with {@link InputMethodInfo#getId()} for the input method that we are currently * connected to or in the process of connecting to. @@ -261,10 +257,6 @@ final class InputMethodBindingController { return mVisibleBound; } - void setVisibleBound(boolean visibleBound) { - mVisibleBound = visibleBound; - } - /** * Used to bring IME service up to visible adjustment while it is being shown. */ @@ -405,14 +397,16 @@ final class InputMethodBindingController { @GuardedBy("mMethodMap") boolean bindCurrentInputMethodServiceVisibleConnectionLocked() { - return bindCurrentInputMethodServiceLocked(mVisibleConnection, + mVisibleBound = bindCurrentInputMethodServiceLocked(mVisibleConnection, IME_VISIBLE_BIND_FLAGS); + return mVisibleBound; } @GuardedBy("mMethodMap") boolean bindCurrentInputMethodServiceMainConnectionLocked() { - return bindCurrentInputMethodServiceLocked(mMainConnection, + mHasConnection = bindCurrentInputMethodServiceLocked(mMainConnection, mImeConnectionBindFlags); + return mHasConnection; } diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index c43dc43e35088..d3da4751364ce 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -559,10 +559,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mBindingController.hasConnection(); } - private void setHasConnection(boolean hasConnection) { - mBindingController.setHasConnection(hasConnection); - } - boolean isShowRequested() { return mShowRequested; } @@ -2531,7 +2527,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Binder token = new Binder(); setCurToken(token); setLastBindTime(SystemClock.uptimeMillis()); - setHasConnection(true); setCurId(methodId); mCurTokenDisplayId = displayIdToShowIme; try { @@ -3152,7 +3147,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mInputShown = true; if (hasConnection() && !isVisibleBound()) { mBindingController.bindCurrentInputMethodServiceVisibleConnectionLocked(); - setVisibleBound(true); } res = true; } else {