Loading core/java/android/view/inputmethod/InputMethodManager.java +27 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,7 @@ import java.util.Map; import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; /** Loading Loading @@ -3638,6 +3639,32 @@ public final class InputMethodManager { return IInputMethodManagerGlobalInvoker.getInputMethodWindowVisibleHeight(mClient); } /** * {@code true} means that * {@link RemoteInputConnectionImpl#requestCursorUpdatesInternal(int, int, int)} returns * {@code false} when the IME client and the IME run in different displays. */ final AtomicBoolean mRequestCursorUpdateDisplayIdCheck = new AtomicBoolean(true); /** * Controls the display ID mismatch validation in * {@link RemoteInputConnectionImpl#requestCursorUpdatesInternal(int, int, int)}. * * <p>{@link #updateCursorAnchorInfo(View, CursorAnchorInfo)} is not guaranteed to work * correctly when the IME client and the IME run in different displays. This is why * {@link RemoteInputConnectionImpl#requestCursorUpdatesInternal(int, int, int)} returns * {@code false} by default when the display ID does not match. This method allows special apps * to override this behavior when they are sure that it should work.</p> * * <p>By default the validation is enabled.</p> * * @param enabled {@code false} to disable the display ID validation. * @hide */ public void setRequestCursorUpdateDisplayIdCheck(boolean enabled) { mRequestCursorUpdateDisplayIdCheck.set(enabled); } /** * An internal API for {@link android.hardware.display.VirtualDisplay} to report where its * embedded virtual display is placed. Loading core/java/android/view/inputmethod/RemoteInputConnectionImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -1071,7 +1071,8 @@ final class RemoteInputConnectionImpl extends IRemoteInputConnection.Stub { Log.w(TAG, "requestCursorAnchorInfo on inactive InputConnection"); return false; } if (mParentInputMethodManager.getDisplayId() != imeDisplayId if (mParentInputMethodManager.mRequestCursorUpdateDisplayIdCheck.get() && mParentInputMethodManager.getDisplayId() != imeDisplayId && !mParentInputMethodManager.hasVirtualDisplayToScreenMatrix()) { // requestCursorUpdates() is not currently supported across displays. return false; Loading Loading
core/java/android/view/inputmethod/InputMethodManager.java +27 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,7 @@ import java.util.Map; import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; /** Loading Loading @@ -3638,6 +3639,32 @@ public final class InputMethodManager { return IInputMethodManagerGlobalInvoker.getInputMethodWindowVisibleHeight(mClient); } /** * {@code true} means that * {@link RemoteInputConnectionImpl#requestCursorUpdatesInternal(int, int, int)} returns * {@code false} when the IME client and the IME run in different displays. */ final AtomicBoolean mRequestCursorUpdateDisplayIdCheck = new AtomicBoolean(true); /** * Controls the display ID mismatch validation in * {@link RemoteInputConnectionImpl#requestCursorUpdatesInternal(int, int, int)}. * * <p>{@link #updateCursorAnchorInfo(View, CursorAnchorInfo)} is not guaranteed to work * correctly when the IME client and the IME run in different displays. This is why * {@link RemoteInputConnectionImpl#requestCursorUpdatesInternal(int, int, int)} returns * {@code false} by default when the display ID does not match. This method allows special apps * to override this behavior when they are sure that it should work.</p> * * <p>By default the validation is enabled.</p> * * @param enabled {@code false} to disable the display ID validation. * @hide */ public void setRequestCursorUpdateDisplayIdCheck(boolean enabled) { mRequestCursorUpdateDisplayIdCheck.set(enabled); } /** * An internal API for {@link android.hardware.display.VirtualDisplay} to report where its * embedded virtual display is placed. Loading
core/java/android/view/inputmethod/RemoteInputConnectionImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -1071,7 +1071,8 @@ final class RemoteInputConnectionImpl extends IRemoteInputConnection.Stub { Log.w(TAG, "requestCursorAnchorInfo on inactive InputConnection"); return false; } if (mParentInputMethodManager.getDisplayId() != imeDisplayId if (mParentInputMethodManager.mRequestCursorUpdateDisplayIdCheck.get() && mParentInputMethodManager.getDisplayId() != imeDisplayId && !mParentInputMethodManager.hasVirtualDisplayToScreenMatrix()) { // requestCursorUpdates() is not currently supported across displays. return false; Loading