Let IC#requestCursorUpdates() fail for cross-display connections
Since Android Q [1], it is intentional that when an IME client app is
running on a (virtual) display where IME should not be hosted, IME
will be hosted in the default display instead. This means that
cross-display App/IME interaction is an expected scenario now.
The problem is that CursorAnchorInfo API, which I introduced in
Android L [2], no longer works as intended in such a cross-display
scenario, because screen coordinates make sense only within the same
display.
The ultimate fallback strategy for this problem is forcing
InputConnection#requestCursorUpdates()
to always return false for such a cross-display scenario, which is
exactly what this CL does.
In subsequent CLs, we aim to introduce a special handling logic for
ActivityView, where the system may be able to keep maintaining
sufficient display hierarchy information so that
CursorAnchorInfo#getMatrix() can be automatically adjusted before it
is passed to the IME.
[1]: Iedd71e4ddf4983f90b02dd72e471e7fa8e838fbf
ef1965bd6d
[2]: I61dec2f8fa671ba891da1d4af08975750e3acb04
1c7e66c97ce0a5d54e03abdee2f36fdce55944e6
Bug: 115693908
Fix: 131368625
Test: atest MultiDisplaySystemDecorationTests#testCrossDisplayBasicImeOperations
Change-Id: Ie2f7a5117cff3a13ad5c5806fd4b3abef7569549
This commit is contained in:
@@ -2037,6 +2037,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
if (mCurSeq <= 0) mCurSeq = 1;
|
||||
mCurClient = cs;
|
||||
mCurInputContext = inputContext;
|
||||
if (cs.selfReportedDisplayId != displayIdToShowIme) {
|
||||
// CursorAnchorInfo API does not work as-is for cross-display scenario. Pretend that
|
||||
// InputConnection#requestCursorUpdates() is not implemented in the application so that
|
||||
// IMEs will always receive false from this API.
|
||||
missingMethods |= MissingMethodFlags.REQUEST_CURSOR_UPDATES;
|
||||
}
|
||||
mCurInputContextMissingMethods = missingMethods;
|
||||
mCurAttribute = attribute;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user