From 2614bd225f84f7a23e6b30fc6b47bede153e5f4c Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 19 Feb 2015 14:36:50 -0800 Subject: DO NOT MERGE Backport of limited jank-tracking metrics Bug: 19821830 Cherry-pick of ba6adf66d3c44c0aa2fd8a224862ff1901d64300 Cherry-pick of e70c5754d01f2ab0ff47ea3eabaa88aca5ed2a36 Change-Id: Id342fa0ab345f204bec58acf45ce72f6de950cfb --- core/java/android/view/ViewRootImpl.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'core/java/android/view/ViewRootImpl.java') diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index e4d82b1..3566140 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -56,6 +56,7 @@ import android.util.AndroidRuntimeException; import android.util.DisplayMetrics; import android.util.Log; import android.util.Slog; +import android.util.TimeUtils; import android.util.TypedValue; import android.view.Surface.OutOfResourcesException; import android.view.View.AttachInfo; @@ -1502,6 +1503,7 @@ public final class ViewRootImpl implements ViewParent, // to resume them mDirty.set(0, 0, mWidth, mHeight); } + mChoreographer.mFrameInfo.addFlags(FrameInfo.FLAG_WINDOW_LAYOUT_CHANGED); } final int surfaceGenerationId = mSurface.getGenerationId(); relayoutResult = relayoutWindow(params, viewVisibility, insetsPending); @@ -2505,6 +2507,9 @@ public final class ViewRootImpl implements ViewParent, } } + mAttachInfo.mDrawingTime = + mChoreographer.getFrameTimeNanos() / TimeUtils.NANOS_PER_MS; + if (!dirty.isEmpty() || mIsAnimating || accessibilityFocusDirty) { if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) { // If accessibility focus moved, always invalidate the root. @@ -2624,7 +2629,6 @@ public final class ViewRootImpl implements ViewParent, dirty.setEmpty(); mIsAnimating = false; - attachInfo.mDrawingTime = SystemClock.uptimeMillis(); mView.mPrivateFlags |= View.PFLAG_DRAWN; if (DEBUG_DRAW) { @@ -5778,6 +5782,16 @@ public final class ViewRootImpl implements ViewParent, Trace.traceCounter(Trace.TRACE_TAG_INPUT, mPendingInputEventQueueLengthCounterName, mPendingInputEventCount); + long eventTime = q.mEvent.getEventTimeNano(); + long oldestEventTime = eventTime; + if (q.mEvent instanceof MotionEvent) { + MotionEvent me = (MotionEvent)q.mEvent; + if (me.getHistorySize() > 0) { + oldestEventTime = me.getHistoricalEventTimeNano(0); + } + } + mChoreographer.mFrameInfo.updateInputEventTime(eventTime, oldestEventTime); + deliverInputEvent(q); } -- cgit v1.1