Zero out newer metrics as first commit.

We have to report these metrics in a very specific order, so drop in a
commit to zero them out so that if there's parallel iteration doesn't
collide.

Bug: 171309796
Test: libsurfaceflinger_unittest
Change-Id: Ia8ab285ef8747e48d5be95472c483198fdef01a3
diff --git a/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp b/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp
index fb9afd4..df4464e 100644
--- a/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TimeStatsTest.cpp
@@ -932,6 +932,18 @@
     return byteString;
 }
 
+std::string frameRateVoteToProtoByteString(float refreshRate, int frameRateCompatibility,
+                                           int seamlessness) {
+    util::ProtoOutputStream proto;
+    proto.write(android::util::FIELD_TYPE_FLOAT | 1 /* field id */, refreshRate);
+    proto.write(android::util::FIELD_TYPE_ENUM | 2 /* field id */, frameRateCompatibility);
+    proto.write(android::util::FIELD_TYPE_ENUM | 3 /* field id */, seamlessness);
+
+    std::string byteString;
+    proto.serializeToString(&byteString);
+    return byteString;
+}
+
 std::string dumpByteStringHex(const std::string& str) {
     std::stringstream ss;
     ss << std::hex;
@@ -1002,6 +1014,7 @@
 
     std::string expectedFrameDuration = buildExpectedHistogramBytestring({2}, {1});
     std::string expectedRenderEngineTiming = buildExpectedHistogramBytestring({1, 2}, {1, 1});
+    std::string expectedEmptyHistogram = buildExpectedHistogramBytestring({}, {});
 
     {
         InSequence seq;
@@ -1031,6 +1044,22 @@
         EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 1));
         EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 1));
         EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 1));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate,
+                    statsEventWriteByteArray(mDelegate->mEvent,
+                                             BytesEq((const uint8_t*)expectedEmptyHistogram.c_str(),
+                                                     expectedEmptyHistogram.size()),
+                                             expectedEmptyHistogram.size()));
+        EXPECT_CALL(*mDelegate,
+                    statsEventWriteByteArray(mDelegate->mEvent,
+                                             BytesEq((const uint8_t*)expectedEmptyHistogram.c_str(),
+                                                     expectedEmptyHistogram.size()),
+                                             expectedEmptyHistogram.size()));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+
         EXPECT_CALL(*mDelegate, statsEventBuild(mDelegate->mEvent));
     }
     EXPECT_EQ(AStatsManager_PULL_SUCCESS,
@@ -1083,6 +1112,8 @@
     std::string expectedLatchToPresent = buildExpectedHistogramBytestring({2}, {1});
     std::string expectedDesiredToPresent = buildExpectedHistogramBytestring({1}, {1});
     std::string expectedPostToAcquire = buildExpectedHistogramBytestring({1}, {1});
+    std::string expectedFrameRateOverride = frameRateVoteToProtoByteString(0.0, 0, 0);
+    std::string expectedEmptyHistogram = buildExpectedHistogramBytestring({}, {});
     {
         InSequence seq;
         EXPECT_CALL(*mDelegate,
@@ -1136,6 +1167,22 @@
         EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 1));
         EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 1));
         EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 1));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate, statsEventWriteInt32(mDelegate->mEvent, 0));
+        EXPECT_CALL(*mDelegate,
+                    statsEventWriteByteArray(mDelegate->mEvent,
+                                             BytesEq((const uint8_t*)
+                                                             expectedFrameRateOverride.c_str(),
+                                                     expectedFrameRateOverride.size()),
+                                             expectedFrameRateOverride.size()));
+        EXPECT_CALL(*mDelegate,
+                    statsEventWriteByteArray(mDelegate->mEvent,
+                                             BytesEq((const uint8_t*)expectedEmptyHistogram.c_str(),
+                                                     expectedEmptyHistogram.size()),
+                                             expectedEmptyHistogram.size()));
 
         EXPECT_CALL(*mDelegate, statsEventBuild(mDelegate->mEvent));
     }