SF: Rename HwcConfigIndexType to DisplayModeId

Bug: 159590486
Bug: 176148651
Test: atest libsurfaceflinger_unittest

Change-Id: Ie177b213bb7a8ab9f67a51d2b5cf27d8fd97b780
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
index b02596a..0f1e267 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
@@ -489,7 +489,7 @@
 }
 
 std::optional<Fps> RefreshRateConfigs::onKernelTimerChanged(
-        std::optional<HwcConfigIndexType> desiredActiveConfigId, bool timerExpired) const {
+        std::optional<DisplayModeId> desiredActiveConfigId, bool timerExpired) const {
     std::lock_guard lock(mLock);
 
     const auto& current = desiredActiveConfigId ? *mRefreshRates.at(*desiredActiveConfigId)
@@ -554,26 +554,25 @@
     return *mRefreshRates.at(getCurrentPolicyLocked()->defaultConfig);
 }
 
-void RefreshRateConfigs::setCurrentConfigId(HwcConfigIndexType configId) {
+void RefreshRateConfigs::setCurrentConfigId(DisplayModeId configId) {
     std::lock_guard lock(mLock);
     mCurrentRefreshRate = mRefreshRates.at(configId).get();
 }
 
-RefreshRateConfigs::RefreshRateConfigs(const DisplayModes& configs,
-                                       HwcConfigIndexType currentConfigId)
+RefreshRateConfigs::RefreshRateConfigs(const DisplayModes& configs, DisplayModeId currentConfigId)
       : mKnownFrameRates(constructKnownFrameRates(configs)) {
     updateDisplayConfigs(configs, currentConfigId);
 }
 
 void RefreshRateConfigs::updateDisplayConfigs(const DisplayModes& configs,
-                                              HwcConfigIndexType currentConfigId) {
+                                              DisplayModeId currentConfigId) {
     std::lock_guard lock(mLock);
     LOG_ALWAYS_FATAL_IF(configs.empty());
     LOG_ALWAYS_FATAL_IF(currentConfigId.value() >= configs.size());
 
     mRefreshRates.clear();
-    for (auto configId = HwcConfigIndexType(0); configId.value() < configs.size(); configId++) {
-        const auto& config = configs.at(static_cast<size_t>(configId.value()));
+    for (const auto& config : configs) {
+        const auto configId = config->getId();
         const auto fps = Fps::fromPeriodNsecs(config->getVsyncPeriod());
         mRefreshRates.emplace(configId,
                               std::make_unique<RefreshRate>(configId, config, fps,
@@ -663,7 +662,7 @@
     return mDisplayManagerPolicy;
 }
 
-bool RefreshRateConfigs::isConfigAllowed(HwcConfigIndexType config) const {
+bool RefreshRateConfigs::isConfigAllowed(DisplayModeId config) const {
     std::lock_guard lock(mLock);
     for (const RefreshRate* refreshRate : mAppRequestRefreshRates) {
         if (refreshRate->configId == config) {