blob: 45ebc66ddc5e7768c8bc2e6303100129a2cb46fb [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",
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: [
88 "--verbose",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070089 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
90 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
91 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
92 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
93 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
94 "--allowlist-var=MAX_POINTER_ID",
Siarhei Vishniakou2d151ac2023-09-19 13:30:24 -070095 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
96 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
97 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER",
98 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION",
99 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION",
100 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK",
101 "--allowlist-var=AINPUT_SOURCE_UNKNOWN",
102 "--allowlist-var=AINPUT_SOURCE_KEYBOARD",
103 "--allowlist-var=AINPUT_SOURCE_DPAD",
104 "--allowlist-var=AINPUT_SOURCE_GAMEPAD",
105 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN",
106 "--allowlist-var=AINPUT_SOURCE_MOUSE",
107 "--allowlist-var=AINPUT_SOURCE_STYLUS",
108 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS",
109 "--allowlist-var=AINPUT_SOURCE_TRACKBALL",
110 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE",
111 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD",
112 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION",
113 "--allowlist-var=AINPUT_SOURCE_JOYSTICK",
114 "--allowlist-var=AINPUT_SOURCE_HDMI",
115 "--allowlist-var=AINPUT_SOURCE_SENSOR",
116 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000117 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NONE",
118 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC",
119 "--allowlist-var=AINPUT_KEYBOARD_TYPE_ALPHABETIC",
120 "--allowlist-var=AMETA_NONE",
121 "--allowlist-var=AMETA_ALT_ON",
122 "--allowlist-var=AMETA_ALT_LEFT_ON",
123 "--allowlist-var=AMETA_ALT_RIGHT_ON",
124 "--allowlist-var=AMETA_SHIFT_ON",
125 "--allowlist-var=AMETA_SHIFT_LEFT_ON",
126 "--allowlist-var=AMETA_SHIFT_RIGHT_ON",
127 "--allowlist-var=AMETA_SYM_ON",
128 "--allowlist-var=AMETA_FUNCTION_ON",
129 "--allowlist-var=AMETA_CTRL_ON",
130 "--allowlist-var=AMETA_CTRL_LEFT_ON",
131 "--allowlist-var=AMETA_CTRL_RIGHT_ON",
132 "--allowlist-var=AMETA_META_ON",
133 "--allowlist-var=AMETA_META_LEFT_ON",
134 "--allowlist-var=AMETA_META_RIGHT_ON",
135 "--allowlist-var=AMETA_CAPS_LOCK_ON",
136 "--allowlist-var=AMETA_NUM_LOCK_ON",
137 "--allowlist-var=AMETA_SCROLL_LOCK_ON",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700138 ],
139
140 static_libs: [
141 "inputconstants-cpp",
142 "libui-types",
143 ],
144 shared_libs: ["libc++"],
145 header_libs: [
146 "native_headers",
147 "jni_headers",
148 "flatbuffer_headers",
149 ],
150}
151
Cody Heiner0f00ad92024-02-13 14:19:25 -0800152cc_library_static {
153 name: "iinputflinger_aidl_lib_static",
154 host_supported: true,
155 srcs: [
156 "android/os/IInputFlinger.aidl",
157 "android/os/InputChannelCore.aidl",
158 ],
159 shared_libs: [
160 "libbinder",
161 ],
162 whole_static_libs: [
163 "libgui_window_info_static",
164 ],
165 aidl: {
166 export_aidl_headers: true,
167 local_include_dirs: ["."],
168 include_dirs: [
169 "frameworks/native/libs/gui",
170 "frameworks/native/libs/input",
171 ],
172 },
173}
174
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700175// Contains methods to help access C++ code from rust
176cc_library_static {
177 name: "libinput_from_rust_to_cpp",
178 cpp_std: "c++20",
179 host_supported: true,
180 cflags: [
181 "-Wall",
182 "-Wextra",
183 "-Werror",
184 ],
185 srcs: [
186 "FromRustToCpp.cpp",
187 ],
188
189 generated_headers: [
190 "cxx-bridge-header",
191 ],
192 generated_sources: ["libinput_cxx_bridge_code"],
193
Stephen Hinese9dfe772024-03-08 23:37:23 -0800194 lto: {
195 never: true,
196 },
197
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700198 shared_libs: [
199 "libbase",
200 ],
201}
202
Dan Willemsen59e086f2016-07-25 17:13:45 -0700203cc_library {
204 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800205 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700206 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800207 cflags: [
208 "-Wall",
209 "-Wextra",
210 "-Werror",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800211 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700212 "-Wthread-safety",
213 "-Wshadow",
214 "-Wshadow-field-in-constructor-modified",
215 "-Wshadow-uncaptured-local",
216 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800217 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700218 srcs: [
Harry Cuttse78184b2024-01-08 15:54:58 +0000219 "AccelerationCurve.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700220 "Input.cpp",
Siarhei Vishniakou0438ca82024-03-12 14:27:25 -0700221 "InputConsumer.cpp",
Siarhei Vishniakou2b920272024-02-27 19:49:51 -0800222 "InputConsumerNoResampling.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700223 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700224 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700225 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800226 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700227 "Keyboard.cpp",
228 "KeyCharacterMap.cpp",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000229 "KeyboardClassifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700230 "KeyLayoutMap.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800231 "MotionPredictor.cpp",
Cody Heiner52db4742023-06-29 13:19:01 -0700232 "MotionPredictorMetricsManager.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800233 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700234 "PropertyMap.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800235 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600236 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700237 "VelocityControl.cpp",
238 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000239 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600240 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700241 ],
242
Philip Quinn8f953ab2022-12-06 15:37:07 -0800243 header_libs: [
244 "flatbuffer_headers",
245 "jni_headers",
Cody Heiner52db4742023-06-29 13:19:01 -0700246 "libeigen",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800247 "tensorflow_headers",
248 ],
Cody Heiner52db4742023-06-29 13:19:01 -0700249 export_header_lib_headers: [
250 "jni_headers",
251 "libeigen",
252 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100253
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000254 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700255 "cxx-bridge-header",
256 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000257 "toolbox_input_labels",
258 ],
259
Dan Willemsen59e086f2016-07-25 17:13:45 -0700260 shared_libs: [
Pechetty Sravani (xWF)a300d5f2024-07-19 06:20:58 +0000261 "android.companion.virtualdevice.flags-aconfig-cc-host",
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700262 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700263 "libbinder",
Siarhei Vishniakouc40f6e02024-04-25 15:49:29 -0700264 "libbinder_ndk",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700265 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800266 "liblog",
267 "libPlatformProperties",
Philip Quinnf84fa492023-06-26 14:15:15 -0700268 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700269 "libutils",
Jooyung Han3f669212023-12-05 14:18:19 +0900270 "libz", // needed by libkernelconfigs
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700271 "server_configurable_flags",
Philip Quinnda6a4482023-02-07 10:09:57 -0800272 ],
273
274 ldflags: [
275 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700276 ],
277
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000278 sanitize: {
279 undefined: true,
280 all_undefined: true,
281 misc_undefined: ["integer"],
282 },
283
chaviwfd9c1ed2020-07-01 10:57:59 -0700284 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700285 "inputconstants-cpp",
chaviwfd9c1ed2020-07-01 10:57:59 -0700286 "libui-types",
Philip Quinnda6a4482023-02-07 10:09:57 -0800287 "libtflite_static",
Jooyung Han3f669212023-12-05 14:18:19 +0900288 "libkernelconfigs",
chaviwfd9c1ed2020-07-01 10:57:59 -0700289 ],
290
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700291 whole_static_libs: [
Prabir Pradhanda4b6b22023-11-06 16:52:43 +0000292 "com.android.input.flags-aconfig-cc",
Prabir Pradhan0762b1f2023-06-22 23:08:18 +0000293 "libinput_rust_ffi",
Cody Heiner0f00ad92024-02-13 14:19:25 -0800294 "iinputflinger_aidl_lib_static",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700295 ],
296
chaviwfd9c1ed2020-07-01 10:57:59 -0700297 export_static_lib_headers: [
298 "libui-types",
299 ],
300
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700301 export_generated_headers: [
302 "cxx-bridge-header",
303 "libinput_cxx_bridge_header",
304 ],
305
Dan Willemsen59e086f2016-07-25 17:13:45 -0700306 target: {
307 android: {
Philip Quinn8f953ab2022-12-06 15:37:07 -0800308 required: [
309 "motion_predictor_model_prebuilt",
Philip Quinnf84fa492023-06-26 14:15:15 -0700310 "motion_predictor_model_config",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800311 ],
Cody Heinerb0b5b6c2024-05-09 18:31:12 -0700312 static_libs: [
313 "libstatslog_libinput",
314 "libstatssocket_lazy",
315 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700316 },
317 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700318 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000319 "bionic/libc/kernel/android/uapi/",
320 "bionic/libc/kernel/uapi",
Brett Chabot58208522020-09-09 13:55:24 -0700321 ],
322 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700323 },
324}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700325
Cody Heinerb0b5b6c2024-05-09 18:31:12 -0700326cc_library_static {
327 name: "libstatslog_libinput",
328 generated_sources: ["statslog_libinput.cpp"],
329 generated_headers: ["statslog_libinput.h"],
330 cflags: [
331 "-Wall",
332 "-Werror",
333 ],
334 export_generated_headers: ["statslog_libinput.h"],
335 shared_libs: [
336 "libcutils",
337 "liblog",
338 "libutils",
339 ],
340 static_libs: [
341 "libstatssocket_lazy",
342 ],
343}
344
345genrule {
346 name: "statslog_libinput.h",
347 tools: ["stats-log-api-gen"],
348 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h " +
349 "--module libinput --namespace android,libinput",
350 out: [
351 "statslog_libinput.h",
352 ],
353}
354
355genrule {
356 name: "statslog_libinput.cpp",
357 tools: ["stats-log-api-gen"],
358 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp " +
359 "--module libinput --namespace android,libinput " +
360 "--importHeader statslog_libinput.h",
361 out: [
362 "statslog_libinput.cpp",
363 ],
364}
365
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700366cc_defaults {
367 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000368 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700369 host_supported: true,
370 shared_libs: [
371 "libutils",
372 "libbase",
373 "liblog",
374 ],
375}
376
377cc_fuzz {
378 name: "libinput_fuzz_propertymap",
379 defaults: ["libinput_fuzz_defaults"],
380 srcs: [
381 "PropertyMap.cpp",
382 "PropertyMap_fuzz.cpp",
383 ],
384}
385
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700386subdirs = ["tests"]