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}
9
10cc_defaults {
11    name: "surfaceflinger_defaults",
12    cflags: [
13        "-Wall",
14        "-Werror",
15        "-Wextra",
16        "-Wformat",
17        "-Wthread-safety",
18        "-Wunused",
19        "-Wunreachable-code",
20        "-Wconversion",
21    ],
22}
23
24cc_defaults {
25    name: "libsurfaceflinger_defaults",
26    defaults: [
27        "surfaceflinger_defaults",
28        "skia_renderengine_deps",
29    ],
30    cflags: [
31        "-DLOG_TAG=\"SurfaceFlinger\"",
32        "-DGL_GLEXT_PROTOTYPES",
33        "-DEGL_EGLEXT_PROTOTYPES",
34    ],
35    shared_libs: [
36        "android.hardware.configstore-utils",
37        "android.hardware.configstore@1.0",
38        "android.hardware.configstore@1.1",
39        "android.hardware.graphics.allocator@2.0",
40        "android.hardware.graphics.allocator@3.0",
41        "android.hardware.graphics.common@1.2",
42        "android.hardware.graphics.composer@2.1",
43        "android.hardware.graphics.composer@2.2",
44        "android.hardware.graphics.composer@2.3",
45        "android.hardware.graphics.composer@2.4",
46        "android.hardware.power@1.0",
47        "android.hardware.power@1.3",
48        "android.hardware.power-V1-cpp",
49        "libbase",
50        "libbinder",
51        "libcutils",
52        "libEGL",
53        "libfmq",
54        "libGLESv1_CM",
55        "libGLESv2",
56        "libgui",
57        "libhidlbase",
58        "liblayers_proto",
59        "liblog",
60        "libnativewindow",
61        "libprocessgroup",
62        "libprotobuf-cpp-lite",
63        "libsync",
64        "libtimestats",
65        "libui",
66        "libinput",
67        "libutils",
68        "libSurfaceFlingerProp",
69    ],
70    static_libs: [
71        "libcompositionengine",
72        "libframetimeline",
73        "libperfetto_client_experimental",
74        "librenderengine",
75        "libserviceutils",
76        "libtrace_proto",
77    ],
78    header_libs: [
79        "android.hardware.graphics.composer@2.1-command-buffer",
80        "android.hardware.graphics.composer@2.2-command-buffer",
81        "android.hardware.graphics.composer@2.3-command-buffer",
82        "android.hardware.graphics.composer@2.4-command-buffer",
83    ],
84    export_static_lib_headers: [
85        "libcompositionengine",
86        "librenderengine",
87        "libserviceutils",
88    ],
89    export_shared_lib_headers: [
90        "android.hardware.graphics.allocator@2.0",
91        "android.hardware.graphics.allocator@3.0",
92        "android.hardware.graphics.common@1.2",
93        "android.hardware.graphics.composer@2.1",
94        "android.hardware.graphics.composer@2.2",
95        "android.hardware.graphics.composer@2.3",
96        "android.hardware.graphics.composer@2.4",
97        "android.hardware.power@1.3",
98        "libhidlbase",
99        "libtimestats",
100    ],
101    // TODO (marissaw): this library is not used by surfaceflinger. This is here so
102    // the library compiled in a way that is accessible to system partition when running
103    // IMapper's VTS.
104    required: ["libgralloctypes"]
105}
106
107cc_defaults {
108    name: "libsurfaceflinger_production_defaults",
109    defaults: ["libsurfaceflinger_defaults"],
110    cflags: [
111        "-fvisibility=hidden",
112    ],
113    lto: {
114        thin: true,
115    },
116    whole_program_vtables: true, // Requires ThinLTO
117    pgo: {
118        sampling: true,
119        profile_file: "surfaceflinger/surfaceflinger.profdata",
120    },
121    // TODO(b/131771163): Fix broken fuzzer support with LTO.
122    sanitize: {
123        fuzzer: false,
124    },
125}
126
127cc_library_headers {
128    name: "libsurfaceflinger_headers",
129    export_include_dirs: ["."],
130    static_libs: ["libserviceutils"],
131    export_static_lib_headers: ["libserviceutils"],
132}
133
134filegroup {
135    name: "libsurfaceflinger_sources",
136    srcs: [
137        "BufferLayer.cpp",
138        "BufferLayerConsumer.cpp",
139        "BufferQueueLayer.cpp",
140        "BufferStateLayer.cpp",
141        "ClientCache.cpp",
142        "Client.cpp",
143        "EffectLayer.cpp",
144        "ContainerLayer.cpp",
145        "DisplayDevice.cpp",
146        "DisplayHardware/ComposerHal.cpp",
147        "DisplayHardware/DisplayIdentification.cpp",
148        "DisplayHardware/FramebufferSurface.cpp",
149        "DisplayHardware/Hash.cpp",
150        "DisplayHardware/HWC2.cpp",
151        "DisplayHardware/HWComposer.cpp",
152        "DisplayHardware/PowerAdvisor.cpp",
153        "DisplayHardware/VirtualDisplaySurface.cpp",
154        "DisplayRenderArea.cpp",
155        "Effects/Daltonizer.cpp",
156        "EventLog/EventLog.cpp",
157        "FpsReporter.cpp",
158        "FrameTracer/FrameTracer.cpp",
159        "FrameTracker.cpp",
160        "HdrLayerInfoReporter.cpp",
161        "WindowInfosListenerInvoker.cpp",
162        "Layer.cpp",
163        "LayerProtoHelper.cpp",
164        "LayerRejecter.cpp",
165        "LayerRenderArea.cpp",
166        "LayerVector.cpp",
167        "MonitoredProducer.cpp",
168        "NativeWindowSurface.cpp",
169        "RefreshRateOverlay.cpp",
170        "RegionSamplingThread.cpp",
171        "RenderArea.cpp",
172        "Scheduler/DispSyncSource.cpp",
173        "Scheduler/EventThread.cpp",
174        "Scheduler/OneShotTimer.cpp",
175        "Scheduler/LayerHistory.cpp",
176        "Scheduler/LayerInfo.cpp",
177        "Scheduler/MessageQueue.cpp",
178        "Scheduler/RefreshRateConfigs.cpp",
179        "Scheduler/Scheduler.cpp",
180        "Scheduler/SchedulerUtils.cpp",
181        "Scheduler/Timer.cpp",
182        "Scheduler/VSyncDispatchTimerQueue.cpp",
183        "Scheduler/VSyncPredictor.cpp",
184        "Scheduler/VsyncModulator.cpp",
185        "Scheduler/VSyncReactor.cpp",
186        "Scheduler/VsyncConfiguration.cpp",
187        "StartPropertySetThread.cpp",
188        "SurfaceFlinger.cpp",
189        "SurfaceFlingerDefaultFactory.cpp",
190        "SurfaceInterceptor.cpp",
191        "SurfaceTracing.cpp",
192        "TransactionCallbackInvoker.cpp",
193        "TunnelModeEnabledReporter.cpp",
194    ],
195}
196
197cc_defaults {
198    name: "libsurfaceflinger_binary",
199    defaults: [
200        "surfaceflinger_defaults",
201        "libsurfaceflinger_production_defaults",
202    ],
203    cflags: [
204        "-DLOG_TAG=\"SurfaceFlinger\"",
205    ],
206    shared_libs: [
207        "android.frameworks.displayservice@1.0",
208        "android.hardware.configstore-utils",
209        "android.hardware.configstore@1.0",
210        "android.hardware.graphics.allocator@2.0",
211        "android.hardware.graphics.allocator@3.0",
212        "libbinder",
213        "libcutils",
214        "libdisplayservicehidl",
215        "libhidlbase",
216        "liblayers_proto",
217        "liblog",
218        "libprocessgroup",
219        "libsync",
220        "libutils",
221    ],
222    static_libs: [
223        "libserviceutils",
224        "libtrace_proto",
225    ],
226}
227
228filegroup {
229    name: "surfaceflinger_binary_sources",
230    srcs: [
231        ":libsurfaceflinger_sources",
232        "main_surfaceflinger.cpp",
233    ],
234}
235
236cc_binary {
237    name: "surfaceflinger",
238    defaults: ["libsurfaceflinger_binary"],
239    init_rc: ["surfaceflinger.rc"],
240    srcs: [
241        ":surfaceflinger_binary_sources",
242        // Note: SurfaceFlingerFactory is not in the filegroup so that it
243        // can be easily replaced.
244        "SurfaceFlingerFactory.cpp",
245    ],
246    shared_libs: [
247        "libSurfaceFlingerProp",
248    ],
249
250     logtags: ["EventLog/EventLogTags.logtags"],
251}
252
253subdirs = [
254    "layerproto",
255    "tests",
256]
257
258cc_library_shared {
259    name: "libSurfaceFlingerProp",
260    srcs: [
261        "SurfaceFlingerProperties.cpp",
262    ],
263    shared_libs: [
264        "android.hardware.configstore-utils",
265        "android.hardware.configstore@1.0",
266        "android.hardware.configstore@1.1",
267        "android.hardware.graphics.common@1.2",
268        "libhidlbase",
269        "libui",
270        "libutils",
271        "liblog",
272    ],
273    static_libs: [
274        "SurfaceFlingerProperties",
275    ],
276    export_shared_lib_headers: [
277        "android.hardware.graphics.common@1.2",
278        "libhidlbase",
279        "libui",
280    ],
281    export_static_lib_headers: [
282        "SurfaceFlingerProperties",
283    ],
284}
285