SF: register layers with scheduler when added to current state
Scheduler shouldn't care about layers that are not part of the
current state as those layers are invisible.
Test: atest SetFrameRateTest
Bug: 186190571
Change-Id: Iee5a8ab6d54989f4a663e2fb51e3e956dd3cfa6e
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 4fee723..7713749 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -221,7 +221,10 @@
}
void Layer::removeFromCurrentState() {
- mRemovedFromCurrentState = true;
+ if (!mRemovedFromCurrentState) {
+ mRemovedFromCurrentState = true;
+ mFlinger->mScheduler->deregisterLayer(this);
+ }
mFlinger->markLayerPendingRemovalLocked(this);
}
@@ -246,7 +249,10 @@
}
void Layer::addToCurrentState() {
- mRemovedFromCurrentState = false;
+ if (mRemovedFromCurrentState) {
+ mRemovedFromCurrentState = false;
+ mFlinger->mScheduler->registerLayer(this);
+ }
for (const auto& child : mCurrentChildren) {
child->addToCurrentState();