Add rate limiting to fps reporter.

From a user perspective, the jittery frame rate is jarring, and from a
performance perspective submitting a binder call every frame is
overkill. To address those two concerns add rate-limiting from
SurfaceFlinger to limit the frame rate reporting.

As part of this patch, extract OneShotTimer's fake clock interface to a
SF-common location so that FpsReporter can share that interface for
testing.

Bug: 186265654
Test: Manually inspect fps overlay
Test: libsurfaceflinger_unittest
Change-Id: I45eb994d847abbb9fc8d5ff7d07ad51a1a790176
diff --git a/services/surfaceflinger/Scheduler/OneShotTimer.h b/services/surfaceflinger/Scheduler/OneShotTimer.h
index 7285427..09265bb 100644
--- a/services/surfaceflinger/Scheduler/OneShotTimer.h
+++ b/services/surfaceflinger/Scheduler/OneShotTimer.h
@@ -20,6 +20,7 @@
 #include <chrono>
 #include <condition_variable>
 #include <thread>
+#include "../Clock.h"
 
 #include <android-base/thread_annotations.h>
 
@@ -36,17 +37,9 @@
     using ResetCallback = std::function<void()>;
     using TimeoutCallback = std::function<void()>;
 
-    class Clock {
-    public:
-        Clock() = default;
-        virtual ~Clock() = default;
-
-        virtual std::chrono::steady_clock::time_point now() const;
-    };
-
     OneShotTimer(std::string name, const Interval& interval, const ResetCallback& resetCallback,
                  const TimeoutCallback& timeoutCallback,
-                 std::unique_ptr<OneShotTimer::Clock> = std::make_unique<OneShotTimer::Clock>());
+                 std::unique_ptr<Clock> clock = std::make_unique<SteadyClock>());
     ~OneShotTimer();
 
     // Initializes and turns on the idle timer.