Read prop for Skia tracing after boot

Mendel sets the sysprop after RenderEngine has been created, but before
boot finishes. Delay reading the sysprop until boot has finished so it
will get the correct value.

Rather thatn calling into Skia directly from SurfaceFlinger, pass the
boolean to RenderEngine, which now has an API that is implemented by
SkiaRenderEngine to turn on tracing inside Skia. This also allows us to
call the thread-unsafe method from the right thread.

Use FlagManager, which follows the normal path for setting Mendel flags
in SurfaceFlinger.

Bug: 204205165
Test: manual

Change-Id: Iba93ad6a4b51e336019a1c91dbfd10baafb6576f
diff --git a/libs/renderengine/threaded/RenderEngineThreaded.cpp b/libs/renderengine/threaded/RenderEngineThreaded.cpp
index a7176d3..203bb54 100644
--- a/libs/renderengine/threaded/RenderEngineThreaded.cpp
+++ b/libs/renderengine/threaded/RenderEngineThreaded.cpp
@@ -403,6 +403,18 @@
     return std::make_optional(tidFuture.get());
 }
 
+void RenderEngineThreaded::setEnableTracing(bool tracingEnabled) {
+    // This function is designed so it can run asynchronously, so we do not need to wait
+    // for the futures.
+    {
+        std::lock_guard lock(mThreadMutex);
+        mFunctionCalls.push([tracingEnabled](renderengine::RenderEngine& instance) {
+            ATRACE_NAME("REThreaded::setEnableTracing");
+            instance.setEnableTracing(tracingEnabled);
+        });
+    }
+    mCondition.notify_one();
+}
 } // namespace threaded
 } // namespace renderengine
 } // namespace android