Avoid traversal in tunnel mode reporter
We can just track whether we have a sideband stream or not using
a counter.
Test: Existing tests pass. simpleperf
Bug: 186200583
Change-Id: I40b0217c186517fc67fe55d8aecf26198561bc39
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 6c9905e..4af9506 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -70,6 +70,7 @@
#include "MonitoredProducer.h"
#include "SurfaceFlinger.h"
#include "TimeStats/TimeStats.h"
+#include "TunnelModeEnabledReporter.h"
#include "input/InputWindow.h"
#define DEBUG_RESIZE 0
@@ -172,6 +173,10 @@
mFrameTracker.logAndResetStats(mName);
mFlinger->onLayerDestroyed(this);
+
+ if (mDrawingState.sidebandStream != nullptr) {
+ mFlinger->mTunnelModeEnabledReporter->decrementTunnelModeCount();
+ }
}
LayerCreationArgs::LayerCreationArgs(SurfaceFlinger* flinger, sp<Client> client, std::string name,