public abstract class InputEvent extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<InputEvent> |
CREATOR |
protected boolean |
mRecycled |
protected int |
mSeq |
protected static int |
PARCEL_TOKEN_KEY_EVENT |
protected static int |
PARCEL_TOKEN_MOTION_EVENT |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
abstract void |
cancel()
Marks the input event as being canceled.
|
abstract InputEvent |
copy()
Copies the event.
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
InputDevice |
getDevice()
Gets the device that this event came from.
|
abstract int |
getDeviceId()
Gets the id for the device that this event came from.
|
abstract long |
getEventTime()
Retrieve the time this event occurred,
in the
SystemClock.uptimeMillis() time base. |
abstract long |
getEventTimeNano()
Retrieve the time this event occurred,
in the
SystemClock.uptimeMillis() time base but with
nanosecond (instead of millisecond) precision. |
int |
getSequenceNumber()
Gets the unique sequence number of this event.
|
abstract int |
getSource()
Gets the source of the event.
|
boolean |
isFromSource(int source)
Determines whether the event is from the given source.
|
abstract boolean |
isTainted()
Gets a private flag that indicates when the system has detected that this input event
may be inconsistent with respect to the sequence of previously delivered input events,
such as when a key up event is sent but the key was not down or when a pointer
move event is sent but the pointer is not down.
|
protected void |
prepareForReuse()
Reinitializes the event on reuse (after recycling).
|
void |
recycle()
Recycles the event.
|
void |
recycleIfNeededAfterDispatch()
Conditionally recycled the event if it is appropriate to do so after
dispatching the event to an application.
|
abstract void |
setSource(int source)
Modifies the source of the event.
|
abstract void |
setTainted(boolean tainted)
Sets a private flag that indicates when the system has detected that this input event
may be inconsistent with respect to the sequence of previously delivered input events,
such as when a key up event is sent but the key was not down or when a pointer
move event is sent but the pointer is not down.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
writeToParcel
protected static final int PARCEL_TOKEN_MOTION_EVENT
protected static final int PARCEL_TOKEN_KEY_EVENT
protected int mSeq
protected boolean mRecycled
public static final Parcelable.Creator<InputEvent> CREATOR
public abstract int getDeviceId()
InputDevice.getDevice(int)
public final InputDevice getDevice()
public abstract int getSource()
InputDevice.SOURCE_UNKNOWN
if unknown.InputDevice.getSources()
public abstract void setSource(int source)
source
- The new source.public boolean isFromSource(int source)
source
- The input source to check against. This can be a specific device type, such as
InputDevice.SOURCE_TOUCH_NAVIGATION
, or a more generic device class, such as
InputDevice.SOURCE_CLASS_POINTER
.public abstract InputEvent copy()
public void recycle()
KeyEvent
objects to be recycled, although MotionEvent
objects are fine. See KeyEvent.recycle()
for details.public void recycleIfNeededAfterDispatch()
MotionEvent
then it is recycled.
If the event is a KeyEvent
then it is NOT recycled, because applications
expect key events to be immutable so once the event has been dispatched to
the application we can no longer recycle it.protected void prepareForReuse()
public abstract boolean isTainted()
public abstract void setTainted(boolean tainted)
tainted
- True if this event is tainted.public abstract long getEventTime()
SystemClock.uptimeMillis()
time base.SystemClock.uptimeMillis()
time base.public abstract long getEventTimeNano()
SystemClock.uptimeMillis()
time base but with
nanosecond (instead of millisecond) precision.
The value is in nanosecond precision but it may not have nanosecond accuracy.
SystemClock.uptimeMillis()
time base but with
nanosecond (instead of millisecond) precision.public abstract void cancel()
public int getSequenceNumber()
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR