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

Commit 24b5ca6b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add FLAG_IS_ACCESSIBILITY_EVENT to KeyEvent and MotionEvent" into sc-dev

parents 0d5d8794 b42785ef
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2724,12 +2724,12 @@ package android.view {
  public final class InputDevice implements android.os.Parcelable {
    method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void disable();
    method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void enable();
    field public static final int ACCESSIBILITY_DEVICE_ID = -2; // 0xfffffffe
  }

  public class KeyEvent extends android.view.InputEvent implements android.os.Parcelable {
    method public static String actionToString(int);
    method public final void setDisplayId(int);
    field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
    field public static final int LAST_KEYCODE = 288; // 0x120
  }

@@ -2747,6 +2747,7 @@ package android.view {
    method public void setActionButton(int);
    method public void setButtonState(int);
    method public void setDisplayId(int);
    field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
  }

  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) public @interface RemotableViewMethod {
+0 −7
Original line number Diff line number Diff line
@@ -444,13 +444,6 @@ public final class InputDevice implements Parcelable {

    private static final int VIBRATOR_ID_ALL = -1;

    /**
     * The device id of input events generated inside accessibility service.
     * @hide
     */
    @TestApi
    public static final int ACCESSIBILITY_DEVICE_ID = -2;

    public static final @android.annotation.NonNull Parcelable.Creator<InputDevice> CREATOR =
            new Parcelable.Creator<InputDevice>() {
        public InputDevice createFromParcel(Parcel in) {
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.os.IInputConstants.INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT;
import static android.view.Display.INVALID_DISPLAY;

import android.annotation.NonNull;
@@ -1221,6 +1222,14 @@ public class KeyEvent extends InputEvent implements Parcelable {
     */
    public static final int FLAG_FALLBACK = 0x400;

    /**
     * This flag indicates that this event was modified by or generated from an accessibility
     * service. Value = 0x800
     * @hide
     */
    @TestApi
    public static final int FLAG_IS_ACCESSIBILITY_EVENT = INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT;

    /**
     * Signifies that the key is being predispatched.
     * @hide
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.os.IInputConstants.INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT;
import static android.view.Display.DEFAULT_DISPLAY;

import static java.lang.annotation.RetentionPolicy.SOURCE;
@@ -493,6 +494,14 @@ public final class MotionEvent extends InputEvent implements Parcelable {
     */
    public static final int FLAG_NO_FOCUS_CHANGE = 0x40;

    /**
     * This flag indicates that this event was modified by or generated from an accessibility
     * service. Value = 0x800
     * @hide
     */
    @TestApi
    public static final int FLAG_IS_ACCESSIBILITY_EVENT = INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT;

    /**
     * Private flag that indicates when the system has detected that this motion event
     * may be inconsistent with respect to the sequence of previously delivered motion events,
+25 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
@@ -157,4 +158,28 @@ public abstract class VerifiedInputEvent implements Parcelable {
            throw new IllegalArgumentException("Unexpected input event type in parcel.");
        }
    };

    @Override
    public boolean equals(@Nullable Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        @SuppressWarnings("unchecked")
        VerifiedInputEvent that = (VerifiedInputEvent) o;
        return mType == that.mType
                && getDeviceId() == that.getDeviceId()
                && getEventTimeNanos() == that.getEventTimeNanos()
                && getSource() == that.getSource()
                && getDisplayId() == that.getDisplayId();
    }

    @Override
    public int hashCode() {
        int _hash = 1;
        _hash = 31 * _hash + mType;
        _hash = 31 * _hash + getDeviceId();
        _hash = 31 * _hash + Long.hashCode(getEventTimeNanos());
        _hash = 31 * _hash + getSource();
        _hash = 31 * _hash + getDisplayId();
        return _hash;
    }
}
Loading