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

Commit e481d33c authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Parcel mCharacters in KeyEvent

Currently, the mCharacters field gets lost via IPC because it is not
written to Parcel during serialization. Add this field to the parcel.

The ACTION_MULTIPLE with KEYCODE_UNKNOWN signals usage of mCharacters.
But the mCharacters field isn't really used by the system.
So, deprecate this field.

Also deprecate ACTION_MULTIPLE, which doesn't really get used.

Bug: 111386868
Test: atest cts.KeyEventTest
Change-Id: Ie01b796a10f8b2dcc2bcfa15f71b17a7e917faa7
parent 1ff73729
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46498,7 +46498,7 @@ package android.view {
    method public final deprecated boolean dispatch(android.view.KeyEvent.Callback);
    method public final boolean dispatch(android.view.KeyEvent.Callback, android.view.KeyEvent.DispatcherState, java.lang.Object);
    method public final int getAction();
    method public final java.lang.String getCharacters();
    method public final deprecated java.lang.String getCharacters();
    method public static int getDeadChar(int, int);
    method public final int getDeviceId();
    method public char getDisplayLabel();
@@ -46547,7 +46547,7 @@ package android.view {
    method public final void startTracking();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACTION_DOWN = 0; // 0x0
    field public static final int ACTION_MULTIPLE = 2; // 0x2
    field public static final deprecated int ACTION_MULTIPLE = 2; // 0x2
    field public static final int ACTION_UP = 1; // 0x1
    field public static final android.os.Parcelable.Creator<android.view.KeyEvent> CREATOR;
    field public static final int FLAG_CANCELED = 32; // 0x20
+7 −0
Original line number Diff line number Diff line
@@ -890,6 +890,7 @@ public class KeyEvent extends InputEvent implements Parcelable {
     */
    public static final int ACTION_UP               = 1;
    /**
     * @deprecated No longer used by the input system.
     * {@link #getAction} value: multiple duplicate key events have
     * occurred in a row, or a complex string is being delivered.  If the
     * key code is not {#link {@link #KEYCODE_UNKNOWN} then the
@@ -898,6 +899,7 @@ public class KeyEvent extends InputEvent implements Parcelable {
     * Otherwise, if the key code is {@link #KEYCODE_UNKNOWN}, then
     * this is a sequence of characters as returned by {@link #getCharacters}.
     */
    @Deprecated
    public static final int ACTION_MULTIPLE         = 2;

    /**
@@ -2474,7 +2476,10 @@ public class KeyEvent extends InputEvent implements Parcelable {
     *
     * @return Returns a String of 1 or more characters associated with
     * the event.
     *
     * @deprecated no longer used by the input system.
     */
    @Deprecated
    public final String getCharacters() {
        return mCharacters;
    }
@@ -3032,6 +3037,7 @@ public class KeyEvent extends InputEvent implements Parcelable {
        mFlags = in.readInt();
        mDownTime = in.readLong();
        mEventTime = in.readLong();
        mCharacters = in.readString();
    }

    @Override
@@ -3049,5 +3055,6 @@ public class KeyEvent extends InputEvent implements Parcelable {
        out.writeInt(mFlags);
        out.writeLong(mDownTime);
        out.writeLong(mEventTime);
        out.writeString(mCharacters);
    }
}