[sf] Add traces with log fatals
If we have to abort flinger, capture a transaction trace to
disk as well. This will help us understand what lead to the
unexpected state.
Test: presubmit
Bug: 238781169
Change-Id: I3ba9004ef8fc3cc2b9f7f431f9ceefafda858db7
diff --git a/services/surfaceflinger/Tracing/TransactionTracing.cpp b/services/surfaceflinger/Tracing/TransactionTracing.cpp
index 7e330b9..bc69191 100644
--- a/services/surfaceflinger/Tracing/TransactionTracing.cpp
+++ b/services/surfaceflinger/Tracing/TransactionTracing.cpp
@@ -111,7 +111,7 @@
update.createdLayers = std::move(newUpdate.layerCreationArgs);
newUpdate.layerCreationArgs.clear();
update.destroyedLayerHandles.reserve(newUpdate.destroyedHandles.size());
- for (uint32_t handle : newUpdate.destroyedHandles) {
+ for (auto& [handle, _] : newUpdate.destroyedHandles) {
update.destroyedLayerHandles.push_back(handle);
}
mPendingUpdates.emplace_back(update);
diff --git a/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp b/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp
index 519ef44..321b8ba 100644
--- a/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp
+++ b/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp
@@ -109,11 +109,11 @@
ALOGV(" destroyedHandles=%d", entry.destroyed_layers(j));
}
- std::vector<uint32_t> destroyedHandles;
+ std::vector<std::pair<uint32_t, std::string>> destroyedHandles;
destroyedHandles.reserve((size_t)entry.destroyed_layer_handles_size());
for (int j = 0; j < entry.destroyed_layer_handles_size(); j++) {
ALOGV(" destroyedHandles=%d", entry.destroyed_layer_handles(j));
- destroyedHandles.push_back(entry.destroyed_layer_handles(j));
+ destroyedHandles.push_back({entry.destroyed_layer_handles(j), ""});
}
bool displayChanged = entry.displays_changed();