blob: d2e432063abf8a1623fc0f22d46c56f70e4e43a8 [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",
Harry Cutts0e2df842025-02-03 03:44:15 -080030 "android/os/InputConfig.aidl",
Siarhei Vishniakouae6229e2019-12-30 16:23:19 -080031 "android/os/InputEventInjectionResult.aidl",
32 "android/os/InputEventInjectionSync.aidl",
Prabir Pradhan29814f22024-06-18 14:53:10 +000033 "android/os/MotionEventFlag.aidl",
Yuichiro Hanada56afd1e2024-03-22 17:23:25 +090034 "android/os/PointerIconType.aidl",
Siarhei Vishniakou70622952020-07-30 11:17:23 -050035 ],
36}
37
Siarhei Vishniakou96818962023-08-23 10:19:02 -070038/////////////////////////////////////////////////
39// flags
40/////////////////////////////////////////////////
41aconfig_declarations {
Prabir Pradhanda4b6b22023-11-06 16:52:43 +000042 name: "com.android.input.flags-aconfig",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070043 package: "com.android.input.flags",
Oriol Prieto Gasco33fd22e2024-02-06 18:34:41 +000044 container: "system",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070045 srcs: ["input_flags.aconfig"],
46}
47
48cc_aconfig_library {
Prabir Pradhanda4b6b22023-11-06 16:52:43 +000049 name: "com.android.input.flags-aconfig-cc",
50 aconfig_declarations: "com.android.input.flags-aconfig",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070051 host_supported: true,
Prabir Pradhana2764b72023-10-10 19:43:43 +000052 // Use the test version of the aconfig flag library by default to allow tests to set local
53 // overrides for flags, without having to link against a separate version of libinput or of this
54 // library. Bundling this library directly into libinput prevents us from having to add this
55 // library as a shared lib dependency everywhere where libinput is used.
Zi Wang8b7ea532023-11-09 20:14:35 -080056 mode: "test",
Prabir Pradhana2764b72023-10-10 19:43:43 +000057 shared: {
58 enabled: false,
59 },
Siarhei Vishniakou96818962023-08-23 10:19:02 -070060}
61
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070062aidl_interface {
63 name: "inputconstants",
64 host_supported: true,
65 vendor_available: true,
66 unstable: true,
67 srcs: [
68 ":inputconstants_aidl",
69 ],
70
71 backend: {
72 rust: {
73 enabled: true,
74 },
75 },
76}
77
78rust_bindgen {
79 name: "libinput_bindgen",
80 host_supported: true,
81 crate_name: "input_bindgen",
82 visibility: ["//frameworks/native/services/inputflinger"],
83 wrapper_src: "InputWrapper.hpp",
84
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070085 source_stem: "bindings",
86
87 bindgen_flags: [
Harry Cutts0e2df842025-02-03 03:44:15 -080088 "--allowlist-var=AINPUT_KEYBOARD_TYPE_ALPHABETIC",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +000089 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NONE",
90 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC",
Harry Cutts0e2df842025-02-03 03:44:15 -080091 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS",
92 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
93 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK",
94 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION",
95 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
96 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER",
97 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION",
98 "--allowlist-var=AINPUT_SOURCE_DPAD",
99 "--allowlist-var=AINPUT_SOURCE_GAMEPAD",
100 "--allowlist-var=AINPUT_SOURCE_HDMI",
101 "--allowlist-var=AINPUT_SOURCE_JOYSTICK",
102 "--allowlist-var=AINPUT_SOURCE_KEYBOARD",
103 "--allowlist-var=AINPUT_SOURCE_MOUSE",
104 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE",
105 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER",
106 "--allowlist-var=AINPUT_SOURCE_SENSOR",
107 "--allowlist-var=AINPUT_SOURCE_STYLUS",
108 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD",
109 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN",
110 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION",
111 "--allowlist-var=AINPUT_SOURCE_TRACKBALL",
112 "--allowlist-var=AINPUT_SOURCE_UNKNOWN",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000113 "--allowlist-var=AMETA_ALT_LEFT_ON",
Harry Cutts0e2df842025-02-03 03:44:15 -0800114 "--allowlist-var=AMETA_ALT_ON",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000115 "--allowlist-var=AMETA_ALT_RIGHT_ON",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000116 "--allowlist-var=AMETA_CAPS_LOCK_ON",
Harry Cutts0e2df842025-02-03 03:44:15 -0800117 "--allowlist-var=AMETA_CTRL_LEFT_ON",
118 "--allowlist-var=AMETA_CTRL_ON",
119 "--allowlist-var=AMETA_CTRL_RIGHT_ON",
120 "--allowlist-var=AMETA_FUNCTION_ON",
121 "--allowlist-var=AMETA_META_LEFT_ON",
122 "--allowlist-var=AMETA_META_ON",
123 "--allowlist-var=AMETA_META_RIGHT_ON",
124 "--allowlist-var=AMETA_NONE",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000125 "--allowlist-var=AMETA_NUM_LOCK_ON",
126 "--allowlist-var=AMETA_SCROLL_LOCK_ON",
Harry Cutts0e2df842025-02-03 03:44:15 -0800127 "--allowlist-var=AMETA_SHIFT_LEFT_ON",
128 "--allowlist-var=AMETA_SHIFT_ON",
129 "--allowlist-var=AMETA_SHIFT_RIGHT_ON",
130 "--allowlist-var=AMETA_SYM_ON",
131 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
132 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
133 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
134 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
135 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
Harry Cutts26640c92025-01-27 09:01:06 -0800136 "--allowlist-var=AMOTION_EVENT_BUTTON_BACK",
137 "--allowlist-var=AMOTION_EVENT_BUTTON_FORWARD",
138 "--allowlist-var=AMOTION_EVENT_BUTTON_PRIMARY",
139 "--allowlist-var=AMOTION_EVENT_BUTTON_SECONDARY",
140 "--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_PRIMARY",
141 "--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_SECONDARY",
142 "--allowlist-var=AMOTION_EVENT_BUTTON_TERTIARY",
Harry Cutts0e2df842025-02-03 03:44:15 -0800143 "--allowlist-var=MAX_POINTER_ID",
144 "--verbose",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700145 ],
146
147 static_libs: [
148 "inputconstants-cpp",
149 "libui-types",
150 ],
151 shared_libs: ["libc++"],
152 header_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700153 "flatbuffer_headers",
Harry Cutts0e2df842025-02-03 03:44:15 -0800154 "jni_headers",
155 "native_headers",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700156 ],
157}
158
Cody Heiner0f00ad92024-02-13 14:19:25 -0800159cc_library_static {
160 name: "iinputflinger_aidl_lib_static",
161 host_supported: true,
162 srcs: [
163 "android/os/IInputFlinger.aidl",
164 "android/os/InputChannelCore.aidl",
165 ],
166 shared_libs: [
167 "libbinder",
168 ],
169 whole_static_libs: [
170 "libgui_window_info_static",
171 ],
172 aidl: {
173 export_aidl_headers: true,
174 local_include_dirs: ["."],
175 include_dirs: [
176 "frameworks/native/libs/gui",
177 "frameworks/native/libs/input",
178 ],
179 },
180}
181
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700182// Contains methods to help access C++ code from rust
183cc_library_static {
184 name: "libinput_from_rust_to_cpp",
185 cpp_std: "c++20",
186 host_supported: true,
187 cflags: [
188 "-Wall",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700189 "-Werror",
Harry Cutts0e2df842025-02-03 03:44:15 -0800190 "-Wextra",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700191 ],
192 srcs: [
193 "FromRustToCpp.cpp",
194 ],
195
196 generated_headers: [
197 "cxx-bridge-header",
198 ],
199 generated_sources: ["libinput_cxx_bridge_code"],
200
Stephen Hinese9dfe772024-03-08 23:37:23 -0800201 lto: {
202 never: true,
203 },
204
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700205 shared_libs: [
206 "libbase",
207 ],
208}
209
Dan Willemsen59e086f2016-07-25 17:13:45 -0700210cc_library {
211 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800212 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700213 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800214 cflags: [
Harry Cutts0e2df842025-02-03 03:44:15 -0800215 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800216 "-Wall",
Frank Barchard9e947882017-03-06 11:17:52 -0800217 "-Werror",
Harry Cutts0e2df842025-02-03 03:44:15 -0800218 "-Wextra",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800219 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700220 "-Wshadow",
221 "-Wshadow-field-in-constructor-modified",
222 "-Wshadow-uncaptured-local",
Harry Cutts0e2df842025-02-03 03:44:15 -0800223 "-Wthread-safety",
Frank Barchard9e947882017-03-06 11:17:52 -0800224 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700225 srcs: [
Harry Cuttse78184b2024-01-08 15:54:58 +0000226 "AccelerationCurve.cpp",
Paul Ramirez08ee1992024-10-10 18:02:15 +0000227 "CoordinateFilter.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700228 "Input.cpp",
Siarhei Vishniakou0438ca82024-03-12 14:27:25 -0700229 "InputConsumer.cpp",
Siarhei Vishniakou2b920272024-02-27 19:49:51 -0800230 "InputConsumerNoResampling.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700231 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700232 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700233 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800234 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700235 "KeyCharacterMap.cpp",
236 "KeyLayoutMap.cpp",
Harry Cutts0e2df842025-02-03 03:44:15 -0800237 "Keyboard.cpp",
238 "KeyboardClassifier.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800239 "MotionPredictor.cpp",
Cody Heiner52db4742023-06-29 13:19:01 -0700240 "MotionPredictorMetricsManager.cpp",
Paul Ramirez08ee1992024-10-10 18:02:15 +0000241 "OneEuroFilter.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800242 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700243 "PropertyMap.cpp",
Paul Ramirezbe9c5442024-07-10 00:12:41 +0000244 "Resampler.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800245 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600246 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700247 "VelocityControl.cpp",
248 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000249 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600250 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700251 ],
252
Philip Quinn8f953ab2022-12-06 15:37:07 -0800253 header_libs: [
254 "flatbuffer_headers",
255 "jni_headers",
Cody Heiner52db4742023-06-29 13:19:01 -0700256 "libeigen",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800257 "tensorflow_headers",
258 ],
Cody Heiner52db4742023-06-29 13:19:01 -0700259 export_header_lib_headers: [
260 "jni_headers",
261 "libeigen",
262 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100263
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000264 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700265 "cxx-bridge-header",
266 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000267 "toolbox_input_labels",
268 ],
269
Dan Willemsen59e086f2016-07-25 17:13:45 -0700270 shared_libs: [
Siarhei Vishniakou3e44e8b2024-07-19 14:53:26 +0000271 "android.companion.virtualdevice.flags-aconfig-cc",
Harry Cutts0e2df842025-02-03 03:44:15 -0800272 "libPlatformProperties",
Dennis Shen503a9952024-11-27 17:10:23 +0000273 "libaconfig_storage_read_api_cc",
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700274 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700275 "libbinder",
Siarhei Vishniakouc40f6e02024-04-25 15:49:29 -0700276 "libbinder_ndk",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700277 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800278 "liblog",
Philip Quinnf84fa492023-06-26 14:15:15 -0700279 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700280 "libutils",
Jooyung Han3f669212023-12-05 14:18:19 +0900281 "libz", // needed by libkernelconfigs
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700282 "server_configurable_flags",
Philip Quinnda6a4482023-02-07 10:09:57 -0800283 ],
284
285 ldflags: [
286 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700287 ],
288
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000289 sanitize: {
290 undefined: true,
291 all_undefined: true,
292 misc_undefined: ["integer"],
293 },
294
chaviwfd9c1ed2020-07-01 10:57:59 -0700295 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700296 "inputconstants-cpp",
Jooyung Han3f669212023-12-05 14:18:19 +0900297 "libkernelconfigs",
Harry Cutts0e2df842025-02-03 03:44:15 -0800298 "libtflite_static",
299 "libui-types",
chaviwfd9c1ed2020-07-01 10:57:59 -0700300 ],
301
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700302 whole_static_libs: [
Prabir Pradhanda4b6b22023-11-06 16:52:43 +0000303 "com.android.input.flags-aconfig-cc",
Cody Heiner0f00ad92024-02-13 14:19:25 -0800304 "iinputflinger_aidl_lib_static",
Harry Cutts0e2df842025-02-03 03:44:15 -0800305 "libinput_rust_ffi",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700306 ],
307
chaviwfd9c1ed2020-07-01 10:57:59 -0700308 export_static_lib_headers: [
309 "libui-types",
310 ],
311
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700312 export_generated_headers: [
313 "cxx-bridge-header",
314 "libinput_cxx_bridge_header",
315 ],
316
Dan Willemsen59e086f2016-07-25 17:13:45 -0700317 target: {
318 android: {
Philip Quinn8f953ab2022-12-06 15:37:07 -0800319 required: [
Philip Quinnf84fa492023-06-26 14:15:15 -0700320 "motion_predictor_model_config",
Harry Cutts0e2df842025-02-03 03:44:15 -0800321 "motion_predictor_model_prebuilt",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800322 ],
Cody Heinerb0b5b6c2024-05-09 18:31:12 -0700323 static_libs: [
324 "libstatslog_libinput",
325 "libstatssocket_lazy",
326 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700327 },
328 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700329 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000330 "bionic/libc/kernel/android/uapi/",
331 "bionic/libc/kernel/uapi",
Brett Chabot58208522020-09-09 13:55:24 -0700332 ],
333 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700334 },
335}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700336
Cody Heinerb0b5b6c2024-05-09 18:31:12 -0700337cc_library_static {
338 name: "libstatslog_libinput",
339 generated_sources: ["statslog_libinput.cpp"],
340 generated_headers: ["statslog_libinput.h"],
341 cflags: [
342 "-Wall",
343 "-Werror",
344 ],
345 export_generated_headers: ["statslog_libinput.h"],
346 shared_libs: [
347 "libcutils",
348 "liblog",
349 "libutils",
350 ],
351 static_libs: [
352 "libstatssocket_lazy",
353 ],
354}
355
356genrule {
357 name: "statslog_libinput.h",
358 tools: ["stats-log-api-gen"],
359 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h " +
360 "--module libinput --namespace android,libinput",
361 out: [
362 "statslog_libinput.h",
363 ],
364}
365
366genrule {
367 name: "statslog_libinput.cpp",
368 tools: ["stats-log-api-gen"],
369 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp " +
370 "--module libinput --namespace android,libinput " +
371 "--importHeader statslog_libinput.h",
372 out: [
373 "statslog_libinput.cpp",
374 ],
375}
376
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700377cc_defaults {
378 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000379 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700380 host_supported: true,
381 shared_libs: [
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700382 "libbase",
383 "liblog",
Harry Cutts0e2df842025-02-03 03:44:15 -0800384 "libutils",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700385 ],
386}
387
388cc_fuzz {
389 name: "libinput_fuzz_propertymap",
390 defaults: ["libinput_fuzz_defaults"],
391 srcs: [
392 "PropertyMap.cpp",
393 "PropertyMap_fuzz.cpp",
394 ],
395}
396
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700397subdirs = ["tests"]