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/tests/unittests/TestableScheduler.h b/services/surfaceflinger/tests/unittests/TestableScheduler.h
index ae6aa89..40c00c4 100644
--- a/services/surfaceflinger/tests/unittests/TestableScheduler.h
+++ b/services/surfaceflinger/tests/unittests/TestableScheduler.h
@@ -21,6 +21,7 @@
#include "Scheduler/DispSync.h"
#include "Scheduler/EventThread.h"
+#include "Scheduler/LayerHistory.h"
#include "Scheduler/Scheduler.h"
namespace android {
@@ -28,18 +29,26 @@
class TestableScheduler : public Scheduler {
public:
explicit TestableScheduler(const scheduler::RefreshRateConfigs& configs)
- : Scheduler([](bool) {}, configs) {}
+ : Scheduler([](bool) {}, configs) {
+ mLayerHistory.emplace();
+ }
TestableScheduler(std::unique_ptr<DispSync> primaryDispSync,
std::unique_ptr<EventControlThread> eventControlThread,
const scheduler::RefreshRateConfigs& configs)
- : Scheduler(std::move(primaryDispSync), std::move(eventControlThread), configs) {}
+ : Scheduler(std::move(primaryDispSync), std::move(eventControlThread), configs) {
+ mLayerHistory.emplace();
+ }
// Used to inject mock event thread.
ConnectionHandle createConnection(std::unique_ptr<EventThread> eventThread) {
return Scheduler::createConnection(std::move(eventThread));
}
+ size_t layerHistorySize() const NO_THREAD_SAFETY_ANALYSIS {
+ return mLayerHistory->mLayerInfos.size();
+ }
+
/* ------------------------------------------------------------------------
* Read-write access to private data to set up preconditions and assert
* post-conditions.