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(
|
mDelegate.reportImeWindowTarget(
|
||||||
mClientId, targetWindowHandle, window.getWindow().getAttributes().token);
|
mClientId, targetWindowHandle, window.getWindow().getAttributes().token);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputConnection == null || editorInfo == null) {
|
if (inputConnection == null || editorInfo == null) {
|
||||||
|
// deactivate previous client.
|
||||||
|
if (MultiClientInputMethod.sLastClientId != mClientId) {
|
||||||
|
mDelegate.setActive(MultiClientInputMethod.sLastClientId, false /* active */);
|
||||||
|
}
|
||||||
// Dummy InputConnection case.
|
// Dummy InputConnection case.
|
||||||
if (window.getClientId() == mClientId) {
|
if (window.getClientId() == mClientId) {
|
||||||
// Special hack for temporary focus changes (e.g. notification shade).
|
// Special hack for temporary focus changes (e.g. notification shade).
|
||||||
@@ -163,6 +166,9 @@ final class ClientCallbackImpl implements MultiClientInputMethodServiceDelegate.
|
|||||||
window.onDummyStartInput(mClientId, targetWindowHandle);
|
window.onDummyStartInput(mClientId, targetWindowHandle);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (MultiClientInputMethod.sLastClientId != mClientId) {
|
||||||
|
mDelegate.setActive(mClientId, true /* active */);
|
||||||
|
}
|
||||||
window.onStartInput(mClientId, targetWindowHandle, inputConnection);
|
window.onStartInput(mClientId, targetWindowHandle, inputConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +190,7 @@ final class ClientCallbackImpl implements MultiClientInputMethodServiceDelegate.
|
|||||||
window.hide();
|
window.hide();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
MultiClientInputMethod.sLastClientId = mClientId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.util.Log;
|
|||||||
public final class MultiClientInputMethod extends Service {
|
public final class MultiClientInputMethod extends Service {
|
||||||
private static final String TAG = "MultiClientInputMethod";
|
private static final String TAG = "MultiClientInputMethod";
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
static int sLastClientId = MultiClientInputMethodServiceDelegate.INVALID_CLIENT_ID;
|
||||||
|
|
||||||
SoftInputWindowManager mSoftInputWindowManager;
|
SoftInputWindowManager mSoftInputWindowManager;
|
||||||
MultiClientInputMethodServiceDelegate mDelegate;
|
MultiClientInputMethodServiceDelegate mDelegate;
|
||||||
|
|||||||
Reference in New Issue
Block a user