SF: fix BufferTX counter for null buffers
Don't increment the BufferTX counter is the transaction includes
a buffer change but that buffer is null.
Test: Open https://jsfiddle.net/8q7nuwh9/show in Chrome and scroll up down
Bug: 192352790
Change-Id: Ia0a27ff32fb20f20a1ac671f2b4fdb3ae22a8aea
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0c23dc1..ea23263 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6858,7 +6858,7 @@
void SurfaceFlinger::TransactionState::traverseStatesWithBuffers(
std::function<void(const layer_state_t&)> visitor) {
for (const auto& state : states) {
- if (state.state.hasBufferChanges() && (state.state.surface)) {
+ if (state.state.hasBufferChanges() && state.state.hasValidBuffer() && state.state.surface) {
visitor(state.state);
}
}