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

Commit 405bc51c authored by Jean Chalard's avatar Jean Chalard
Browse files

Add/refine comments to reflect key event policies

Make clearer how the platform is handling key events following some
unfortunate uses by third party applications. Also highlight the
changes in Jelly Bean default keyboard.

Bug: 6566711
Change-Id: Ibcdaf54c6d629fd0733529bfe2fffc82f555f084
parent c3a5cf9a
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1892,6 +1892,13 @@ public class InputMethodService extends AbstractInputMethodService {
     * {@link KeyEvent#FLAG_KEEP_TOUCH_MODE KeyEvent.FLAG_KEEP_TOUCH_MODE}, so
     * that they don't impact the current touch mode of the UI.
     *
     * <p>Note that it's discouraged to send such key events in normal operation;
     * this is mainly for use with {@link android.text.InputType#TYPE_NULL} type
     * text fields, or for non-rich input methods. A reasonably capable software
     * input method should use the
     * {@link android.view.inputmethod.InputConnection#commitText} family of methods
     * to send text to an application, rather than sending key events.</p>
     *
     * @param keyEventCode The raw key code to send, as defined by
     * {@link KeyEvent}.
     */
@@ -1949,7 +1956,11 @@ public class InputMethodService extends AbstractInputMethodService {
     * {@link InputConnection#commitText InputConnection.commitText()} with
     * the character; some, however, may be handled different.  In particular,
     * the enter character ('\n') will either be delivered as an action code
     * or a raw key event, as appropriate.
     * or a raw key event, as appropriate.  Consider this as a convenience
     * method for IMEs that do not have a full implementation of actions; a
     * fully complying IME will decide of the right action for each event and
     * will likely never call this method except maybe to handle events coming
     * from an actual hardware keyboard.
     * 
     * @param charCode The UTF-16 character code to send.
     */
+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@ import android.widget.TextView;
 * Provides a basic foundation for entering and editing text.
 * Subclasses should override {@link #onKeyDown} and {@link #onKeyUp} to insert
 * characters as keys are pressed.
 * <p></p>
 * As for all implementations of {@link KeyListener}, this class is only concerned
 * with hardware keyboards.  Software input methods have no obligation to trigger
 * the methods in this class.
 */
public abstract class BaseKeyListener extends MetaKeyKeyListener
        implements KeyListener {
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ import android.text.InputType;

/**
 * For entering dates in a text field.
 * <p></p>
 * As for all implementations of {@link KeyListener}, this class is only concerned
 * with hardware keyboards.  Software input methods have no obligation to trigger
 * the methods in this class.
 */
public class DateKeyListener extends NumberKeyListener
{
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ import android.view.KeyEvent;

/**
 * For entering dates and times in the same text field.
 * <p></p>
 * As for all implementations of {@link KeyListener}, this class is only concerned
 * with hardware keyboards.  Software input methods have no obligation to trigger
 * the methods in this class.
 */
public class DateTimeKeyListener extends NumberKeyListener
{
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@ import android.text.Spannable;

/**
 * For dialing-only text entry
 * <p></p>
 * As for all implementations of {@link KeyListener}, this class is only concerned
 * with hardware keyboards.  Software input methods have no obligation to trigger
 * the methods in this class.
 */
public class DialerKeyListener extends NumberKeyListener
{
Loading