Return janktype properly for dropped frames

In SurfaceFrame::getJankType(), a dropped frame won't have any present
time set and will return std::nullopt currently. This behavior can
result in a memory leak in releasePendingBuffer. Whenever SurfaceFrames
are created, they are added to a deque 'mPendingJankClassification'.
This deque is popped from the front as and when the frames are
presented. However, if a dropped frame is in the front of the deque, the
deque keeps growing in size to infinity. Since getJankType() reports a
std::nullopt, it assumes that the frame hasn't been presented yet and
keeps waiting for it.

Bug: 179701581
Test: libsurfaceflinger_unittest
Change-Id: I8ad1ed07222d39e4f98e4f7f3178db9fe52ea712
diff --git a/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp b/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp
index eb0c724..0a40388 100644
--- a/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp
+++ b/services/surfaceflinger/FrameTimeline/FrameTimeline.cpp
@@ -327,7 +327,12 @@
 
 std::optional<int32_t> SurfaceFrame::getJankType() const {
     std::scoped_lock lock(mMutex);
+    if (mPresentState == PresentState::Dropped) {
+        // Return no jank if it's a dropped frame since we cannot attribute a jank to a it.
+        return JankType::None;
+    }
     if (mActuals.presentTime == 0) {
+        // Frame hasn't been presented yet.
         return std::nullopt;
     }
     return mJankType;