Reduce binding controller coupling to IMMS
This CL extracts direct interactions with accessor methods Bug: 205676419 Test: make Change-Id: If31a2ed79eea0113030ff7f0e2f14195ab57054a
This commit is contained in:
@@ -49,7 +49,6 @@ import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.inputmethod.InputBindResult;
|
||||
import com.android.internal.inputmethod.UnbindReason;
|
||||
import com.android.internal.view.IInputMethod;
|
||||
import com.android.server.inputmethod.InputMethodManagerService.ClientState;
|
||||
import com.android.server.wm.WindowManagerInternal;
|
||||
|
||||
/**
|
||||
@@ -302,11 +301,7 @@ final class InputMethodBindingController {
|
||||
mMethodMap.get(mSelectedMethodId).getConfigChanges(),
|
||||
mCurMethod, mCurToken));
|
||||
mService.scheduleNotifyImeUidToAudioService(mCurMethodUid);
|
||||
ClientState curClient = mService.getCurClient();
|
||||
if (curClient != null) {
|
||||
mService.clearClientSessionLocked(curClient);
|
||||
mService.requestClientSessionLocked(curClient);
|
||||
}
|
||||
mService.reRequestCurrentClientSessionLocked();
|
||||
}
|
||||
}
|
||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||
@@ -344,12 +339,11 @@ final class InputMethodBindingController {
|
||||
}
|
||||
if (mCurMethod != null && mCurIntent != null
|
||||
&& name.equals(mCurIntent.getComponent())) {
|
||||
mService.clearCurMethodLocked();
|
||||
// We consider this to be a new bind attempt, since the system
|
||||
// should now try to restart the service for us.
|
||||
mLastBindTime = SystemClock.uptimeMillis();
|
||||
mService.setShowRequested(mService.isInputShown());
|
||||
mService.setInputShown(false);
|
||||
mService.clearCurMethodLocked();
|
||||
mService.clearInputShowRequestLocked();
|
||||
mService.unbindCurrentClientLocked(UnbindReason.DISCONNECT_IME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,14 +455,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
*/
|
||||
boolean mImeHiddenByDisplayPolicy;
|
||||
|
||||
ClientState getCurClient() {
|
||||
return mCurClient;
|
||||
}
|
||||
|
||||
void setCurClient(ClientState curClient) {
|
||||
mCurClient = curClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* The client that is currently bound to an input method.
|
||||
*/
|
||||
@@ -536,14 +528,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
return mBindingController.hasConnection();
|
||||
}
|
||||
|
||||
boolean isShowRequested() {
|
||||
return mShowRequested;
|
||||
}
|
||||
|
||||
void setShowRequested(boolean showRequested) {
|
||||
mShowRequested = showRequested;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the client has asked for the input method to be shown.
|
||||
*/
|
||||
@@ -559,14 +543,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
*/
|
||||
boolean mShowForced;
|
||||
|
||||
boolean isInputShown() {
|
||||
return mInputShown;
|
||||
}
|
||||
|
||||
void setInputShown(boolean inputShown) {
|
||||
mInputShown = inputShown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if we last told the input method to show itself.
|
||||
*/
|
||||
@@ -2278,6 +2254,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("mMethodMap")
|
||||
void clearInputShowRequestLocked() {
|
||||
mShowRequested = mInputShown;
|
||||
mInputShown = false;
|
||||
}
|
||||
|
||||
@GuardedBy("mMethodMap")
|
||||
private int getImeShowFlagsLocked() {
|
||||
int flags = 0;
|
||||
@@ -2561,6 +2543,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
unbindCurrentClientLocked(unbindClientReason);
|
||||
}
|
||||
|
||||
@GuardedBy("mMethodMap")
|
||||
void reRequestCurrentClientSessionLocked() {
|
||||
if (mCurClient != null) {
|
||||
clearClientSessionLocked(mCurClient);
|
||||
requestClientSessionLocked(mCurClient);
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("mMethodMap")
|
||||
void requestClientSessionLocked(ClientState cs) {
|
||||
if (!cs.sessionRequested) {
|
||||
|
||||
Reference in New Issue
Block a user