SF TimeStats: fix missed frame logic

The current missed frames count is correct, but the decrement on the
total frames when mPropagateBackpressure is enabled is not right since
the missed frame won't count twice on SurfaceFlinger side. This change
fixed this logic error.

Test: dumpsys SurfaceFlinger --timestats <see go/sf-timestats for args>
Bug: b/70388650
Change-Id: I3bab221ad4b9f44da965084fd52da6c82523d1f4
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index cdf7cca..2e8a276 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1471,13 +1471,12 @@
                     (mPreviousPresentFence->getSignalTime() ==
                             Fence::SIGNAL_TIME_PENDING);
             ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
-            if (mPropagateBackpressure && frameMissed) {
-                mTimeStats.incrementMissedFrames(true);
-                signalLayerUpdate();
-                break;
-            }
             if (frameMissed) {
-                mTimeStats.incrementMissedFrames(false);
+                mTimeStats.incrementMissedFrames();
+                if (mPropagateBackpressure) {
+                    signalLayerUpdate();
+                    break;
+                }
             }
 
             // Now that we're going to make it to the handleMessageTransaction()
diff --git a/services/surfaceflinger/TimeStats/TimeStats.cpp b/services/surfaceflinger/TimeStats/TimeStats.cpp
index 5f2dd32..a6833a5 100644
--- a/services/surfaceflinger/TimeStats/TimeStats.cpp
+++ b/services/surfaceflinger/TimeStats/TimeStats.cpp
@@ -87,15 +87,12 @@
     timeStats.totalFrames++;
 }
 
-void TimeStats::incrementMissedFrames(bool propagateBackpressure) {
+void TimeStats::incrementMissedFrames() {
     if (!mEnabled.load()) return;
 
     ATRACE_CALL();
 
     std::lock_guard<std::mutex> lock(mMutex);
-    if (propagateBackpressure) {
-        timeStats.totalFrames--;
-    }
     timeStats.missedFrames++;
 }
 
diff --git a/services/surfaceflinger/TimeStats/TimeStats.h b/services/surfaceflinger/TimeStats/TimeStats.h
index 2410265..f76a62e 100644
--- a/services/surfaceflinger/TimeStats/TimeStats.h
+++ b/services/surfaceflinger/TimeStats/TimeStats.h
@@ -64,7 +64,7 @@
     static TimeStats& getInstance();
     void parseArgs(bool asProto, const Vector<String16>& args, size_t& index, String8& result);
     void incrementTotalFrames();
-    void incrementMissedFrames(bool propagateBackpressure);
+    void incrementMissedFrames();
     void incrementClientCompositionFrames();
 
     void setPostTime(const std::string& layerName, uint64_t frameNumber, nsecs_t postTime);