SurfaceFlinger: delete RefreshRate copy constructor
Avoid copying RefreshRate objects
Change-Id: Ic00f14bd03465d163e82ee7f4bf34346f1920ad6
Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest
Bug: 150887328
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
index c8aec86..9cd5959 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
@@ -59,6 +59,8 @@
configGroup(configGroup),
name(std::move(name)),
fps(fps) {}
+
+ RefreshRate(const RefreshRate&) = delete;
// This config ID corresponds to the position of the config in the vector that is stored
// on the device.
const HwcConfigIndexType configId;
@@ -85,7 +87,8 @@
bool operator==(const RefreshRate& other) const { return !(*this != other); }
};
- using AllRefreshRatesMapType = std::unordered_map<HwcConfigIndexType, const RefreshRate>;
+ using AllRefreshRatesMapType =
+ std::unordered_map<HwcConfigIndexType, std::unique_ptr<const RefreshRate>>;
// Sets the current policy to choose refresh rates. Returns NO_ERROR if the requested policy is
// valid, or a negative error value otherwise. policyChanged, if non-null, will be set to true
@@ -163,7 +166,7 @@
// Returns the refresh rate that corresponds to a HwcConfigIndexType. This won't change at
// runtime.
const RefreshRate& getRefreshRateFromConfigId(HwcConfigIndexType configId) const {
- return mRefreshRates.at(configId);
+ return *mRefreshRates.at(configId);
};
// Stores the current configId the device operates at