Add SurfaceInterceptor initial implementation
SurfaceInterceptor allows capturing streams of surface updates
that come into SurfaceFlinger. It captures the creation and
deletion of surfaces, changes to a surface like size or position,
buffer updates, and hw vsync updates (for a complete list of what
is captured see
/frameworks/native/cmds/surfacecapturereplay/proto/src/trace.proto)
SurfaceInterceptor uses a protocol buffer object to store each
trace. This allows for the produced trace to be either played back
into SurfaceFlinger or manually inspected.
To enable the interceptor: service call SurfaceFlinger 1020 i32 1
To disable the interceptor: service call SurfaceFlinger 1020 i32 0
Each trace file will be saved to /data/SurfaceTrace.dat
For SurfaceInterceptor to work SELinux must be set to permissive.
Change-Id: I5adff9dcd19456d86cfd5b1f51096dff9990e086
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index 2a8fa4a..ad62ba6 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -18,6 +18,7 @@
MessageQueue.cpp \
MonitoredProducer.cpp \
SurfaceFlingerConsumer.cpp \
+ SurfaceInterceptor.cpp \
Transform.cpp \
DisplayHardware/FramebufferSurface.cpp \
DisplayHardware/HWC2.cpp \
@@ -36,11 +37,12 @@
RenderEngine/Texture.cpp \
RenderEngine/GLES10RenderEngine.cpp \
RenderEngine/GLES11RenderEngine.cpp \
- RenderEngine/GLES20RenderEngine.cpp
+ RenderEngine/GLES20RenderEngine.cpp \
+LOCAL_MODULE := libsurfaceflinger
LOCAL_C_INCLUDES := \
- frameworks/native/vulkan/include \
- external/vulkan-validation-layers/libs/vkjson
+ frameworks/native/vulkan/include \
+ external/vulkan-validation-layers/libs/vkjson \
LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
@@ -108,7 +110,7 @@
LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
LOCAL_CFLAGS += -std=c++14
-LOCAL_STATIC_LIBRARIES := libvkjson
+LOCAL_STATIC_LIBRARIES := libtrace_proto libvkjson
LOCAL_SHARED_LIBRARIES := \
libcutils \
liblog \
@@ -122,9 +124,8 @@
libui \
libgui \
libpowermanager \
- libvulkan
-
-LOCAL_MODULE := libsurfaceflinger
+ libvulkan \
+ libprotobuf-cpp-full
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
@@ -158,6 +159,7 @@
libdl
LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain
+LOCAL_STATIC_LIBRARIES := libtrace_proto
LOCAL_MODULE := surfaceflinger