Extract unbinding visible IME connection
Bug: 205676419 Test: make Change-Id: I436095d4f2858c67aeed6296c9f70e253798f4b6
This commit is contained in:
@@ -269,8 +269,7 @@ final class InputMethodBindingController {
|
||||
@Override public void onBindingDied(ComponentName name) {
|
||||
synchronized (mMethodMap) {
|
||||
if (mVisibleBound) {
|
||||
mContext.unbindService(mVisibleConnection);
|
||||
mVisibleBound = false;
|
||||
unbindVisibleConnectionLocked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -368,8 +367,7 @@ final class InputMethodBindingController {
|
||||
@GuardedBy("mMethodMap")
|
||||
void unbindCurrentMethodLocked() {
|
||||
if (mVisibleBound) {
|
||||
mContext.unbindService(mVisibleConnection);
|
||||
mVisibleBound = false;
|
||||
unbindVisibleConnectionLocked();
|
||||
}
|
||||
|
||||
if (mHasConnection) {
|
||||
@@ -385,6 +383,13 @@ final class InputMethodBindingController {
|
||||
mService.clearCurMethodLocked();
|
||||
}
|
||||
|
||||
|
||||
@GuardedBy("mMethodMap")
|
||||
void unbindVisibleConnectionLocked() {
|
||||
mContext.unbindService(mVisibleConnection);
|
||||
mVisibleBound = false;
|
||||
}
|
||||
|
||||
@GuardedBy("mMethodMap")
|
||||
private boolean bindCurrentInputMethodServiceLocked(ServiceConnection conn, int flags) {
|
||||
if (mCurIntent == null || conn == null) {
|
||||
|
||||
@@ -313,23 +313,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
private int mMethodMapUpdateCount = 0;
|
||||
|
||||
/**
|
||||
* Indicates whether {@link #getVisibleConnection} is currently in use.
|
||||
* Indicates whether {@link InputMethodBindingController#getVisibleConnection} is currently
|
||||
* in use.
|
||||
*/
|
||||
private boolean isVisibleBound() {
|
||||
return mBindingController.isVisibleBound();
|
||||
}
|
||||
|
||||
private void setVisibleBound(boolean visibleBound) {
|
||||
mBindingController.setVisibleBound(visibleBound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to bring IME service up to visible adjustment while it is being shown.
|
||||
*/
|
||||
private ServiceConnection getVisibleConnection() {
|
||||
return mBindingController.getVisibleConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to bind the IME while it is not currently being shown.
|
||||
*/
|
||||
@@ -3254,8 +3244,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
res = false;
|
||||
}
|
||||
if (hasConnection() && isVisibleBound()) {
|
||||
mContext.unbindService(getVisibleConnection());
|
||||
setVisibleBound(false);
|
||||
mBindingController.unbindVisibleConnectionLocked();
|
||||
}
|
||||
mInputShown = false;
|
||||
mShowRequested = false;
|
||||
|
||||
Reference in New Issue
Block a user