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