SF: Dedupe functions to apply Scheduler::Policy
The only functional difference is the early out when there is no change
in timer state, which now applies to LayerRequirement state as well.
Bug: 185535769
Test: libsurfaceflinger_unittest
Change-Id: Ia7234847e4f44d78dbf3920d77f38f3bfa40e5a2
diff --git a/services/surfaceflinger/Scheduler/LayerHistory.h b/services/surfaceflinger/Scheduler/LayerHistory.h
index cc55700..7b6096f 100644
--- a/services/surfaceflinger/Scheduler/LayerHistory.h
+++ b/services/surfaceflinger/Scheduler/LayerHistory.h
@@ -89,7 +89,7 @@
// worst case time complexity is O(2 * inactive + active)
void partitionLayers(nsecs_t now) REQUIRES(mLock);
- enum class layerStatus {
+ enum class LayerStatus {
NotFound,
LayerInActiveMap,
LayerInInactiveMap,
@@ -97,9 +97,11 @@
// looks up a layer by sequence id in both layerInfo maps.
// The first element indicates if and where the item was found
- std::pair<layerStatus, LayerHistory::LayerPair*> findLayer(int32_t id) REQUIRES(mLock);
- std::pair<layerStatus, const LayerHistory::LayerPair*> findLayer(int32_t id) const
- REQUIRES(mLock);
+ std::pair<LayerStatus, LayerPair*> findLayer(int32_t id) REQUIRES(mLock);
+
+ std::pair<LayerStatus, const LayerPair*> findLayer(int32_t id) const REQUIRES(mLock) {
+ return const_cast<LayerHistory*>(this)->findLayer(id);
+ }
mutable std::mutex mLock;