SF: hwvsync on for more samples on recalibration

Decrease the amount of time that the VSyncPredictor is using the
idealPeriod (ie, the hwc-reported period) by leaving hwVsync on until
there's enough info (4 additional pulses) to infer device's
measured/actual period.

This will benefit frames that come intermittently, as the vsync's
cumulative error over the larger time gap will be smaller, giving the
timer a better chance of landing closer to the vsync signal when those
one-off frames come in.

Test: 3 new unit tests, 2 other tests modified in substance.
Test: dogfooding
Test: uibench
Fixes: 159896971

Change-Id: Ic3190822e38c5a24d3445ea89ef6d7e34a590077
diff --git a/services/surfaceflinger/Scheduler/VSyncPredictor.cpp b/services/surfaceflinger/Scheduler/VSyncPredictor.cpp
index ab5773d..61f3fbb 100644
--- a/services/surfaceflinger/Scheduler/VSyncPredictor.cpp
+++ b/services/surfaceflinger/Scheduler/VSyncPredictor.cpp
@@ -255,21 +255,9 @@
     }
 }
 
-bool VSyncPredictor::needsMoreSamples(nsecs_t now) const {
-    using namespace std::literals::chrono_literals;
+bool VSyncPredictor::needsMoreSamples() const {
     std::lock_guard<std::mutex> lk(mMutex);
-    bool needsMoreSamples = true;
-    if (mTimestamps.size() >= kMinimumSamplesForPrediction) {
-        nsecs_t constexpr aLongTime =
-                std::chrono::duration_cast<std::chrono::nanoseconds>(500ms).count();
-        if (!(mLastTimestampIndex < 0 || mTimestamps.empty())) {
-            auto const lastTimestamp = mTimestamps[mLastTimestampIndex];
-            needsMoreSamples = !((lastTimestamp + aLongTime) > now);
-        }
-    }
-
-    ATRACE_INT("VSP-moreSamples", needsMoreSamples);
-    return needsMoreSamples;
+    return mTimestamps.size() < kMinimumSamplesForPrediction;
 }
 
 void VSyncPredictor::resetModel() {