xref: /aosp_15_r20/frameworks/native/services/inputflinger/Android.bp (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1// Copyright (C) 2013 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Default flags to be used throughout all libraries in inputflinger.
16package {
17    default_team: "trendy_team_input_framework",
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "frameworks_native_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["frameworks_native_license"],
24}
25
26inputflinger_tidy_checks = [
27    "android-*",
28]
29
30cc_defaults {
31    name: "inputflinger_defaults",
32    host_supported: true,
33    cpp_std: "c++20",
34    cflags: [
35        "-Wall",
36        "-Wextra",
37        "-Werror",
38        "-Wno-unused-parameter",
39        "-Wthread-safety",
40        "-Wshadow",
41        "-Wshadow-field-in-constructor-modified",
42        "-Wshadow-uncaptured-local",
43        "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
44    ],
45    sanitize: {
46        misc_undefined: [
47            "bounds",
48        ],
49    },
50    tidy: true,
51    tidy_checks: [
52        "-*", // Disable all checks not explicitly enabled for now
53    ] + inputflinger_tidy_checks,
54    tidy_checks_as_errors: inputflinger_tidy_checks,
55    target: {
56        host: {
57            sanitize: {
58                address: true,
59                diag: {
60                    cfi: true,
61                    integer_overflow: true,
62                    memtag_heap: true,
63                    undefined: true,
64                    misc_undefined: [
65                        "bounds",
66                        "all",
67                    ],
68                },
69            },
70            include_dirs: [
71                "bionic/libc/kernel/android/uapi/",
72                "bionic/libc/kernel/uapi",
73            ],
74            cflags: [
75                "-D__ANDROID_HOST__",
76            ],
77        },
78    },
79}
80
81/////////////////////////////////////////////////
82// libinputflinger
83/////////////////////////////////////////////////
84
85filegroup {
86    name: "libinputflinger_sources",
87    srcs: [
88        "InputCommonConverter.cpp",
89        "InputDeviceMetricsCollector.cpp",
90        "InputFilter.cpp",
91        "InputFilterCallbacks.cpp",
92        "InputProcessor.cpp",
93        "PointerChoreographer.cpp",
94        "PreferStylusOverTouchBlocker.cpp",
95        "UnwantedInteractionBlocker.cpp",
96    ],
97}
98
99cc_defaults {
100    name: "libinputflinger_defaults",
101    srcs: [":libinputflinger_sources"],
102    shared_libs: [
103        "android.hardware.input.processor-V1-ndk",
104        "com.android.server.inputflinger-ndk",
105        "libbase",
106        "libbinder",
107        "libbinder_ndk",
108        "libchrome",
109        "libcrypto",
110        "libcutils",
111        "libhidlbase",
112        "libinput",
113        "libkll",
114        "liblog",
115        "libprotobuf-cpp-lite",
116        "libstatslog",
117        "libutils",
118        "libstatspull",
119        "libstatssocket",
120        "packagemanager_aidl-cpp",
121        "server_configurable_flags",
122    ],
123    static_libs: [
124        "libattestation",
125        "libperfetto_client_experimental",
126        "libpalmrejection",
127        "libui-types",
128    ],
129    generated_headers: [
130        "cxx-bridge-header",
131        "inputflinger_rs_bootstrap_bridge_header",
132    ],
133    header_libs: ["inputflinger_rs_bootstrap_cxx_headers"],
134    generated_sources: ["inputflinger_rs_bootstrap_bridge_code"],
135    whole_static_libs: ["libinputflinger_rs"],
136    export_shared_lib_headers: ["com.android.server.inputflinger-ndk"],
137    target: {
138        android: {
139            shared_libs: [
140                "libgui",
141            ],
142        },
143    },
144}
145
146cc_library_shared {
147    name: "libinputflinger",
148    host_supported: true,
149    defaults: [
150        "inputflinger_defaults",
151        "libinputflinger_defaults",
152    ],
153    srcs: [
154        "InputManager.cpp",
155        // other sources are added via "defaults"
156    ],
157    cflags: [
158        // TODO(b/23084678): Move inputflinger to its own process and mark it hidden
159        //-fvisibility=hidden
160    ],
161    shared_libs: [
162        // This should consist only of dependencies from inputflinger. Other dependencies should be
163        // in cc_defaults so that they are included in the tests.
164        "libinputflinger_base",
165        "libinputreader",
166        "libinputreporter",
167        "libPlatformProperties",
168    ],
169    static_libs: [
170        "libinputdispatcher",
171    ],
172    export_static_lib_headers: [
173        "libinputdispatcher",
174    ],
175    export_shared_lib_headers: [
176        "libinputflinger_base",
177    ],
178}
179
180/////////////////////////////////////////////////
181// libinputflinger_base
182/////////////////////////////////////////////////
183
184cc_library_headers {
185    name: "libinputflinger_headers",
186    host_supported: true,
187    export_include_dirs: [
188        "include",
189        ".",
190    ],
191    header_libs: [
192        "libchrome-gestures_headers",
193    ],
194    export_header_lib_headers: [
195        "libchrome-gestures_headers",
196    ],
197}
198
199filegroup {
200    name: "libinputflinger_base_sources",
201    srcs: [
202        "InputDeviceMetricsSource.cpp",
203        "InputListener.cpp",
204        "InputReaderBase.cpp",
205        "InputThread.cpp",
206        "NotifyArgs.cpp",
207        "VibrationElement.cpp",
208    ],
209}
210
211cc_defaults {
212    name: "libinputflinger_base_defaults",
213    srcs: [":libinputflinger_base_sources"],
214    shared_libs: [
215        "libbase",
216        "libbinder",
217        "libcutils",
218        "libinput",
219        "liblog",
220        "libprocessgroup",
221        "libstatslog",
222        "libutils",
223    ],
224    header_libs: [
225        "libinputflinger_headers",
226    ],
227}
228
229cc_library_shared {
230    name: "libinputflinger_base",
231    host_supported: true,
232    defaults: [
233        "inputflinger_defaults",
234        "libinputflinger_base_defaults",
235    ],
236    export_header_lib_headers: [
237        "libinputflinger_headers",
238    ],
239}
240
241// This target will build everything 'input-related'. This could be useful for
242// large refactorings of the input code. This is similar to 'm checkbuild', but
243// just for input code.
244// Use 'm checkinput' to build, and then (optionally) use 'm installclean' to
245// remove any of the installed artifacts that you may not want on your actual
246// build.
247phony {
248    name: "checkinput",
249    required: [
250        // native targets
251        "libgui_test",
252        "libinput",
253        "libinputreader_static",
254        "libinputflinger",
255        "inputflinger_tests",
256        "inputflinger_benchmarks",
257        "libinput_tests",
258        "libpalmrejection_test",
259        "libandroid_runtime",
260        "libinputservice_test",
261        "Bug-115739809",
262        "StructLayout_test",
263
264        // jni
265        "libservices.core",
266
267        // rust targets
268        "libinput_rust_test",
269
270        // native fuzzers
271        "inputflinger_latencytracker_fuzzer",
272        "inputflinger_cursor_input_fuzzer",
273        "inputflinger_keyboard_input_fuzzer",
274        "inputflinger_multitouch_input_fuzzer",
275        "inputflinger_switch_input_fuzzer",
276        "inputflinger_touchpad_input_fuzzer",
277        "inputflinger_input_reader_fuzzer",
278        "inputflinger_blocking_queue_fuzzer",
279        "inputflinger_input_classifier_fuzzer",
280        "inputflinger_input_dispatcher_fuzzer",
281
282        // Java/Kotlin targets
283        "CtsWindowManagerDeviceWindow",
284        "InputTests",
285        "CtsHardwareTestCases",
286        "CtsInputTestCases",
287        "CtsViewTestCases",
288        "CtsWidgetTestCases",
289        "FrameworksCoreTests",
290        "FrameworksServicesTests",
291        "CtsSecurityTestCases",
292        "CtsSecurityBulletinHostTestCases",
293        "monkey_test",
294    ],
295}
296