Merge changes Icda006de,I3590beeb into rvc-dev

* changes:
  SurfaceFlinger: treat the desiredRefreshRate of ExplicitDefault as max
  SurfaceFlinger: no touch boost for layer that explicitly voted
diff --git a/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp b/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
index 6ef6ce4..8a14572 100644
--- a/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
+++ b/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
@@ -212,7 +212,5 @@
     for (const auto& [layer, info] : activeLayers()) {
         info->clearHistory();
     }
-
-    mActiveLayersEnd = 0;
 }
 } // namespace android::scheduler::impl
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
index 9edbaee..02d0b53 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
@@ -23,6 +23,9 @@
 #include <chrono>
 #include <cmath>
 
+#undef LOG_TAG
+#define LOG_TAG "RefreshRateConfigs"
+
 namespace android::scheduler {
 
 using AllRefreshRatesMapType = RefreshRateConfigs::AllRefreshRatesMapType;
@@ -95,22 +98,19 @@
 }
 
 const RefreshRate& RefreshRateConfigs::getRefreshRateForContentV2(
-        const std::vector<LayerRequirement>& layers, bool touchActive) const {
+        const std::vector<LayerRequirement>& layers, bool touchActive,
+        bool* touchConsidered) const {
     ATRACE_CALL();
     ALOGV("getRefreshRateForContent %zu layers", layers.size());
 
+    *touchConsidered = false;
     std::lock_guard lock(mLock);
 
-    // For now if the touch is active return the peak refresh rate
-    // This should be optimized to consider other layers as well.
-    if (touchActive) {
-        return *mAvailableRefreshRates.back();
-    }
-
     // If there are not layers, there is not content detection, so return the current
     // refresh rate.
     if (layers.empty()) {
-        return getCurrentRefreshRateByPolicyLocked();
+        *touchConsidered = touchActive;
+        return touchActive ? *mAvailableRefreshRates.back() : getCurrentRefreshRateByPolicyLocked();
     }
 
     int noVoteLayers = 0;
@@ -118,17 +118,30 @@
     int maxVoteLayers = 0;
     int explicitDefaultVoteLayers = 0;
     int explicitExactOrMultipleVoteLayers = 0;
+    float maxExplicitWeight = 0;
     for (const auto& layer : layers) {
-        if (layer.vote == LayerVoteType::NoVote)
+        if (layer.vote == LayerVoteType::NoVote) {
             noVoteLayers++;
-        else if (layer.vote == LayerVoteType::Min)
+        } else if (layer.vote == LayerVoteType::Min) {
             minVoteLayers++;
-        else if (layer.vote == LayerVoteType::Max)
+        } else if (layer.vote == LayerVoteType::Max) {
             maxVoteLayers++;
-        else if (layer.vote == LayerVoteType::ExplicitDefault)
+        } else if (layer.vote == LayerVoteType::ExplicitDefault) {
             explicitDefaultVoteLayers++;
-        else if (layer.vote == LayerVoteType::ExplicitExactOrMultiple)
+            maxExplicitWeight = std::max(maxExplicitWeight, layer.weight);
+        } else if (layer.vote == LayerVoteType::ExplicitExactOrMultiple) {
             explicitExactOrMultipleVoteLayers++;
+            maxExplicitWeight = std::max(maxExplicitWeight, layer.weight);
+        }
+    }
+
+    // Consider the touch event if there are no ExplicitDefault layers.
+    // ExplicitDefault are mostly interactive (as opposed to ExplicitExactOrMultiple)
+    // and therefore if those posted an explicit vote we should not change it
+    // if get get a touch event.
+    if (touchActive && explicitDefaultVoteLayers == 0) {
+        *touchConsidered = true;
+        return *mAvailableRefreshRates.back();
     }
 
     // Only if all layers want Min we should return Min
@@ -168,16 +181,17 @@
             const auto layerPeriod = round<nsecs_t>(1e9f / layer.desiredRefreshRate);
             if (layer.vote == LayerVoteType::ExplicitDefault) {
                 const auto layerScore = [&]() {
-                    const auto [displayFramesQuot, displayFramesRem] =
-                            getDisplayFrames(layerPeriod, displayPeriod);
-                    if (displayFramesQuot == 0) {
-                        // Layer desired refresh rate is higher the display rate.
-                        return static_cast<float>(layerPeriod) / static_cast<float>(displayPeriod);
+                    // Find the actual rate the layer will render, assuming
+                    // that layerPeriod is the minimal time to render a frame
+                    auto actualLayerPeriod = displayPeriod;
+                    int multiplier = 1;
+                    while (layerPeriod > actualLayerPeriod + MARGIN_FOR_PERIOD_CALCULATION) {
+                        multiplier++;
+                        actualLayerPeriod = displayPeriod * multiplier;
                     }
-
-                    return 1.0f -
-                            (static_cast<float>(displayFramesRem) /
-                             static_cast<float>(layerPeriod));
+                    return std::min(1.0f,
+                                    static_cast<float>(layerPeriod) /
+                                            static_cast<float>(actualLayerPeriod));
                 }();
 
                 ALOGV("%s (ExplicitDefault, weight %.2f) %.2fHz gives %s score of %.2f",
@@ -240,6 +254,7 @@
 
 template <typename Iter>
 const RefreshRate* RefreshRateConfigs::getBestRefreshRate(Iter begin, Iter end) const {
+    constexpr auto EPSILON = 0.001f;
     const RefreshRate* bestRefreshRate = begin->first;
     float max = begin->second;
     for (auto i = begin; i != end; ++i) {
@@ -248,7 +263,7 @@
 
         ATRACE_INT(refreshRate->name.c_str(), round<int>(score * 100));
 
-        if (score > max) {
+        if (score > max * (1 + EPSILON)) {
             max = score;
             bestRefreshRate = refreshRate;
         }
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
index 9cd5959..87d4389 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
@@ -137,9 +137,11 @@
 
     // Returns the refresh rate that fits best to the given layers. This function also gets a
     // boolean flag that indicates whether user touched the screen recently to be factored in when
-    // choosing the refresh rate.
+    // choosing the refresh rate and returns whether the refresh rate was chosen as a result of
+    // a touch event.
     const RefreshRate& getRefreshRateForContentV2(const std::vector<LayerRequirement>& layers,
-                                                  bool touchActive) const EXCLUDES(mLock);
+                                                  bool touchActive, bool* touchConsidered) const
+            EXCLUDES(mLock);
 
     // Returns all the refresh rates supported by the device. This won't change at runtime.
     const AllRefreshRatesMapType& getAllRefreshRates() const EXCLUDES(mLock);
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 96fa061..920f0ec 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -483,7 +483,7 @@
     // that is currently on top. b/142507166 will give us this capability.
     std::lock_guard<std::mutex> lock(mFeatureStateLock);
     if (mLayerHistory) {
-        mLayerHistory->clear();
+        // Layer History will be cleared based on RefreshRateConfigs::getRefreshRateForContentV2
 
         mTouchTimer->reset();
 
@@ -620,10 +620,21 @@
         return mRefreshRateConfigs.getRefreshRateForContent(mFeatures.contentRequirements).configId;
     }
 
-    return mRefreshRateConfigs
-            .getRefreshRateForContentV2(mFeatures.contentRequirements,
-                                        mTouchTimer && mFeatures.touch == TouchState::Active)
-            .configId;
+    bool touchConsidered;
+    const auto& ret =
+            mRefreshRateConfigs
+                    .getRefreshRateForContentV2(mFeatures.contentRequirements,
+                                                mTouchTimer &&
+                                                        mFeatures.touch == TouchState::Active,
+                                                &touchConsidered)
+                    .configId;
+    if (touchConsidered) {
+        // Clear layer history if refresh rate was selected based on touch to allow
+        // the hueristic to pick up with the new rate.
+        mLayerHistory->clear();
+    }
+
+    return ret;
 }
 
 std::optional<HwcConfigIndexType> Scheduler::getPreferredConfigId() {
diff --git a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp
index 4a179b6..dd04076 100644
--- a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp
+++ b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp
@@ -21,6 +21,7 @@
 #include <log/log.h>
 #include <thread>
 
+#include "../../Scheduler/RefreshRateConfigs.h"
 #include "DisplayHardware/HWC2.h"
 #include "Scheduler/RefreshRateConfigs.h"
 
@@ -248,6 +249,7 @@
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_noLayers) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_72, HWC_GROUP_ID_0, VSYNC_72},
@@ -263,16 +265,17 @@
     auto layers = std::vector<LayerRequirement>{};
     EXPECT_EQ(expected72Config,
               refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/
-                                                             false));
+                                                             false, &ignored));
 
     // Current refresh rate can always be changed.
     refreshRateConfigs->setCurrentConfigId(HWC_CONFIG_ID_60);
     EXPECT_EQ(expected60Config,
               refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/
-                                                             false));
+                                                             false, &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_60_90) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}};
@@ -288,134 +291,163 @@
     lr.vote = LayerVoteType::Min;
     lr.name = "Min";
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.vote = LayerVoteType::Max;
     lr.name = "Max";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 90.0f;
     lr.vote = LayerVoteType::Heuristic;
     lr.name = "90Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 60.0f;
     lr.name = "60Hz Heuristic";
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 45.0f;
     lr.name = "45Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 30.0f;
     lr.name = "30Hz Heuristic";
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     lr.name = "24Hz Heuristic";
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.name = "";
     ASSERT_GE(refreshRateConfigs->setPolicy(HWC_CONFIG_ID_60, 60, 60, nullptr), 0);
 
     lr.vote = LayerVoteType::Min;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.vote = LayerVoteType::Max;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 90.0f;
     lr.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 45.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 30.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     ASSERT_GE(refreshRateConfigs->setPolicy(HWC_CONFIG_ID_90, 90, 90, nullptr), 0);
 
     lr.vote = LayerVoteType::Min;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.vote = LayerVoteType::Max;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 90.0f;
     lr.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 45.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 30.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     ASSERT_GE(refreshRateConfigs->setPolicy(HWC_CONFIG_ID_60, 0, 120, nullptr), 0);
     lr.vote = LayerVoteType::Min;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.vote = LayerVoteType::Max;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 90.0f;
     lr.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 45.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 30.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_60_72_90) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_72, HWC_GROUP_ID_0, VSYNC_72},
@@ -432,35 +464,43 @@
 
     lr.vote = LayerVoteType::Min;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.vote = LayerVoteType::Max;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 90.0f;
     lr.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 45.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 30.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_30_60_72_90_120) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_30, HWC_GROUP_ID_0, VSYNC_30},
              {HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
@@ -486,24 +526,28 @@
     lr2.desiredRefreshRate = 60.0f;
     lr2.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected120Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::Heuristic;
     lr2.desiredRefreshRate = 48.0f;
     lr2.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::Heuristic;
     lr2.desiredRefreshRate = 48.0f;
     lr2.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_30_60_90_120_DifferentTypes) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_30, HWC_GROUP_ID_0, VSYNC_30},
              {HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
@@ -531,7 +575,8 @@
     lr2.vote = LayerVoteType::Heuristic;
     lr2.name = "60Hz Heuristic";
     EXPECT_EQ(expected120Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
@@ -540,7 +585,8 @@
     lr2.vote = LayerVoteType::Heuristic;
     lr2.name = "60Hz Heuristic";
     EXPECT_EQ(expected120Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
@@ -549,7 +595,8 @@
     lr2.vote = LayerVoteType::ExplicitDefault;
     lr2.name = "60Hz ExplicitDefault";
     EXPECT_EQ(expected120Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
@@ -558,7 +605,8 @@
     lr2.vote = LayerVoteType::Heuristic;
     lr2.name = "90Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
@@ -567,7 +615,8 @@
     lr2.vote = LayerVoteType::ExplicitDefault;
     lr2.name = "90Hz Heuristic";
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::ExplicitDefault;
@@ -576,7 +625,8 @@
     lr2.vote = LayerVoteType::Heuristic;
     lr2.name = "90Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::Heuristic;
@@ -585,7 +635,8 @@
     lr2.vote = LayerVoteType::ExplicitDefault;
     lr2.name = "90Hz ExplicitDefault";
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
@@ -594,7 +645,8 @@
     lr2.vote = LayerVoteType::ExplicitDefault;
     lr2.name = "90Hz ExplicitDefault";
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.desiredRefreshRate = 24.0f;
     lr1.vote = LayerVoteType::ExplicitDefault;
@@ -603,10 +655,12 @@
     lr2.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr2.name = "90Hz ExplicitExactOrMultiple";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_30_60) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_30, HWC_GROUP_ID_0, VSYNC_30}}};
@@ -621,35 +675,43 @@
 
     lr.vote = LayerVoteType::Min;
     EXPECT_EQ(expected30Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.vote = LayerVoteType::Max;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 90.0f;
     lr.vote = LayerVoteType::Heuristic;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 45.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 30.0f;
     EXPECT_EQ(expected30Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_30_60_72_90) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_30, HWC_GROUP_ID_0, VSYNC_30},
              {HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
@@ -669,57 +731,71 @@
     lr.vote = LayerVoteType::Min;
     lr.name = "Min";
     EXPECT_EQ(expected30Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.vote = LayerVoteType::Max;
     lr.name = "Max";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 90.0f;
     lr.vote = LayerVoteType::Heuristic;
     lr.name = "90Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 60.0f;
     lr.name = "60Hz Heuristic";
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 45.0f;
     lr.name = "45Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 30.0f;
     lr.name = "30Hz Heuristic";
     EXPECT_EQ(expected30Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     lr.name = "24Hz Heuristic";
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true,
+                                                             &ignored));
 
     lr.desiredRefreshRate = 24.0f;
     lr.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr.name = "24Hz ExplicitExactOrMultiple";
     EXPECT_EQ(expected72Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ true,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_PriorityTest) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_30, HWC_GROUP_ID_0, VSYNC_30},
              {HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
@@ -739,48 +815,56 @@
     lr1.vote = LayerVoteType::Min;
     lr2.vote = LayerVoteType::Max;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::Min;
     lr2.vote = LayerVoteType::Heuristic;
     lr2.desiredRefreshRate = 24.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::Min;
     lr2.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr2.desiredRefreshRate = 24.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::Max;
     lr2.vote = LayerVoteType::Heuristic;
     lr2.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::Max;
     lr2.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr2.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::Heuristic;
     lr1.desiredRefreshRate = 15.0f;
     lr2.vote = LayerVoteType::Heuristic;
     lr2.desiredRefreshRate = 45.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::Heuristic;
     lr1.desiredRefreshRate = 30.0f;
     lr2.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr2.desiredRefreshRate = 45.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_24FpsVideo) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}};
@@ -798,7 +882,8 @@
     for (float fps = 23.0f; fps < 25.0f; fps += 0.1f) {
         lr.desiredRefreshRate = fps;
         const auto& refreshRate =
-                refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false);
+                refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                               &ignored);
         printf("%.2fHz chooses %s\n", fps, refreshRate.name.c_str());
         EXPECT_EQ(expected60Config, refreshRate);
     }
@@ -833,6 +918,7 @@
 }
 
 TEST_F(RefreshRateConfigsTest, twoDeviceConfigs_getRefreshRateForContentV2_Explicit) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}};
@@ -852,21 +938,24 @@
     lr2.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr2.desiredRefreshRate = 90.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::ExplicitDefault;
     lr1.desiredRefreshRate = 90.0f;
     lr2.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr2.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::Heuristic;
     lr1.desiredRefreshRate = 90.0f;
     lr2.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr2.desiredRefreshRate = 60.0f;
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, testInPolicy) {
@@ -880,6 +969,7 @@
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_75HzContent) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}};
@@ -897,13 +987,15 @@
     for (float fps = 75.0f; fps < 100.0f; fps += 0.1f) {
         lr.desiredRefreshRate = fps;
         const auto& refreshRate =
-                refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false);
+                refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                               &ignored);
         printf("%.2fHz chooses %s\n", fps, refreshRate.name.c_str());
         EXPECT_EQ(expected90Config, refreshRate);
     }
 }
 
 TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_Multiples) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}};
@@ -925,7 +1017,8 @@
     lr2.desiredRefreshRate = 90.0f;
     lr2.name = "90Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr1.desiredRefreshRate = 60.0f;
@@ -934,7 +1027,8 @@
     lr2.desiredRefreshRate = 90.0f;
     lr2.name = "90Hz ExplicitDefault";
     EXPECT_EQ(expected60Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr1.desiredRefreshRate = 60.0f;
@@ -942,7 +1036,8 @@
     lr2.vote = LayerVoteType::Max;
     lr2.name = "Max";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr1.desiredRefreshRate = 30.0f;
@@ -951,7 +1046,8 @@
     lr2.desiredRefreshRate = 90.0f;
     lr2.name = "90Hz Heuristic";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr1.desiredRefreshRate = 30.0f;
@@ -959,10 +1055,12 @@
     lr2.vote = LayerVoteType::Max;
     lr2.name = "Max";
     EXPECT_EQ(expected90Config,
-              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false));
+              refreshRateConfigs->getRefreshRateForContentV2(layers, /*touchActive*/ false,
+                                                             &ignored));
 }
 
 TEST_F(RefreshRateConfigsTest, scrollWhileWatching60fps_60_90) {
+    bool ignored;
     std::vector<RefreshRateConfigs::InputConfig> configs{
             {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
              {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}};
@@ -982,28 +1080,32 @@
     lr1.name = "60Hz ExplicitExactOrMultiple";
     lr2.vote = LayerVoteType::NoVote;
     lr2.name = "NoVote";
-    EXPECT_EQ(expected60Config, refreshRateConfigs->getRefreshRateForContentV2(layers, false));
+    EXPECT_EQ(expected60Config,
+              refreshRateConfigs->getRefreshRateForContentV2(layers, false, &ignored));
 
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr1.desiredRefreshRate = 60.0f;
     lr1.name = "60Hz ExplicitExactOrMultiple";
     lr2.vote = LayerVoteType::NoVote;
     lr2.name = "NoVote";
-    EXPECT_EQ(expected90Config, refreshRateConfigs->getRefreshRateForContentV2(layers, true));
+    EXPECT_EQ(expected90Config,
+              refreshRateConfigs->getRefreshRateForContentV2(layers, true, &ignored));
 
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr1.desiredRefreshRate = 60.0f;
     lr1.name = "60Hz ExplicitExactOrMultiple";
     lr2.vote = LayerVoteType::Max;
     lr2.name = "Max";
-    EXPECT_EQ(expected90Config, refreshRateConfigs->getRefreshRateForContentV2(layers, true));
+    EXPECT_EQ(expected90Config,
+              refreshRateConfigs->getRefreshRateForContentV2(layers, true, &ignored));
 
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
     lr1.desiredRefreshRate = 60.0f;
     lr1.name = "60Hz ExplicitExactOrMultiple";
     lr2.vote = LayerVoteType::Max;
     lr2.name = "Max";
-    EXPECT_EQ(expected90Config, refreshRateConfigs->getRefreshRateForContentV2(layers, false));
+    EXPECT_EQ(expected90Config,
+              refreshRateConfigs->getRefreshRateForContentV2(layers, false, &ignored));
 
     // The other layer starts to provide buffers
     lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
@@ -1012,7 +1114,108 @@
     lr2.vote = LayerVoteType::Heuristic;
     lr2.desiredRefreshRate = 90.0f;
     lr2.name = "90Hz Heuristic";
-    EXPECT_EQ(expected90Config, refreshRateConfigs->getRefreshRateForContentV2(layers, false));
+    EXPECT_EQ(expected90Config,
+              refreshRateConfigs->getRefreshRateForContentV2(layers, false, &ignored));
+}
+
+TEST_F(RefreshRateConfigsTest, touchConsidered) {
+    bool touchConsidered;
+    std::vector<RefreshRateConfigs::InputConfig> configs{
+            {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
+             {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90}}};
+    auto refreshRateConfigs =
+            std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/HWC_CONFIG_ID_60);
+
+    refreshRateConfigs->getRefreshRateForContentV2({}, false, &touchConsidered);
+    EXPECT_EQ(false, touchConsidered);
+
+    refreshRateConfigs->getRefreshRateForContentV2({}, true, &touchConsidered);
+    EXPECT_EQ(true, touchConsidered);
+
+    auto layers = std::vector<LayerRequirement>{LayerRequirement{.weight = 1.0f},
+                                                LayerRequirement{.weight = 1.0f}};
+    auto& lr1 = layers[0];
+    auto& lr2 = layers[1];
+
+    lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
+    lr1.desiredRefreshRate = 60.0f;
+    lr1.name = "60Hz ExplicitExactOrMultiple";
+    lr2.vote = LayerVoteType::Heuristic;
+    lr2.name = "NoVote";
+    refreshRateConfigs->getRefreshRateForContentV2(layers, true, &touchConsidered);
+    EXPECT_EQ(true, touchConsidered);
+
+    lr1.vote = LayerVoteType::ExplicitDefault;
+    lr1.desiredRefreshRate = 60.0f;
+    lr1.name = "60Hz ExplicitExactOrMultiple";
+    lr2.vote = LayerVoteType::Heuristic;
+    lr2.name = "NoVote";
+    refreshRateConfigs->getRefreshRateForContentV2(layers, true, &touchConsidered);
+    EXPECT_EQ(false, touchConsidered);
+
+    lr1.vote = LayerVoteType::ExplicitExactOrMultiple;
+    lr1.desiredRefreshRate = 60.0f;
+    lr1.name = "60Hz ExplicitExactOrMultiple";
+    lr2.vote = LayerVoteType::Heuristic;
+    lr2.name = "NoVote";
+    refreshRateConfigs->getRefreshRateForContentV2(layers, true, &touchConsidered);
+    EXPECT_EQ(true, touchConsidered);
+
+    lr1.vote = LayerVoteType::ExplicitDefault;
+    lr1.desiredRefreshRate = 60.0f;
+    lr1.name = "60Hz ExplicitExactrMultiple";
+    lr2.vote = LayerVoteType::Heuristic;
+    lr2.name = "NoVote";
+    refreshRateConfigs->getRefreshRateForContentV2(layers, true, &touchConsidered);
+    EXPECT_EQ(false, touchConsidered);
+}
+
+TEST_F(RefreshRateConfigsTest, getRefreshRateForContentV2_ExplicitDefault) {
+    bool ignored;
+    std::vector<RefreshRateConfigs::InputConfig> configs{
+            {{HWC_CONFIG_ID_60, HWC_GROUP_ID_0, VSYNC_60},
+             {HWC_CONFIG_ID_72, HWC_GROUP_ID_0, VSYNC_72},
+             {HWC_CONFIG_ID_90, HWC_GROUP_ID_0, VSYNC_90},
+             {HWC_CONFIG_ID_120, HWC_GROUP_ID_0, VSYNC_120}}};
+
+    auto refreshRateConfigs = std::make_unique<RefreshRateConfigs>(configs, /*currentConfigId=*/
+                                                                   HWC_CONFIG_ID_60);
+
+    auto layers = std::vector<LayerRequirement>{LayerRequirement{.weight = 1.0f}};
+    auto& lr = layers[0];
+
+    // Prepare a table with the vote and the expected refresh rate
+    const std::vector<std::pair<float, float>> testCases = {
+            {130, 120}, {120, 120}, {119, 120}, {110, 120},
+
+            {100, 90},  {90, 90},   {89, 90},
+
+            {80, 72},   {73, 72},   {72, 72},   {71, 72},   {70, 72},
+
+            {65, 60},   {60, 60},   {59, 60},   {58, 60},
+
+            {55, 90},   {50, 90},   {45, 90},
+
+            {42, 120},  {40, 120},  {39, 120},
+
+            {37, 72},   {36, 72},   {35, 72},
+
+            {30, 60},
+    };
+
+    for (const auto& test : testCases) {
+        lr.vote = LayerVoteType::ExplicitDefault;
+        lr.desiredRefreshRate = test.first;
+
+        std::stringstream ss;
+        ss << "ExplicitDefault " << test.first << " fps";
+        lr.name = ss.str();
+
+        const auto& refreshRate =
+                refreshRateConfigs->getRefreshRateForContentV2(layers, false, &ignored);
+        EXPECT_FLOAT_EQ(refreshRate.fps, test.second)
+                << "Expecting " << test.first << "fps => " << test.second << "Hz";
+    }
 }
 
 } // namespace