Modify MSIME sample to use setActive()
MSIME sample can now set connection active/inactive. Bug: 128751901 Test: Manually verified using steps in bug. Change-Id: I77bf8c844838f32888004611975cfa316255961b
This commit is contained in:
@@ -152,8 +152,11 @@ final class ClientCallbackImpl implements MultiClientInputMethodServiceDelegate.
|
||||
mDelegate.reportImeWindowTarget(
|
||||
mClientId, targetWindowHandle, window.getWindow().getAttributes().token);
|
||||
}
|
||||
|
||||
if (inputConnection == null || editorInfo == null) {
|
||||
// deactivate previous client.
|
||||
if (MultiClientInputMethod.sLastClientId != mClientId) {
|
||||
mDelegate.setActive(MultiClientInputMethod.sLastClientId, false /* active */);
|
||||
}
|
||||
// Dummy InputConnection case.
|
||||
if (window.getClientId() == mClientId) {
|
||||
// Special hack for temporary focus changes (e.g. notification shade).
|
||||
@@ -163,6 +166,9 @@ final class ClientCallbackImpl implements MultiClientInputMethodServiceDelegate.
|
||||
window.onDummyStartInput(mClientId, targetWindowHandle);
|
||||
}
|
||||
} else {
|
||||
if (MultiClientInputMethod.sLastClientId != mClientId) {
|
||||
mDelegate.setActive(mClientId, true /* active */);
|
||||
}
|
||||
window.onStartInput(mClientId, targetWindowHandle, inputConnection);
|
||||
}
|
||||
|
||||
@@ -184,6 +190,7 @@ final class ClientCallbackImpl implements MultiClientInputMethodServiceDelegate.
|
||||
window.hide();
|
||||
break;
|
||||
}
|
||||
MultiClientInputMethod.sLastClientId = mClientId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.util.Log;
|
||||
public final class MultiClientInputMethod extends Service {
|
||||
private static final String TAG = "MultiClientInputMethod";
|
||||
private static final boolean DEBUG = false;
|
||||
static int sLastClientId = MultiClientInputMethodServiceDelegate.INVALID_CLIENT_ID;
|
||||
|
||||
SoftInputWindowManager mSoftInputWindowManager;
|
||||
MultiClientInputMethodServiceDelegate mDelegate;
|
||||
|
||||
Reference in New Issue
Block a user