SF: Fully disable content detection if opted out
Layer history was created but not recorded/traversed on devices without
refresh rate switching. ag/9549429 destroys stale history on traversal,
so the LayerInfo records were leaked.
Bug: 144363590
Test: Layer history is not created on crosshatch
Change-Id: I45ebc7c4f8447b2bc2bfb1af01325d562b4afed1
diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h
index c983475..346896c 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.h
+++ b/services/surfaceflinger/Scheduler/Scheduler.h
@@ -105,8 +105,8 @@
void registerLayer(Layer*);
void recordLayerHistory(Layer*, nsecs_t presentTime, bool isHDR);
- // Updates FPS based on the most content presented.
- void updateFpsBasedOnContent();
+ // Detects content using layer history, and selects a matching refresh rate.
+ void chooseRefreshRateForContent();
// Called by Scheduler to change refresh rate.
void setChangeRefreshRateCallback(ChangeRefreshRateCallback&&);
@@ -184,8 +184,8 @@
std::unique_ptr<DispSync> mPrimaryDispSync;
std::unique_ptr<EventControlThread> mEventControlThread;
- // Historical information about individual layers. Used for predicting the refresh rate.
- scheduler::LayerHistory mLayerHistory;
+ // Used to choose refresh rate if content detection is enabled.
+ std::optional<scheduler::LayerHistory> mLayerHistory;
// Whether to use idle timer callbacks that support the kernel timer.
const bool mSupportKernelTimer;