blob: ab4af1a7b61dc477b5caca682db2bbcd4de15ec9 [file] [log] [blame]
Dan Willemsen59e086f2016-07-25 17:13:45 -07001// 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// libinput is partially built for the host (used by build time keymap validation tool)
16
Bob Badour3306e492021-02-25 15:35:37 -080017package {
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
Siarhei Vishniakou70622952020-07-30 11:17:23 -050026filegroup {
27 name: "inputconstants_aidl",
28 srcs: [
Siarhei Vishniakouae6229e2019-12-30 16:23:19 -080029 "android/os/IInputConstants.aidl",
30 "android/os/InputEventInjectionResult.aidl",
31 "android/os/InputEventInjectionSync.aidl",
Prabir Pradhan51e7db02022-02-07 06:02:57 -080032 "android/os/InputConfig.aidl",
Siarhei Vishniakou70622952020-07-30 11:17:23 -050033 ],
34}
35
Siarhei Vishniakou96818962023-08-23 10:19:02 -070036/////////////////////////////////////////////////
37// flags
38/////////////////////////////////////////////////
39aconfig_declarations {
40 name: "aconfig_input_flags",
41 package: "com.android.input.flags",
42 srcs: ["input_flags.aconfig"],
43}
44
45cc_aconfig_library {
46 name: "aconfig_input_flags_c_lib",
47 aconfig_declarations: "aconfig_input_flags",
48 host_supported: true,
49}
50
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070051aidl_interface {
52 name: "inputconstants",
53 host_supported: true,
54 vendor_available: true,
55 unstable: true,
56 srcs: [
57 ":inputconstants_aidl",
58 ],
59
60 backend: {
61 rust: {
62 enabled: true,
63 },
64 },
65}
66
67rust_bindgen {
68 name: "libinput_bindgen",
69 host_supported: true,
70 crate_name: "input_bindgen",
71 visibility: ["//frameworks/native/services/inputflinger"],
72 wrapper_src: "InputWrapper.hpp",
73
74 include_dirs: [
75 "frameworks/native/include",
76 ],
77
78 source_stem: "bindings",
79
80 bindgen_flags: [
81 "--verbose",
82 "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED",
Siarhei Vishniakou227a7f82023-07-18 18:30:32 -070083 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED",
84 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED",
85 "--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT",
86 "--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070087 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
88 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
89 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
90 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
91 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
92 "--allowlist-var=MAX_POINTER_ID",
Siarhei Vishniakou2d151ac2023-09-19 13:30:24 -070093 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
94 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
95 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER",
96 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION",
97 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION",
98 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK",
99 "--allowlist-var=AINPUT_SOURCE_UNKNOWN",
100 "--allowlist-var=AINPUT_SOURCE_KEYBOARD",
101 "--allowlist-var=AINPUT_SOURCE_DPAD",
102 "--allowlist-var=AINPUT_SOURCE_GAMEPAD",
103 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN",
104 "--allowlist-var=AINPUT_SOURCE_MOUSE",
105 "--allowlist-var=AINPUT_SOURCE_STYLUS",
106 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS",
107 "--allowlist-var=AINPUT_SOURCE_TRACKBALL",
108 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE",
109 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD",
110 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION",
111 "--allowlist-var=AINPUT_SOURCE_JOYSTICK",
112 "--allowlist-var=AINPUT_SOURCE_HDMI",
113 "--allowlist-var=AINPUT_SOURCE_SENSOR",
114 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700115 ],
116
117 static_libs: [
118 "inputconstants-cpp",
119 "libui-types",
120 ],
121 shared_libs: ["libc++"],
122 header_libs: [
123 "native_headers",
124 "jni_headers",
125 "flatbuffer_headers",
126 ],
127}
128
129// Contains methods to help access C++ code from rust
130cc_library_static {
131 name: "libinput_from_rust_to_cpp",
132 cpp_std: "c++20",
133 host_supported: true,
134 cflags: [
135 "-Wall",
136 "-Wextra",
137 "-Werror",
138 ],
139 srcs: [
140 "FromRustToCpp.cpp",
141 ],
142
143 generated_headers: [
144 "cxx-bridge-header",
145 ],
146 generated_sources: ["libinput_cxx_bridge_code"],
147
148 shared_libs: [
149 "libbase",
150 ],
151}
152
Dan Willemsen59e086f2016-07-25 17:13:45 -0700153cc_library {
154 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800155 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700156 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800157 cflags: [
158 "-Wall",
159 "-Wextra",
160 "-Werror",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800161 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700162 "-Wthread-safety",
163 "-Wshadow",
164 "-Wshadow-field-in-constructor-modified",
165 "-Wshadow-uncaptured-local",
166 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800167 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700168 srcs: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700169 "android/os/IInputFlinger.aidl",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700170 "Input.cpp",
171 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700172 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700173 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800174 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700175 "Keyboard.cpp",
176 "KeyCharacterMap.cpp",
177 "KeyLayoutMap.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800178 "MotionPredictor.cpp",
Cody Heiner52db4742023-06-29 13:19:01 -0700179 "MotionPredictorMetricsManager.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800180 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700181 "PropertyMap.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800182 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600183 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700184 "VelocityControl.cpp",
185 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000186 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600187 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700188 ],
189
Philip Quinn8f953ab2022-12-06 15:37:07 -0800190 header_libs: [
191 "flatbuffer_headers",
192 "jni_headers",
Cody Heiner52db4742023-06-29 13:19:01 -0700193 "libeigen",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800194 "tensorflow_headers",
195 ],
Cody Heiner52db4742023-06-29 13:19:01 -0700196 export_header_lib_headers: [
197 "jni_headers",
198 "libeigen",
199 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100200
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000201 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700202 "cxx-bridge-header",
203 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000204 "toolbox_input_labels",
205 ],
206
Dan Willemsen59e086f2016-07-25 17:13:45 -0700207 shared_libs: [
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700208 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700209 "libbinder",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700210 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800211 "liblog",
212 "libPlatformProperties",
Philip Quinnf84fa492023-06-26 14:15:15 -0700213 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700214 "libutils",
Siarhei Vishniakoua9fd82c2022-05-18 09:42:52 -0700215 "libvintf",
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700216 "server_configurable_flags",
Philip Quinnda6a4482023-02-07 10:09:57 -0800217 ],
218
219 ldflags: [
220 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700221 ],
222
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000223 sanitize: {
224 undefined: true,
225 all_undefined: true,
226 misc_undefined: ["integer"],
227 },
228
chaviwfd9c1ed2020-07-01 10:57:59 -0700229 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700230 "inputconstants-cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700231 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700232 "libui-types",
Philip Quinnda6a4482023-02-07 10:09:57 -0800233 "libtflite_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700234 ],
235
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700236 whole_static_libs: [
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700237 "aconfig_input_flags_c_lib",
Prabir Pradhan0762b1f2023-06-22 23:08:18 +0000238 "libinput_rust_ffi",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700239 ],
240
chaviwfd9c1ed2020-07-01 10:57:59 -0700241 export_static_lib_headers: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700242 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700243 "libui-types",
244 ],
245
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700246 export_generated_headers: [
247 "cxx-bridge-header",
248 "libinput_cxx_bridge_header",
249 ],
250
Dan Willemsen59e086f2016-07-25 17:13:45 -0700251 target: {
252 android: {
Cody Heiner52db4742023-06-29 13:19:01 -0700253 export_shared_lib_headers: ["libbinder"],
254
255 shared_libs: [
256 "libutils",
257 "libbinder",
258 // Stats logging library and its dependencies.
259 "libstatslog_libinput",
260 "libstatsbootstrap",
261 "android.os.statsbootstrap_aidl-cpp",
262 ],
263
Philip Quinn8f953ab2022-12-06 15:37:07 -0800264 required: [
265 "motion_predictor_model_prebuilt",
Philip Quinnf84fa492023-06-26 14:15:15 -0700266 "motion_predictor_model_config",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800267 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700268 },
269 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700270 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000271 "bionic/libc/kernel/android/uapi/",
272 "bionic/libc/kernel/uapi",
Brett Chabot58208522020-09-09 13:55:24 -0700273 ],
274 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700275 },
Chris Ye0783e992020-06-02 21:34:49 -0700276
277 aidl: {
278 local_include_dirs: ["."],
Brett Chabot58208522020-09-09 13:55:24 -0700279 export_aidl_headers: true,
chaviw3277faf2021-05-19 16:45:23 -0500280 include_dirs: [
281 "frameworks/native/libs/gui",
282 ],
Chris Ye0783e992020-06-02 21:34:49 -0700283 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700284}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700285
Cody Heiner52db4742023-06-29 13:19:01 -0700286// Use bootstrap version of stats logging library.
287// libinput is a bootstrap process (starts early in the boot process), and thus can't use the normal
288// `libstatslog` because that requires `libstatssocket`, which is only available later in the boot.
289cc_library {
290 name: "libstatslog_libinput",
291 generated_sources: ["statslog_libinput.cpp"],
292 generated_headers: ["statslog_libinput.h"],
293 export_generated_headers: ["statslog_libinput.h"],
294 shared_libs: [
295 "libbinder",
296 "libstatsbootstrap",
297 "libutils",
298 "android.os.statsbootstrap_aidl-cpp",
299 ],
300}
301
302genrule {
303 name: "statslog_libinput.h",
304 tools: ["stats-log-api-gen"],
305 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h --module libinput" +
306 " --namespace android,stats,libinput --bootstrap",
307 out: [
308 "statslog_libinput.h",
309 ],
310}
311
312genrule {
313 name: "statslog_libinput.cpp",
314 tools: ["stats-log-api-gen"],
315 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp --module libinput" +
316 " --namespace android,stats,libinput --importHeader statslog_libinput.h" +
317 " --bootstrap",
318 out: [
319 "statslog_libinput.cpp",
320 ],
321}
322
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700323cc_defaults {
324 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000325 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700326 host_supported: true,
327 shared_libs: [
328 "libutils",
329 "libbase",
330 "liblog",
331 ],
332}
333
334cc_fuzz {
335 name: "libinput_fuzz_propertymap",
336 defaults: ["libinput_fuzz_defaults"],
337 srcs: [
338 "PropertyMap.cpp",
339 "PropertyMap_fuzz.cpp",
340 ],
341}
342
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700343subdirs = ["tests"]