SF: Rename HwcConfigIndexType to DisplayModeId
Bug: 159590486
Bug: 176148651
Test: atest libsurfaceflinger_unittest
Change-Id: Ie177b213bb7a8ab9f67a51d2b5cf27d8fd97b780
diff --git a/services/surfaceflinger/DisplayHardware/DisplayMode.h b/services/surfaceflinger/DisplayHardware/DisplayMode.h
index 69fd00e..7ae54f1 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayMode.h
+++ b/services/surfaceflinger/DisplayHardware/DisplayMode.h
@@ -17,11 +17,12 @@
#pragma once
#include "DisplayHardware/Hal.h"
-#include "Scheduler/HwcStrongTypes.h"
+#include "Scheduler/StrongTyping.h"
#include <android/configuration.h>
#include <utils/Timers.h>
+#include <cstddef>
#include <memory>
#include <vector>
@@ -32,6 +33,7 @@
class DisplayMode;
using DisplayModePtr = std::shared_ptr<const DisplayMode>;
using DisplayModes = std::vector<DisplayModePtr>;
+using DisplayModeId = StrongTyping<size_t, struct DisplayModeIdTag, Compare, Hash>;
class DisplayMode {
public:
@@ -43,7 +45,7 @@
return std::const_pointer_cast<const DisplayMode>(std::move(mDisplayMode));
}
- Builder& setId(HwcConfigIndexType id) {
+ Builder& setId(DisplayModeId id) {
mDisplayMode->mId = id;
return *this;
}
@@ -104,7 +106,7 @@
std::shared_ptr<DisplayMode> mDisplayMode;
};
- HwcConfigIndexType getId() const { return mId; }
+ DisplayModeId getId() const { return mId; }
hal::HWConfigId getHwcId() const { return mHwcId; }
int32_t getWidth() const { return mWidth; }
@@ -118,7 +120,7 @@
explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {}
hal::HWConfigId mHwcId;
- HwcConfigIndexType mId;
+ DisplayModeId mId;
int32_t mWidth = -1;
int32_t mHeight = -1;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index ca67935..6350144 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -318,7 +318,7 @@
displayData.modes.clear();
for (auto configId : configIds) {
auto mode = DisplayMode::Builder(configId)
- .setId(HwcConfigIndexType(displayData.modes.size()))
+ .setId(DisplayModeId(displayData.modes.size()))
.setWidth(getAttribute(hwcDisplayId, configId, hal::Attribute::WIDTH))
.setHeight(getAttribute(hwcDisplayId, configId, hal::Attribute::HEIGHT))
.setVsyncPeriod(getAttribute(hwcDisplayId, configId,
@@ -674,7 +674,7 @@
}
status_t HWComposer::setActiveModeWithConstraints(
- PhysicalDisplayId displayId, HwcConfigIndexType modeId,
+ PhysicalDisplayId displayId, DisplayModeId modeId,
const hal::VsyncPeriodChangeConstraints& constraints,
hal::VsyncPeriodChangeTimeline* outTimeline) {
RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX);
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 2b3d2d4..59c3699 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -198,7 +198,7 @@
virtual DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const = 0;
virtual bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const = 0;
virtual nsecs_t getDisplayVsyncPeriod(PhysicalDisplayId) const = 0;
- virtual status_t setActiveModeWithConstraints(PhysicalDisplayId, HwcConfigIndexType,
+ virtual status_t setActiveModeWithConstraints(PhysicalDisplayId, DisplayModeId,
const hal::VsyncPeriodChangeConstraints&,
hal::VsyncPeriodChangeTimeline* outTimeline) = 0;
virtual status_t setAutoLowLatencyMode(PhysicalDisplayId, bool on) = 0;
@@ -329,7 +329,7 @@
DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const override;
bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const override;
nsecs_t getDisplayVsyncPeriod(PhysicalDisplayId displayId) const override;
- status_t setActiveModeWithConstraints(PhysicalDisplayId, HwcConfigIndexType,
+ status_t setActiveModeWithConstraints(PhysicalDisplayId, DisplayModeId,
const hal::VsyncPeriodChangeConstraints&,
hal::VsyncPeriodChangeTimeline* outTimeline) override;
status_t setAutoLowLatencyMode(PhysicalDisplayId, bool) override;