1package { 2 // See: http://go/android-license-faq 3 // A large-scale-change added 'default_applicable_licenses' to import 4 // all of the 'license_kinds' from "frameworks_native_license" 5 // to get the below license kinds: 6 // SPDX-license-identifier-Apache-2.0 7 default_applicable_licenses: ["frameworks_native_license"], 8 default_team: "trendy_team_android_core_graphics_stack", 9} 10 11aconfig_declarations { 12 name: "surfaceflinger_flags", 13 package: "com.android.graphics.surfaceflinger.flags", 14 container: "system", 15 srcs: [ 16 "surfaceflinger_flags.aconfig", 17 "surfaceflinger_flags_new.aconfig", 18 ], 19} 20 21cc_aconfig_library { 22 name: "libsurfaceflingerflags", 23 aconfig_declarations: "surfaceflinger_flags", 24} 25 26cc_defaults { 27 name: "surfaceflinger_defaults", 28 cflags: [ 29 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", 30 "-Wall", 31 "-Wconversion", 32 "-Werror", 33 "-Wextra", 34 "-Wformat", 35 "-Wthread-safety", 36 "-Wunreachable-code", 37 "-Wunused", 38 ], 39} 40 41cc_defaults { 42 name: "libsurfaceflinger_defaults", 43 defaults: [ 44 "android.hardware.graphics.composer3-ndk_shared", 45 "librenderengine_deps", 46 "libsurfaceflinger_common_deps", 47 "libsurfaceflinger_proto_deps", 48 "libtimestats_deps", 49 "poweradvisor_deps", 50 "surfaceflinger_defaults", 51 ], 52 cflags: [ 53 "-DEGL_EGLEXT_PROTOTYPES", 54 "-DGL_GLEXT_PROTOTYPES", 55 "-DLOG_TAG=\"SurfaceFlinger\"", 56 ], 57 shared_libs: [ 58 "android.hardware.common-V2-ndk", 59 "android.hardware.common.fmq-V1-ndk", 60 "android.hardware.configstore-utils", 61 "android.hardware.configstore@1.0", 62 "android.hardware.configstore@1.1", 63 "android.hardware.graphics.allocator@2.0", 64 "android.hardware.graphics.allocator@3.0", 65 "android.hardware.graphics.common@1.2", 66 "android.hardware.graphics.composer@2.1", 67 "android.hardware.graphics.composer@2.2", 68 "android.hardware.graphics.composer@2.3", 69 "android.hardware.graphics.composer@2.4", 70 "android.os.flags-aconfig-cc-host", 71 "libEGL", 72 "libGLESv1_CM", 73 "libGLESv2", 74 "libSurfaceFlingerProp", 75 "libaconfig_storage_read_api_cc", 76 "libbase", 77 "libbinder", 78 "libbinder_ndk", 79 "libcutils", 80 "libfmq", 81 "libgui", 82 "libhidlbase", 83 "liblog", 84 "libnativewindow", 85 "libprocessgroup", 86 "libprotobuf-cpp-lite", 87 "libstatslog_surfaceflinger", 88 "libsync", 89 "libui", 90 "libutils", 91 ], 92 static_libs: [ 93 "iinputflinger_aidl_lib_static", 94 "libaidlcommonsupport", 95 "libcompositionengine", 96 "libgui_aidl_static", 97 "libperfetto_client_experimental", 98 "librenderengine", 99 "libscheduler", 100 "libserviceutils", 101 "libshaders", 102 "libsurfaceflingerflags", 103 "libtimestats", 104 "libtonemap", 105 ], 106 header_libs: [ 107 "android.hardware.graphics.composer3-command-buffer", 108 "android.hardware.graphics.composer@2.1-command-buffer", 109 "android.hardware.graphics.composer@2.2-command-buffer", 110 "android.hardware.graphics.composer@2.3-command-buffer", 111 "android.hardware.graphics.composer@2.4-command-buffer", 112 ], 113 export_static_lib_headers: [ 114 "libcompositionengine", 115 "librenderengine", 116 "libserviceutils", 117 "libtimestats", 118 ], 119 export_shared_lib_headers: [ 120 "android.hardware.graphics.allocator@2.0", 121 "android.hardware.graphics.allocator@3.0", 122 "android.hardware.graphics.common@1.2", 123 "android.hardware.graphics.composer@2.1", 124 "android.hardware.graphics.composer@2.2", 125 "android.hardware.graphics.composer@2.3", 126 "android.hardware.graphics.composer@2.4", 127 "libhidlbase", 128 "libpowermanager", 129 ], 130 // TODO (marissaw): this library is not used by surfaceflinger. This is here so 131 // the library compiled in a way that is accessible to system partition when running 132 // IMapper's VTS. 133 required: ["libgralloctypes"], 134} 135 136cc_defaults { 137 name: "libsurfaceflinger_production_defaults", 138 defaults: ["libsurfaceflinger_defaults"], 139 lto: { 140 thin: true, 141 }, 142 whole_program_vtables: true, // Requires ThinLTO 143 afdo: true, 144 // TODO(b/131771163): Fix broken fuzzer support with LTO. 145 sanitize: { 146 fuzzer: false, 147 }, 148} 149 150// libsurfaceflinger_backend_{headers|sources} are a step towards pulling out 151// the "backend" sources to clean up the dependency graph between 152// CompositionEngine and SurfaceFlinger. Completing the cleanup would require 153// moving the headers in particular so that the dependency can strictly be a 154// DAG. There would certainly be additional cleanups: VirtualDisplaySurface.cpp 155// and FrameBufferSurface.cpp likely belong in CompositionEngine for example. 156cc_library_headers { 157 name: "libsurfaceflinger_backend_headers", 158 export_include_dirs: ["."], 159 static_libs: ["libserviceutils"], 160 export_static_lib_headers: ["libserviceutils"], 161 162 shared_libs: [ 163 "android.hardware.configstore-utils", 164 "android.hardware.configstore@1.0", 165 "android.hardware.configstore@1.1", 166 "libbinder_ndk", 167 ], 168 export_shared_lib_headers: [ 169 "android.hardware.configstore-utils", 170 "android.hardware.configstore@1.0", 171 "android.hardware.configstore@1.1", 172 "libbinder_ndk", 173 ], 174} 175 176filegroup { 177 name: "libsurfaceflinger_backend_sources", 178 srcs: [ 179 "DisplayHardware/AidlComposerHal.cpp", 180 "DisplayHardware/ComposerHal.cpp", 181 "DisplayHardware/FramebufferSurface.cpp", 182 "DisplayHardware/HWC2.cpp", 183 "DisplayHardware/HWComposer.cpp", 184 "DisplayHardware/HidlComposerHal.cpp", 185 "DisplayHardware/VirtualDisplaySurface.cpp", 186 "PowerAdvisor/*.cpp", 187 ], 188} 189 190cc_library_headers { 191 name: "libsurfaceflinger_headers", 192 export_include_dirs: ["."], 193 static_libs: ["libserviceutils"], 194 export_static_lib_headers: ["libserviceutils"], 195} 196 197filegroup { 198 name: "libsurfaceflinger_sources", 199 srcs: [ 200 ":libsurfaceflinger_backend_sources", 201 "ActivePictureTracker.cpp", 202 "BackgroundExecutor.cpp", 203 "Client.cpp", 204 "ClientCache.cpp", 205 "Display/DisplayModeController.cpp", 206 "Display/DisplaySnapshot.cpp", 207 "DisplayDevice.cpp", 208 "Effects/Daltonizer.cpp", 209 "FpsReporter.cpp", 210 "FrameTimeline/FrameTimeline.cpp", 211 "FrameTracer/FrameTracer.cpp", 212 "FrameTracker.cpp", 213 "FrontEnd/LayerCreationArgs.cpp", 214 "FrontEnd/LayerHandle.cpp", 215 "FrontEnd/LayerHierarchy.cpp", 216 "FrontEnd/LayerLifecycleManager.cpp", 217 "FrontEnd/LayerSnapshot.cpp", 218 "FrontEnd/LayerSnapshotBuilder.cpp", 219 "FrontEnd/RequestedLayerState.cpp", 220 "FrontEnd/TransactionHandler.cpp", 221 "HdrLayerInfoReporter.cpp", 222 "HdrSdrRatioOverlay.cpp", 223 "Jank/JankTracker.cpp", 224 "Layer.cpp", 225 "LayerFE.cpp", 226 "LayerProtoHelper.cpp", 227 "LayerVector.cpp", 228 "NativeWindowSurface.cpp", 229 "RefreshRateOverlay.cpp", 230 "RegionSamplingThread.cpp", 231 "Scheduler/EventThread.cpp", 232 "Scheduler/FrameRateOverrideMappings.cpp", 233 "Scheduler/LayerHistory.cpp", 234 "Scheduler/LayerInfo.cpp", 235 "Scheduler/MessageQueue.cpp", 236 "Scheduler/OneShotTimer.cpp", 237 "Scheduler/RefreshRateSelector.cpp", 238 "Scheduler/Scheduler.cpp", 239 "Scheduler/SmallAreaDetectionAllowMappings.cpp", 240 "Scheduler/VSyncDispatchTimerQueue.cpp", 241 "Scheduler/VSyncPredictor.cpp", 242 "Scheduler/VSyncReactor.cpp", 243 "Scheduler/VsyncConfiguration.cpp", 244 "Scheduler/VsyncModulator.cpp", 245 "Scheduler/VsyncSchedule.cpp", 246 "ScreenCaptureOutput.cpp", 247 "SurfaceFlinger.cpp", 248 "SurfaceFlingerDefaultFactory.cpp", 249 "Tracing/LayerDataSource.cpp", 250 "Tracing/LayerTracing.cpp", 251 "Tracing/TransactionDataSource.cpp", 252 "Tracing/TransactionProtoParser.cpp", 253 "Tracing/TransactionTracing.cpp", 254 "Tracing/tools/LayerTraceGenerator.cpp", 255 "TransactionCallbackInvoker.cpp", 256 "TunnelModeEnabledReporter.cpp", 257 "WindowInfosListenerInvoker.cpp", 258 ], 259} 260 261cc_defaults { 262 name: "libsurfaceflinger_binary", 263 defaults: [ 264 "libsurfaceflinger_production_defaults", 265 "surfaceflinger_defaults", 266 ], 267 cflags: [ 268 "-DLOG_TAG=\"SurfaceFlinger\"", 269 ], 270 shared_libs: [ 271 "android.hardware.configstore-utils", 272 "android.hardware.configstore@1.0", 273 "android.hardware.graphics.allocator@2.0", 274 "android.hardware.graphics.allocator@3.0", 275 "libbinder", 276 "libcutils", 277 "libhidlbase", 278 "liblog", 279 "libprocessgroup", 280 "libsync", 281 "libutils", 282 ], 283 static_libs: [ 284 "android.frameworks.displayservice@1.0", 285 "libdisplayservicehidl", 286 "libserviceutils", 287 ], 288} 289 290filegroup { 291 name: "surfaceflinger_binary_sources", 292 srcs: [ 293 ":libsurfaceflinger_sources", 294 "main_surfaceflinger.cpp", 295 ], 296} 297 298cc_binary { 299 name: "surfaceflinger", 300 defaults: ["libsurfaceflinger_binary"], 301 init_rc: ["surfaceflinger.rc"], 302 srcs: [ 303 ":surfaceflinger_binary_sources", 304 // Note: SurfaceFlingerFactory is not in the filegroup so that it 305 // can be easily replaced. 306 "SurfaceFlingerFactory.cpp", 307 ], 308 shared_libs: [ 309 "libSurfaceFlingerProp", 310 ], 311 312 logtags: ["surfaceflinger.logtags"], 313} 314 315subdirs = [ 316 "layerproto", 317 "tests", 318] 319 320cc_library_shared { 321 name: "libSurfaceFlingerProp", 322 srcs: [ 323 "SurfaceFlingerProperties.cpp", 324 ], 325 shared_libs: [ 326 "android.hardware.configstore-utils", 327 "android.hardware.configstore@1.0", 328 "android.hardware.configstore@1.1", 329 "android.hardware.graphics.common@1.2", 330 "libhidlbase", 331 "liblog", 332 "libui", 333 "libutils", 334 ], 335 static_libs: [ 336 "libSurfaceFlingerProperties", 337 ], 338 export_shared_lib_headers: [ 339 "android.hardware.graphics.common@1.2", 340 "libhidlbase", 341 "libui", 342 ], 343 export_static_lib_headers: [ 344 "libSurfaceFlingerProperties", 345 ], 346} 347 348cc_library { 349 name: "libstatslog_surfaceflinger", 350 generated_sources: ["statslog_surfaceflinger.cpp"], 351 generated_headers: ["statslog_surfaceflinger.h"], 352 export_generated_headers: ["statslog_surfaceflinger.h"], 353 shared_libs: [ 354 "android.os.statsbootstrap_aidl-cpp", 355 "libbinder", 356 "libstatsbootstrap", 357 "libutils", 358 ], 359} 360 361genrule { 362 name: "statslog_surfaceflinger.h", 363 tools: ["stats-log-api-gen"], 364 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_surfaceflinger.h" + 365 " --module surfaceflinger --namespace android,surfaceflinger,stats --bootstrap", 366 out: [ 367 "statslog_surfaceflinger.h", 368 ], 369} 370 371genrule { 372 name: "statslog_surfaceflinger.cpp", 373 tools: ["stats-log-api-gen"], 374 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_surfaceflinger.cpp" + 375 " --module surfaceflinger --namespace android,surfaceflinger,stats" + 376 " --importHeader statslog_surfaceflinger.h --bootstrap", 377 out: [ 378 "statslog_surfaceflinger.cpp", 379 ], 380} 381