Merge "Check if the trace was stopped before starting the tracing thread" into rvc-dev am: 164a1d8b1e
Change-Id: I1c338406868c062b84741160e5b10192ecc88259
diff --git a/services/surfaceflinger/SurfaceTracing.cpp b/services/surfaceflinger/SurfaceTracing.cpp
index 0b1251e..f0b895d 100644
--- a/services/surfaceflinger/SurfaceTracing.cpp
+++ b/services/surfaceflinger/SurfaceTracing.cpp
@@ -36,22 +36,21 @@
: mFlinger(flinger), mSfLock(flinger.mDrawingStateLock) {}
void SurfaceTracing::mainLoop() {
- addFirstEntry();
- bool enabled = true;
+ bool enabled = addFirstEntry();
while (enabled) {
LayersTraceProto entry = traceWhenNotified();
enabled = addTraceToBuffer(entry);
}
}
-void SurfaceTracing::addFirstEntry() {
+bool SurfaceTracing::addFirstEntry() {
const auto displayDevice = mFlinger.getDefaultDisplayDevice();
LayersTraceProto entry;
{
std::scoped_lock lock(mSfLock);
entry = traceLayersLocked("tracing.enable", displayDevice);
}
- addTraceToBuffer(entry);
+ return addTraceToBuffer(entry);
}
LayersTraceProto SurfaceTracing::traceWhenNotified() {
diff --git a/services/surfaceflinger/SurfaceTracing.h b/services/surfaceflinger/SurfaceTracing.h
index a00e5d6..e90fc4d 100644
--- a/services/surfaceflinger/SurfaceTracing.h
+++ b/services/surfaceflinger/SurfaceTracing.h
@@ -90,7 +90,7 @@
};
void mainLoop();
- void addFirstEntry();
+ bool addFirstEntry();
LayersTraceProto traceWhenNotified();
LayersTraceProto traceLayersLocked(const char* where,
const sp<const DisplayDevice>& displayDevice)