Move more encapsulated IMMS members

Bug: 205676419
Test: make
Change-Id: I005761b1b1aa909c2abe726999be138e3a667510
This commit is contained in:
Nikolas Havrikov
2021-11-11 10:54:41 +01:00
parent d739b3cdb3
commit e82e9f7297
2 changed files with 33 additions and 10 deletions

View File

@@ -23,9 +23,12 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.Process;
import android.util.ArrayMap;
import android.view.inputmethod.InputMethodInfo;
import com.android.internal.view.IInputMethod;
/**
* A controller managing the state of the input method binding.
*/
@@ -42,6 +45,8 @@ final class InputMethodBindingController {
@Nullable private String mCurId;
@Nullable private String mSelectedMethodId;
@Nullable private Intent mCurIntent;
@Nullable private IInputMethod mCurMethod;
private int mCurMethodUid = Process.INVALID_UID;
private IBinder mCurToken;
private int mCurSeq;
private boolean mVisibleBound;
@@ -159,6 +164,30 @@ final class InputMethodBindingController {
}
}
/**
* If non-null, this is the input method service we are currently connected
* to.
*/
@Nullable
IInputMethod getCurMethod() {
return mCurMethod;
}
void setCurMethod(@Nullable IInputMethod curMethod) {
mCurMethod = curMethod;
}
/**
* If not {@link Process#INVALID_UID}, then the UID of {@link #getCurIntent()}.
*/
int getCurMethodUid() {
return mCurMethodUid;
}
void setCurMethodUid(int curMethodUid) {
mCurMethodUid = curMethodUid;
}
/**
* Indicates whether {@link #getVisibleConnection} is currently in use.
*/

View File

@@ -661,30 +661,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
*/
@Nullable
private IInputMethod getCurMethod() {
return mCurMethod;
return mBindingController.getCurMethod();
}
private void setCurMethod(@Nullable IInputMethod curMethod) {
mCurMethod = curMethod;
mBindingController.setCurMethod(curMethod);
}
@Nullable
private IInputMethod mCurMethod;
/**
* If not {@link Process#INVALID_UID}, then the UID of {@link #getCurIntent()}.
*/
private int getCurMethodUid() {
return mCurMethodUid;
return mBindingController.getCurMethodUid();
}
private void setCurMethodUid(int curMethodUid) {
mCurMethodUid = curMethodUid;
mBindingController.setCurMethodUid(curMethodUid);
}
private int mCurMethodUid = Process.INVALID_UID;
/**
* Time that we last initiated a bind to the input method, to determine
* if we should try to disconnect and reconnect to it.