Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1728879d authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Reject request when any unknown flag is speficied" into lmp-dev

parents 73a82178 72d35fa8
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -191,6 +191,20 @@ public class EditableInputConnection extends BaseInputConnection {
    public boolean requestUpdateCursorAnchorInfo(int cursorUpdateMode) {
        if (DEBUG) Log.v(TAG, "requestUpdateCursorAnchorInfo " + cursorUpdateMode);

        // It is possible that any other bit is used as a valid flag in a future release.
        // We should reject the entire request in such a case.
        final int KNOWN_FLAGS_MASK = InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_IMMEDIATE |
                InputConnection.REQUEST_UPDATE_CURSOR_ANCHOR_INFO_MONITOR;
        final int unknownFlags = cursorUpdateMode & ~KNOWN_FLAGS_MASK;
        if (unknownFlags != 0) {
            if (DEBUG) {
                Log.d(TAG, "Rejecting requestUpdateCursorAnchorInfo due to unknown flags." +
                        " cursorUpdateMode=" + cursorUpdateMode +
                        " unknownFlags=" + unknownFlags);
            }
            return false;
        }

        if (mIMM == null) {
            // In this case, TYPE_CURSOR_ANCHOR_INFO is not handled.
            // TODO: Return some notification code rather than false to indicate method that