Switch JankTracker to FrameInfo::duration()

Fixes: 27533462

FrameInfo::duration() will remove time spent waiting
in the queue from the duration. This is desired because
that time is otherwise accounted for by the previous frame,
so we don't want to double count it.

This shows up mostly in TestSceneRunner & shadowgrid2
due to a combination of slow frame times and continous rendering.

Change-Id: I27c42d5c24d266de4ada8ea00ec9164d518754f8
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp
index 9d4eccc..ebe9c42 100644
--- a/libs/hwui/JankTracker.cpp
+++ b/libs/hwui/JankTracker.cpp
@@ -212,8 +212,7 @@
 void JankTracker::addFrame(const FrameInfo& frame) {
     mData->totalFrameCount++;
     // Fast-path for jank-free frames
-    int64_t totalDuration =
-            frame[FrameInfoIndex::FrameCompleted] - frame[sFrameStart];
+    int64_t totalDuration = frame.duration(sFrameStart, FrameInfoIndex::FrameCompleted);
     uint32_t framebucket = frameCountIndexForFrameTime(totalDuration);
     // Keep the fast path as fast as possible.
     if (CC_LIKELY(totalDuration < mFrameInterval)) {