Fix a memory leak with pending jank classifications

If the front of the pendingJankClassification deque is
stuck(FrameTimeline never received it) for some reason, the current
logic never releases it and the deque keeps growing in size until the
layer itself is destroyed. This has resulted in some memory leaks
recently.

Bug: 181328447
Test: heap_prof trace
Change-Id: If71225f52da3bbd9b0b0d46af75f933fd48d5bd5
diff --git a/services/surfaceflinger/BufferStateLayer.h b/services/surfaceflinger/BufferStateLayer.h
index 175a40b..44a7bb5 100644
--- a/services/surfaceflinger/BufferStateLayer.h
+++ b/services/surfaceflinger/BufferStateLayer.h
@@ -173,6 +173,8 @@
     nsecs_t mCallbackHandleAcquireTime = -1;
 
     std::deque<std::shared_ptr<android::frametimeline::SurfaceFrame>> mPendingJankClassifications;
+    // An upper bound on the number of SurfaceFrames in the pending classifications deque.
+    static constexpr int kPendingClassificationMaxSurfaceFrames = 25;
 
     const std::string mBlastTransactionName{"BufferTX - " + mName};
     // This integer is incremented everytime a buffer arrives at the server for this layer,