Merge "Make MotionEvent.getEventTimeNano API public." into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
35943147d2
@@ -51293,10 +51293,12 @@ package android.view {
|
|||||||
method public long getDownTime();
|
method public long getDownTime();
|
||||||
method public int getEdgeFlags();
|
method public int getEdgeFlags();
|
||||||
method public long getEventTime();
|
method public long getEventTime();
|
||||||
|
method public long getEventTimeNanos();
|
||||||
method public int getFlags();
|
method public int getFlags();
|
||||||
method public float getHistoricalAxisValue(int, int);
|
method public float getHistoricalAxisValue(int, int);
|
||||||
method public float getHistoricalAxisValue(int, int, int);
|
method public float getHistoricalAxisValue(int, int, int);
|
||||||
method public long getHistoricalEventTime(int);
|
method public long getHistoricalEventTime(int);
|
||||||
|
method public long getHistoricalEventTimeNanos(int);
|
||||||
method public float getHistoricalOrientation(int);
|
method public float getHistoricalOrientation(int);
|
||||||
method public float getHistoricalOrientation(int, int);
|
method public float getHistoricalOrientation(int, int);
|
||||||
method public void getHistoricalPointerCoords(int, int, android.view.MotionEvent.PointerCoords);
|
method public void getHistoricalPointerCoords(int, int, android.view.MotionEvent.PointerCoords);
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public abstract class InputEvent implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public abstract long getEventTimeNano();
|
public abstract long getEventTimeNanos();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the input event as being canceled.
|
* Marks the input event as being canceled.
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ public final class InputEventConsistencyVerifier {
|
|||||||
|
|
||||||
private static void appendEvent(StringBuilder message, int index,
|
private static void appendEvent(StringBuilder message, int index,
|
||||||
InputEvent event, boolean unhandled) {
|
InputEvent event, boolean unhandled) {
|
||||||
message.append(index).append(": sent at ").append(event.getEventTimeNano());
|
message.append(index).append(": sent at ").append(event.getEventTimeNanos());
|
||||||
message.append(", ");
|
message.append(", ");
|
||||||
if (unhandled) {
|
if (unhandled) {
|
||||||
message.append("(unhandled) ");
|
message.append("(unhandled) ");
|
||||||
|
|||||||
@@ -2711,7 +2711,7 @@ public class KeyEvent extends InputEvent implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final long getEventTimeNano() {
|
public final long getEventTimeNanos() {
|
||||||
return mEventTime;
|
return mEventTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2440,12 +2440,30 @@ public final class MotionEvent extends InputEvent implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@Override
|
@UnsupportedAppUsage(publicAlternatives =
|
||||||
@UnsupportedAppUsage
|
"Use {@link #getEventTimeNanos()} public API instead.",
|
||||||
|
maxTargetSdk = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||||
public final long getEventTimeNano() {
|
public final long getEventTimeNano() {
|
||||||
return nativeGetEventTimeNanos(mNativePtr, HISTORY_CURRENT);
|
return nativeGetEventTimeNanos(mNativePtr, HISTORY_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the time this event occurred,
|
||||||
|
* in the {@link android.os.SystemClock#uptimeMillis} time base but with
|
||||||
|
* nanosecond precision.
|
||||||
|
* <p>
|
||||||
|
* The value is in nanosecond precision but it may not have nanosecond accuracy.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @return Returns the time this event occurred,
|
||||||
|
* in the {@link android.os.SystemClock#uptimeMillis} time base but with
|
||||||
|
* nanosecond precision.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public long getEventTimeNanos() {
|
||||||
|
return nativeGetEventTimeNanos(mNativePtr, HISTORY_CURRENT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent to {@link #getX(int)} for pointer index 0 (regardless of the
|
* Equivalent to {@link #getX(int)} for pointer index 0 (regardless of the
|
||||||
* pointer identifier).
|
* pointer identifier).
|
||||||
@@ -3104,10 +3122,8 @@ public final class MotionEvent extends InputEvent implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @see #getHistorySize
|
* @see #getHistorySize
|
||||||
* @see #getEventTime
|
* @see #getEventTime
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
public final long getHistoricalEventTimeNano(int pos) {
|
public long getHistoricalEventTimeNanos(int pos) {
|
||||||
return nativeGetEventTimeNanos(mNativePtr, pos);
|
return nativeGetEventTimeNanos(mNativePtr, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9171,7 +9171,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
* Represents a pending input event that is waiting in a queue.
|
* Represents a pending input event that is waiting in a queue.
|
||||||
*
|
*
|
||||||
* Input events are processed in serial order by the timestamp specified by
|
* Input events are processed in serial order by the timestamp specified by
|
||||||
* {@link InputEvent#getEventTimeNano()}. In general, the input dispatcher delivers
|
* {@link InputEvent#getEventTimeNanos()}. In general, the input dispatcher delivers
|
||||||
* one input event to the application at a time and waits for the application
|
* one input event to the application at a time and waits for the application
|
||||||
* to finish handling it before delivering the next one.
|
* to finish handling it before delivering the next one.
|
||||||
*
|
*
|
||||||
@@ -9361,7 +9361,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
|
if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
|
||||||
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "deliverInputEvent src=0x"
|
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "deliverInputEvent src=0x"
|
||||||
+ Integer.toHexString(q.mEvent.getSource()) + " eventTimeNano="
|
+ Integer.toHexString(q.mEvent.getSource()) + " eventTimeNano="
|
||||||
+ q.mEvent.getEventTimeNano() + " id=0x"
|
+ q.mEvent.getEventTimeNanos() + " id=0x"
|
||||||
+ Integer.toHexString(q.mEvent.getId()));
|
+ Integer.toHexString(q.mEvent.getId()));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -81,19 +81,19 @@ class ProximityClassifier extends FalsingClassifier {
|
|||||||
int action = motionEvent.getActionMasked();
|
int action = motionEvent.getActionMasked();
|
||||||
|
|
||||||
if (action == MotionEvent.ACTION_DOWN) {
|
if (action == MotionEvent.ACTION_DOWN) {
|
||||||
mGestureStartTimeNs = motionEvent.getEventTimeNano();
|
mGestureStartTimeNs = motionEvent.getEventTimeNanos();
|
||||||
if (mPrevNearTimeNs > 0) {
|
if (mPrevNearTimeNs > 0) {
|
||||||
// We only care about if the proximity sensor is triggered while a move event is
|
// We only care about if the proximity sensor is triggered while a move event is
|
||||||
// happening.
|
// happening.
|
||||||
mPrevNearTimeNs = motionEvent.getEventTimeNano();
|
mPrevNearTimeNs = motionEvent.getEventTimeNanos();
|
||||||
}
|
}
|
||||||
logDebug("Gesture start time: " + mGestureStartTimeNs);
|
logDebug("Gesture start time: " + mGestureStartTimeNs);
|
||||||
mNearDurationNs = 0;
|
mNearDurationNs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
|
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
|
||||||
update(mNear, motionEvent.getEventTimeNano());
|
update(mNear, motionEvent.getEventTimeNanos());
|
||||||
long duration = motionEvent.getEventTimeNano() - mGestureStartTimeNs;
|
long duration = motionEvent.getEventTimeNanos() - mGestureStartTimeNs;
|
||||||
|
|
||||||
logDebug("Gesture duration, Proximity duration: " + duration + ", " + mNearDurationNs);
|
logDebug("Gesture duration, Proximity duration: " + duration + ", " + mNearDurationNs);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user