Move LayerHistoryV2 to LayerHistory

The old class LayerHistory (content detection v1) no longer exists
so LayerHisotryV2 can take its place.

Bug: 174120566
Test: presubmit
Change-Id: I84f33255b04ab082bbc5ae6e3ae4d7a793bfcd14
diff --git a/services/surfaceflinger/Android.bp b/services/surfaceflinger/Android.bp
index 3195516..fdb8aaf 100644
--- a/services/surfaceflinger/Android.bp
+++ b/services/surfaceflinger/Android.bp
@@ -155,8 +155,8 @@
         "Scheduler/DispSyncSource.cpp",
         "Scheduler/EventThread.cpp",
         "Scheduler/OneShotTimer.cpp",
-        "Scheduler/LayerHistoryV2.cpp",
-        "Scheduler/LayerInfoV2.cpp",
+        "Scheduler/LayerHistory.cpp",
+        "Scheduler/LayerInfo.cpp",
         "Scheduler/MessageQueue.cpp",
         "Scheduler/RefreshRateConfigs.cpp",
         "Scheduler/Scheduler.cpp",
diff --git a/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp b/services/surfaceflinger/Scheduler/LayerHistory.cpp
similarity index 84%
rename from services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
rename to services/surfaceflinger/Scheduler/LayerHistory.cpp
index e919d1b..c0d00f3 100644
--- a/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
+++ b/services/surfaceflinger/Scheduler/LayerHistory.cpp
@@ -15,7 +15,7 @@
  */
 
 #undef LOG_TAG
-#define LOG_TAG "LayerHistoryV2"
+#define LOG_TAG "LayerHistory"
 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 
 #include "LayerHistory.h"
@@ -32,14 +32,14 @@
 #include <utility>
 
 #include "../Layer.h"
-#include "LayerInfoV2.h"
+#include "LayerInfo.h"
 #include "SchedulerUtils.h"
 
-namespace android::scheduler::impl {
+namespace android::scheduler {
 
 namespace {
 
-bool isLayerActive(const Layer& layer, const LayerInfoV2& info, nsecs_t threshold) {
+bool isLayerActive(const Layer& layer, const LayerInfo& info, nsecs_t threshold) {
     // Layers with an explicit vote are always kept active
     if (layer.getFrameRateForLayerTree().rate > 0) {
         return true;
@@ -58,7 +58,7 @@
     return atoi(value);
 }
 
-void trace(const wp<Layer>& weak, const LayerInfoV2& info, LayerHistory::LayerVoteType type,
+void trace(const wp<Layer>& weak, const LayerInfo& info, LayerHistory::LayerVoteType type,
            int fps) {
     const auto layer = weak.promote();
     if (!layer) return;
@@ -78,24 +78,24 @@
 }
 } // namespace
 
-LayerHistoryV2::LayerHistoryV2(const scheduler::RefreshRateConfigs& refreshRateConfigs)
+LayerHistory::LayerHistory(const RefreshRateConfigs& refreshRateConfigs)
       : mTraceEnabled(traceEnabled()), mUseFrameRatePriority(useFrameRatePriority()) {
-    LayerInfoV2::setTraceEnabled(mTraceEnabled);
-    LayerInfoV2::setRefreshRateConfigs(refreshRateConfigs);
+    LayerInfo::setTraceEnabled(mTraceEnabled);
+    LayerInfo::setRefreshRateConfigs(refreshRateConfigs);
 }
 
-LayerHistoryV2::~LayerHistoryV2() = default;
+LayerHistory::~LayerHistory() = default;
 
-void LayerHistoryV2::registerLayer(Layer* layer, float /*lowRefreshRate*/, float highRefreshRate,
-                                   LayerVoteType type) {
+void LayerHistory::registerLayer(Layer* layer, float /*lowRefreshRate*/, float highRefreshRate,
+                                 LayerVoteType type) {
     const nsecs_t highRefreshRatePeriod = static_cast<nsecs_t>(1e9f / highRefreshRate);
-    auto info = std::make_unique<LayerInfoV2>(layer->getName(), highRefreshRatePeriod, type);
+    auto info = std::make_unique<LayerInfo>(layer->getName(), highRefreshRatePeriod, type);
     std::lock_guard lock(mLock);
     mLayerInfos.emplace_back(layer, std::move(info));
 }
 
-void LayerHistoryV2::record(Layer* layer, nsecs_t presentTime, nsecs_t now,
-                            LayerUpdateType updateType) {
+void LayerHistory::record(Layer* layer, nsecs_t presentTime, nsecs_t now,
+                          LayerUpdateType updateType) {
     std::lock_guard lock(mLock);
 
     const auto it = std::find_if(mLayerInfos.begin(), mLayerInfos.end(),
@@ -112,7 +112,7 @@
     }
 }
 
-LayerHistoryV2::Summary LayerHistoryV2::summarize(nsecs_t now) {
+LayerHistory::Summary LayerHistory::summarize(nsecs_t now) {
     LayerHistory::Summary summary;
 
     std::lock_guard lock(mLock);
@@ -155,7 +155,7 @@
     return summary;
 }
 
-void LayerHistoryV2::partitionLayers(nsecs_t now) {
+void LayerHistory::partitionLayers(nsecs_t now) {
     const nsecs_t threshold = getActiveLayerThreshold(now);
 
     // Collect expired and inactive layers after active layers.
@@ -207,7 +207,7 @@
     mLayerInfos.erase(mLayerInfos.begin() + static_cast<long>(end), mLayerInfos.end());
 }
 
-void LayerHistoryV2::clear() {
+void LayerHistory::clear() {
     std::lock_guard lock(mLock);
 
     for (const auto& [layer, info] : activeLayers()) {
@@ -215,10 +215,10 @@
     }
 }
 
-std::string LayerHistoryV2::dump() const {
+std::string LayerHistory::dump() const {
     std::lock_guard lock(mLock);
-    return base::StringPrintf("LayerHistoryV2{size=%zu, active=%zu}", mLayerInfos.size(),
+    return base::StringPrintf("LayerHistory{size=%zu, active=%zu}", mLayerInfos.size(),
                               mActiveLayersEnd);
 }
 
-} // namespace android::scheduler::impl
+} // namespace android::scheduler
diff --git a/services/surfaceflinger/Scheduler/LayerHistory.h b/services/surfaceflinger/Scheduler/LayerHistory.h
index 3235cf2..507ccc6 100644
--- a/services/surfaceflinger/Scheduler/LayerHistory.h
+++ b/services/surfaceflinger/Scheduler/LayerHistory.h
@@ -36,25 +36,23 @@
 namespace scheduler {
 
 class LayerHistoryTest;
-class LayerHistoryTestV2;
 class LayerInfo;
-class LayerInfoV2;
 
 class LayerHistory {
 public:
     using LayerVoteType = RefreshRateConfigs::LayerVoteType;
 
-    virtual ~LayerHistory() = default;
+    LayerHistory(const RefreshRateConfigs&);
+    ~LayerHistory();
 
     // Layers are unregistered when the weak reference expires.
-    virtual void registerLayer(Layer*, float lowRefreshRate, float highRefreshRate,
-                               LayerVoteType type) = 0;
+    void registerLayer(Layer*, float lowRefreshRate, float highRefreshRate, LayerVoteType type);
 
     // Sets the display size. Client is responsible for synchronization.
-    virtual void setDisplayArea(uint32_t displayArea) = 0;
+    void setDisplayArea(uint32_t displayArea) { mDisplayArea = displayArea; }
 
     // Sets whether a config change is pending to be applied
-    virtual void setConfigChangePending(bool pending) = 0;
+    void setConfigChangePending(bool pending) { mConfigChangePending = pending; }
 
     // Represents which layer activity is recorded
     enum class LayerUpdateType {
@@ -64,47 +62,21 @@
     };
 
     // Marks the layer as active, and records the given state to its history.
-    virtual void record(Layer*, nsecs_t presentTime, nsecs_t now, LayerUpdateType updateType) = 0;
+    void record(Layer*, nsecs_t presentTime, nsecs_t now, LayerUpdateType updateType);
 
     using Summary = std::vector<RefreshRateConfigs::LayerRequirement>;
 
     // Rebuilds sets of active/inactive layers, and accumulates stats for active layers.
-    virtual Summary summarize(nsecs_t now) = 0;
+    Summary summarize(nsecs_t now);
 
-    virtual void clear() = 0;
-    virtual std::string dump() const = 0;
-};
-
-namespace impl {
-
-class LayerHistoryV2 : public android::scheduler::LayerHistory {
-public:
-    LayerHistoryV2(const scheduler::RefreshRateConfigs&);
-    virtual ~LayerHistoryV2();
-
-    // Layers are unregistered when the weak reference expires.
-    void registerLayer(Layer*, float lowRefreshRate, float highRefreshRate,
-                       LayerVoteType type) override;
-
-    // Sets the display size. Client is responsible for synchronization.
-    void setDisplayArea(uint32_t displayArea) override { mDisplayArea = displayArea; }
-
-    void setConfigChangePending(bool pending) override { mConfigChangePending = pending; }
-
-    // Marks the layer as active, and records the given state to its history.
-    void record(Layer*, nsecs_t presentTime, nsecs_t now, LayerUpdateType updateType) override;
-
-    // Rebuilds sets of active/inactive layers, and accumulates stats for active layers.
-    android::scheduler::LayerHistory::Summary summarize(nsecs_t /*now*/) override;
-
-    void clear() override;
-    std::string dump() const override;
+    void clear();
+    std::string dump() const;
 
 private:
-    friend android::scheduler::LayerHistoryTestV2;
+    friend LayerHistoryTest;
     friend TestableScheduler;
 
-    using LayerPair = std::pair<wp<Layer>, std::unique_ptr<LayerInfoV2>>;
+    using LayerPair = std::pair<wp<Layer>, std::unique_ptr<LayerInfo>>;
     using LayerInfos = std::vector<LayerPair>;
 
     struct ActiveLayers {
@@ -141,6 +113,5 @@
     std::atomic<bool> mConfigChangePending = false;
 };
 
-} // namespace impl
 } // namespace scheduler
 } // namespace android
diff --git a/services/surfaceflinger/Scheduler/LayerInfoV2.cpp b/services/surfaceflinger/Scheduler/LayerInfo.cpp
similarity index 87%
rename from services/surfaceflinger/Scheduler/LayerInfoV2.cpp
rename to services/surfaceflinger/Scheduler/LayerInfo.cpp
index 94e7e20..66ac98a 100644
--- a/services/surfaceflinger/Scheduler/LayerInfoV2.cpp
+++ b/services/surfaceflinger/Scheduler/LayerInfo.cpp
@@ -17,7 +17,7 @@
 // #define LOG_NDEBUG 0
 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 
-#include "LayerInfoV2.h"
+#include "LayerInfo.h"
 
 #include <algorithm>
 #include <utility>
@@ -26,23 +26,23 @@
 #include <cutils/trace.h>
 
 #undef LOG_TAG
-#define LOG_TAG "LayerInfoV2"
+#define LOG_TAG "LayerInfo"
 
 namespace android::scheduler {
 
-const RefreshRateConfigs* LayerInfoV2::sRefreshRateConfigs = nullptr;
-bool LayerInfoV2::sTraceEnabled = false;
+const RefreshRateConfigs* LayerInfo::sRefreshRateConfigs = nullptr;
+bool LayerInfo::sTraceEnabled = false;
 
-LayerInfoV2::LayerInfoV2(const std::string& name, nsecs_t highRefreshRatePeriod,
-                         LayerHistory::LayerVoteType defaultVote)
+LayerInfo::LayerInfo(const std::string& name, nsecs_t highRefreshRatePeriod,
+                     LayerHistory::LayerVoteType defaultVote)
       : mName(name),
         mHighRefreshRatePeriod(highRefreshRatePeriod),
         mDefaultVote(defaultVote),
         mLayerVote({defaultVote, 0.0f}),
         mRefreshRateHistory(name) {}
 
-void LayerInfoV2::setLastPresentTime(nsecs_t lastPresentTime, nsecs_t now,
-                                     LayerUpdateType updateType, bool pendingConfigChange) {
+void LayerInfo::setLastPresentTime(nsecs_t lastPresentTime, nsecs_t now, LayerUpdateType updateType,
+                                   bool pendingConfigChange) {
     lastPresentTime = std::max(lastPresentTime, static_cast<nsecs_t>(0));
 
     mLastUpdatedTime = std::max(lastPresentTime, now);
@@ -63,13 +63,13 @@
     }
 }
 
-bool LayerInfoV2::isFrameTimeValid(const FrameTimeData& frameTime) const {
+bool LayerInfo::isFrameTimeValid(const FrameTimeData& frameTime) const {
     return frameTime.queueTime >= std::chrono::duration_cast<std::chrono::nanoseconds>(
                                           mFrameTimeValidSince.time_since_epoch())
                                           .count();
 }
 
-bool LayerInfoV2::isFrequent(nsecs_t now) const {
+bool LayerInfo::isFrequent(nsecs_t now) const {
     // If we know nothing about this layer we consider it as frequent as it might be the start
     // of an animation.
     if (mFrameTimes.size() < FREQUENT_LAYER_WINDOW_SIZE) {
@@ -94,11 +94,11 @@
     return (1e9f * (numFrames - 1)) / totalTime >= MIN_FPS_FOR_FREQUENT_LAYER;
 }
 
-bool LayerInfoV2::isAnimating(nsecs_t now) const {
+bool LayerInfo::isAnimating(nsecs_t now) const {
     return mLastAnimationTime >= getActiveLayerThreshold(now);
 }
 
-bool LayerInfoV2::hasEnoughDataForHeuristic() const {
+bool LayerInfo::hasEnoughDataForHeuristic() const {
     // The layer had to publish at least HISTORY_SIZE or HISTORY_DURATION of updates
     if (mFrameTimes.size() < 2) {
         ALOGV("fewer than 2 frames recorded: %zu", mFrameTimes.size());
@@ -120,7 +120,7 @@
     return true;
 }
 
-std::optional<nsecs_t> LayerInfoV2::calculateAverageFrameTime() const {
+std::optional<nsecs_t> LayerInfo::calculateAverageFrameTime() const {
     nsecs_t totalPresentTimeDeltas = 0;
     nsecs_t totalQueueTimeDeltas = 0;
     bool missingPresentTime = false;
@@ -163,7 +163,7 @@
     return static_cast<nsecs_t>(averageFrameTime);
 }
 
-std::optional<float> LayerInfoV2::calculateRefreshRateIfPossible(nsecs_t now) {
+std::optional<float> LayerInfo::calculateRefreshRateIfPossible(nsecs_t now) {
     static constexpr float MARGIN = 1.0f; // 1Hz
     if (!hasEnoughDataForHeuristic()) {
         ALOGV("Not enough data");
@@ -198,7 +198,7 @@
                                           : std::make_optional(mLastRefreshRate.reported);
 }
 
-LayerInfoV2::LayerVote LayerInfoV2::getRefreshRateVote(nsecs_t now) {
+LayerInfo::LayerVote LayerInfo::getRefreshRateVote(nsecs_t now) {
     if (mLayerVote.type != LayerHistory::LayerVoteType::Heuristic) {
         ALOGV("%s voted %d ", mName.c_str(), static_cast<int>(mLayerVote.type));
         return mLayerVote;
@@ -233,7 +233,7 @@
     return {LayerHistory::LayerVoteType::Max, 0};
 }
 
-const char* LayerInfoV2::getTraceTag(android::scheduler::LayerHistory::LayerVoteType type) const {
+const char* LayerInfo::getTraceTag(android::scheduler::LayerHistory::LayerVoteType type) const {
     if (mTraceTags.count(type) == 0) {
         const auto tag = "LFPS " + mName + " " + RefreshRateConfigs::layerVoteTypeString(type);
         mTraceTags.emplace(type, tag);
@@ -242,8 +242,8 @@
     return mTraceTags.at(type).c_str();
 }
 
-LayerInfoV2::RefreshRateHistory::HeuristicTraceTagData
-LayerInfoV2::RefreshRateHistory::makeHeuristicTraceTagData() const {
+LayerInfo::RefreshRateHistory::HeuristicTraceTagData
+LayerInfo::RefreshRateHistory::makeHeuristicTraceTagData() const {
     const std::string prefix = "LFPS ";
     const std::string suffix = "Heuristic ";
     return {.min = prefix + mName + suffix + "min",
@@ -252,11 +252,11 @@
             .average = prefix + mName + suffix + "average"};
 }
 
-void LayerInfoV2::RefreshRateHistory::clear() {
+void LayerInfo::RefreshRateHistory::clear() {
     mRefreshRates.clear();
 }
 
-bool LayerInfoV2::RefreshRateHistory::add(float refreshRate, nsecs_t now) {
+bool LayerInfo::RefreshRateHistory::add(float refreshRate, nsecs_t now) {
     mRefreshRates.push_back({refreshRate, now});
     while (mRefreshRates.size() >= HISTORY_SIZE ||
            now - mRefreshRates.front().timestamp > HISTORY_DURATION.count()) {
@@ -274,7 +274,7 @@
     return isConsistent();
 }
 
-bool LayerInfoV2::RefreshRateHistory::isConsistent() const {
+bool LayerInfo::RefreshRateHistory::isConsistent() const {
     if (mRefreshRates.empty()) return true;
 
     const auto max = std::max_element(mRefreshRates.begin(), mRefreshRates.end());
diff --git a/services/surfaceflinger/Scheduler/LayerInfoV2.h b/services/surfaceflinger/Scheduler/LayerInfo.h
similarity index 93%
rename from services/surfaceflinger/Scheduler/LayerInfoV2.h
rename to services/surfaceflinger/Scheduler/LayerInfo.h
index f94f4ab..e434670 100644
--- a/services/surfaceflinger/Scheduler/LayerInfoV2.h
+++ b/services/surfaceflinger/Scheduler/LayerInfo.h
@@ -43,7 +43,7 @@
 }
 
 // Stores history of present times and refresh rates for a layer.
-class LayerInfoV2 {
+class LayerInfo {
     using LayerUpdateType = LayerHistory::LayerUpdateType;
 
     // Layer is considered frequent if the earliest value in the window of most recent present times
@@ -54,7 +54,7 @@
     static constexpr auto MAX_FREQUENT_LAYER_PERIOD_NS =
             std::chrono::nanoseconds(static_cast<nsecs_t>(1e9f / MIN_FPS_FOR_FREQUENT_LAYER)) + 1ms;
 
-    friend class LayerHistoryTestV2;
+    friend class LayerHistoryTest;
 
 public:
     // Holds information about the layer vote
@@ -70,11 +70,11 @@
         sRefreshRateConfigs = &refreshRateConfigs;
     }
 
-    LayerInfoV2(const std::string& name, nsecs_t highRefreshRatePeriod,
-                LayerHistory::LayerVoteType defaultVote);
+    LayerInfo(const std::string& name, nsecs_t highRefreshRatePeriod,
+              LayerHistory::LayerVoteType defaultVote);
 
-    LayerInfoV2(const LayerInfo&) = delete;
-    LayerInfoV2& operator=(const LayerInfoV2&) = delete;
+    LayerInfo(const LayerInfo&) = delete;
+    LayerInfo& operator=(const LayerInfo&) = delete;
 
     // Records the last requested present time. It also stores information about when
     // the layer was last updated. If the present time is farther in the future than the
@@ -131,9 +131,9 @@
     struct RefreshRateHeuristicData {
         // Rate calculated on the layer
         float calculated = 0.0f;
-        // Last reported rate for LayerInfoV2::getRefreshRate()
+        // Last reported rate for LayerInfo::getRefreshRate()
         float reported = 0.0f;
-        // Whether the last reported rate for LayerInfoV2::getRefreshRate()
+        // Whether the last reported rate for LayerInfo::getRefreshRate()
         // was due to animation or infrequent updates
         bool animatingOrInfrequent = false;
     };
@@ -154,7 +154,7 @@
         bool add(float refreshRate, nsecs_t now);
 
     private:
-        friend class LayerHistoryTestV2;
+        friend class LayerHistoryTest;
 
         // Holds the refresh rate when it was calculated
         struct RefreshRateData {
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 1e00577..a9e08fc 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -196,7 +196,7 @@
         const scheduler::RefreshRateConfigs& configs) {
     if (!configs.canSwitch()) return nullptr;
 
-    return std::make_unique<scheduler::impl::LayerHistoryV2>(configs);
+    return std::make_unique<scheduler::LayerHistory>(configs);
 }
 
 std::unique_ptr<VSyncSource> Scheduler::makePrimaryDispSyncSource(
diff --git a/services/surfaceflinger/tests/unittests/Android.bp b/services/surfaceflinger/tests/unittests/Android.bp
index af28c9d..7427e27 100644
--- a/services/surfaceflinger/tests/unittests/Android.bp
+++ b/services/surfaceflinger/tests/unittests/Android.bp
@@ -47,7 +47,7 @@
         "FrameTimelineTest.cpp",
         "HWComposerTest.cpp",
         "OneShotTimerTest.cpp",
-        "LayerHistoryTestV2.cpp",
+        "LayerHistoryTest.cpp",
         "LayerMetadataTest.cpp",
         "MessageQueueTest.cpp",
         "PromiseTest.cpp",
diff --git a/services/surfaceflinger/tests/unittests/LayerHistoryTestV2.cpp b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
similarity index 94%
rename from services/surfaceflinger/tests/unittests/LayerHistoryTestV2.cpp
rename to services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
index 4060d70..fbb4637 100644
--- a/services/surfaceflinger/tests/unittests/LayerHistoryTestV2.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
@@ -15,7 +15,7 @@
  */
 
 #undef LOG_TAG
-#define LOG_TAG "LayerHistoryTestV2"
+#define LOG_TAG "LayerHistoryTest"
 
 #include <Layer.h>
 #include <gmock/gmock.h>
@@ -23,7 +23,7 @@
 #include <log/log.h>
 
 #include "Scheduler/LayerHistory.h"
-#include "Scheduler/LayerInfoV2.h"
+#include "Scheduler/LayerInfo.h"
 #include "TestableScheduler.h"
 #include "TestableSurfaceFlinger.h"
 #include "mock/MockLayer.h"
@@ -34,14 +34,14 @@
 
 namespace android::scheduler {
 
-class LayerHistoryTestV2 : public testing::Test {
+class LayerHistoryTest : public testing::Test {
 protected:
-    static constexpr auto PRESENT_TIME_HISTORY_SIZE = LayerInfoV2::HISTORY_SIZE;
-    static constexpr auto MAX_FREQUENT_LAYER_PERIOD_NS = LayerInfoV2::MAX_FREQUENT_LAYER_PERIOD_NS;
-    static constexpr auto FREQUENT_LAYER_WINDOW_SIZE = LayerInfoV2::FREQUENT_LAYER_WINDOW_SIZE;
-    static constexpr auto PRESENT_TIME_HISTORY_DURATION = LayerInfoV2::HISTORY_DURATION;
+    static constexpr auto PRESENT_TIME_HISTORY_SIZE = LayerInfo::HISTORY_SIZE;
+    static constexpr auto MAX_FREQUENT_LAYER_PERIOD_NS = LayerInfo::MAX_FREQUENT_LAYER_PERIOD_NS;
+    static constexpr auto FREQUENT_LAYER_WINDOW_SIZE = LayerInfo::FREQUENT_LAYER_WINDOW_SIZE;
+    static constexpr auto PRESENT_TIME_HISTORY_DURATION = LayerInfo::HISTORY_DURATION;
     static constexpr auto REFRESH_RATE_AVERAGE_HISTORY_DURATION =
-            LayerInfoV2::RefreshRateHistory::HISTORY_DURATION;
+            LayerInfo::RefreshRateHistory::HISTORY_DURATION;
 
     static constexpr float LO_FPS = 30.f;
     static constexpr auto LO_FPS_PERIOD = static_cast<nsecs_t>(1e9f / LO_FPS);
@@ -49,12 +49,12 @@
     static constexpr float HI_FPS = 90.f;
     static constexpr auto HI_FPS_PERIOD = static_cast<nsecs_t>(1e9f / HI_FPS);
 
-    LayerHistoryTestV2() { mFlinger.resetScheduler(mScheduler); }
+    LayerHistoryTest() { mFlinger.resetScheduler(mScheduler); }
 
     void SetUp() override { ASSERT_TRUE(mScheduler->hasLayerHistory()); }
 
-    impl::LayerHistoryV2& history() { return *mScheduler->mutableLayerHistoryV2(); }
-    const impl::LayerHistoryV2& history() const { return *mScheduler->mutableLayerHistoryV2(); }
+    LayerHistory& history() { return *mScheduler->mutableLayerHistory(); }
+    const LayerHistory& history() const { return *mScheduler->mutableLayerHistory(); }
 
     size_t layerCount() const { return mScheduler->layerHistorySize(); }
     size_t activeLayerCount() const NO_THREAD_SAFETY_ANALYSIS { return history().mActiveLayersEnd; }
@@ -91,7 +91,7 @@
     void recordFramesAndExpect(const sp<mock::MockLayer>& layer, nsecs_t& time, float frameRate,
                                float desiredRefreshRate, int numFrames) {
         const nsecs_t framePeriod = static_cast<nsecs_t>(1e9f / frameRate);
-        impl::LayerHistoryV2::Summary summary;
+        LayerHistory::Summary summary;
         for (int i = 0; i < numFrames; i++) {
             history().record(layer.get(), time, time, LayerHistory::LayerUpdateType::Buffer);
             time += framePeriod;
@@ -125,7 +125,7 @@
 
 namespace {
 
-TEST_F(LayerHistoryTestV2, oneLayer) {
+TEST_F(LayerHistoryTest, oneLayer) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -156,7 +156,7 @@
     }
 }
 
-TEST_F(LayerHistoryTestV2, oneInvisibleLayer) {
+TEST_F(LayerHistoryTest, oneInvisibleLayer) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -180,7 +180,7 @@
     EXPECT_EQ(0, activeLayerCount());
 }
 
-TEST_F(LayerHistoryTestV2, explicitTimestamp) {
+TEST_F(LayerHistoryTest, explicitTimestamp) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -201,7 +201,7 @@
     EXPECT_EQ(1, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, oneLayerNoVote) {
+TEST_F(LayerHistoryTest, oneLayerNoVote) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -228,7 +228,7 @@
     EXPECT_EQ(0, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, oneLayerMinVote) {
+TEST_F(LayerHistoryTest, oneLayerMinVote) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -256,7 +256,7 @@
     EXPECT_EQ(0, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, oneLayerMaxVote) {
+TEST_F(LayerHistoryTest, oneLayerMaxVote) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -284,7 +284,7 @@
     EXPECT_EQ(0, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, oneLayerExplicitVote) {
+TEST_F(LayerHistoryTest, oneLayerExplicitVote) {
     auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree())
@@ -316,7 +316,7 @@
     EXPECT_EQ(0, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, oneLayerExplicitExactVote) {
+TEST_F(LayerHistoryTest, oneLayerExplicitExactVote) {
     auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree())
@@ -350,7 +350,7 @@
     EXPECT_EQ(0, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, multipleLayers) {
+TEST_F(LayerHistoryTest, multipleLayers) {
     auto layer1 = createLayer();
     auto layer2 = createLayer();
     auto layer3 = createLayer();
@@ -370,7 +370,7 @@
     EXPECT_EQ(0, activeLayerCount());
     EXPECT_EQ(0, frequentLayerCount(time));
 
-    impl::LayerHistoryV2::Summary summary;
+    LayerHistory::Summary summary;
 
     // layer1 is active but infrequent.
     for (int i = 0; i < PRESENT_TIME_HISTORY_SIZE; i++) {
@@ -504,7 +504,7 @@
     EXPECT_EQ(0, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, inactiveLayers) {
+TEST_F(LayerHistoryTest, inactiveLayers) {
     auto layer = createLayer();
 
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
@@ -560,7 +560,7 @@
     EXPECT_EQ(1, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, invisibleExplicitLayer) {
+TEST_F(LayerHistoryTest, invisibleExplicitLayer) {
     auto explicitVisiblelayer = createLayer();
     auto explicitInvisiblelayer = createLayer();
 
@@ -590,7 +590,7 @@
     EXPECT_EQ(2, frequentLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, infrequentAnimatingLayer) {
+TEST_F(LayerHistoryTest, infrequentAnimatingLayer) {
     auto layer = createLayer();
 
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
@@ -636,7 +636,7 @@
     EXPECT_EQ(1, animatingLayerCount(time));
 }
 
-TEST_F(LayerHistoryTestV2, heuristicLayer60Hz) {
+TEST_F(LayerHistoryTest, heuristicLayer60Hz) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -647,7 +647,7 @@
     }
 }
 
-TEST_F(LayerHistoryTestV2, heuristicLayer60_30Hz) {
+TEST_F(LayerHistoryTest, heuristicLayer60_30Hz) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -662,7 +662,7 @@
     recordFramesAndExpect(layer, time, 60.0f, 60.0f, PRESENT_TIME_HISTORY_SIZE);
 }
 
-TEST_F(LayerHistoryTestV2, heuristicLayerNotOscillating) {
+TEST_F(LayerHistoryTest, heuristicLayerNotOscillating) {
     const auto layer = createLayer();
     EXPECT_CALL(*layer, isVisible()).WillRepeatedly(Return(true));
     EXPECT_CALL(*layer, getFrameRateForLayerTree()).WillRepeatedly(Return(Layer::FrameRate()));
@@ -676,11 +676,11 @@
     recordFramesAndExpect(layer, time, 27.10f, 30.0f, PRESENT_TIME_HISTORY_SIZE);
 }
 
-class LayerHistoryTestV2Parameterized
-      : public LayerHistoryTestV2,
-        public testing::WithParamInterface<std::chrono::nanoseconds> {};
+class LayerHistoryTestParameterized : public LayerHistoryTest,
+                                      public testing::WithParamInterface<std::chrono::nanoseconds> {
+};
 
-TEST_P(LayerHistoryTestV2Parameterized, HeuristicLayerWithInfrequentLayer) {
+TEST_P(LayerHistoryTestParameterized, HeuristicLayerWithInfrequentLayer) {
     std::chrono::nanoseconds infrequentUpdateDelta = GetParam();
     auto heuristicLayer = createLayer("HeuristicLayer");
 
@@ -746,7 +746,7 @@
     }
 }
 
-INSTANTIATE_TEST_CASE_P(LeapYearTests, LayerHistoryTestV2Parameterized,
+INSTANTIATE_TEST_CASE_P(LeapYearTests, LayerHistoryTestParameterized,
                         ::testing::Values(1s, 2s, 3s, 4s, 5s));
 
 } // namespace
diff --git a/services/surfaceflinger/tests/unittests/TestableScheduler.h b/services/surfaceflinger/tests/unittests/TestableScheduler.h
index 0bfd999..2192977 100644
--- a/services/surfaceflinger/tests/unittests/TestableScheduler.h
+++ b/services/surfaceflinger/tests/unittests/TestableScheduler.h
@@ -57,13 +57,11 @@
 
     bool hasLayerHistory() const { return static_cast<bool>(mLayerHistory); }
 
-    auto* mutableLayerHistoryV2() {
-        return static_cast<scheduler::impl::LayerHistoryV2*>(mLayerHistory.get());
-    }
+    auto* mutableLayerHistory() { return mLayerHistory.get(); }
 
     size_t layerHistorySize() NO_THREAD_SAFETY_ANALYSIS {
         if (!mLayerHistory) return 0;
-        return mutableLayerHistoryV2()->mLayerInfos.size();
+        return mutableLayerHistory()->mLayerInfos.size();
     }
 
     void replaceTouchTimer(int64_t millis) {