blob: 4123ffcde134c7327c452aff1444097cabe62b55 [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",
Yuichiro Hanada56afd1e2024-03-22 17:23:25 +090033 "android/os/PointerIconType.aidl",
Siarhei Vishniakou70622952020-07-30 11:17:23 -050034 ],
35}
36
Siarhei Vishniakou96818962023-08-23 10:19:02 -070037/////////////////////////////////////////////////
38// flags
39/////////////////////////////////////////////////
40aconfig_declarations {
Prabir Pradhanda4b6b22023-11-06 16:52:43 +000041 name: "com.android.input.flags-aconfig",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070042 package: "com.android.input.flags",
Oriol Prieto Gasco33fd22e2024-02-06 18:34:41 +000043 container: "system",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070044 srcs: ["input_flags.aconfig"],
45}
46
47cc_aconfig_library {
Prabir Pradhanda4b6b22023-11-06 16:52:43 +000048 name: "com.android.input.flags-aconfig-cc",
49 aconfig_declarations: "com.android.input.flags-aconfig",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070050 host_supported: true,
Prabir Pradhana2764b72023-10-10 19:43:43 +000051 // Use the test version of the aconfig flag library by default to allow tests to set local
52 // overrides for flags, without having to link against a separate version of libinput or of this
53 // library. Bundling this library directly into libinput prevents us from having to add this
54 // library as a shared lib dependency everywhere where libinput is used.
Zi Wang8b7ea532023-11-09 20:14:35 -080055 mode: "test",
Prabir Pradhana2764b72023-10-10 19:43:43 +000056 shared: {
57 enabled: false,
58 },
Siarhei Vishniakou96818962023-08-23 10:19:02 -070059}
60
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070061aidl_interface {
62 name: "inputconstants",
63 host_supported: true,
64 vendor_available: true,
65 unstable: true,
66 srcs: [
67 ":inputconstants_aidl",
68 ],
69
70 backend: {
71 rust: {
72 enabled: true,
73 },
74 },
75}
76
77rust_bindgen {
78 name: "libinput_bindgen",
79 host_supported: true,
80 crate_name: "input_bindgen",
81 visibility: ["//frameworks/native/services/inputflinger"],
82 wrapper_src: "InputWrapper.hpp",
83
84 include_dirs: [
85 "frameworks/native/include",
86 ],
87
88 source_stem: "bindings",
89
90 bindgen_flags: [
91 "--verbose",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070092 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
93 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
94 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
95 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
96 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
97 "--allowlist-var=MAX_POINTER_ID",
Siarhei Vishniakou2d151ac2023-09-19 13:30:24 -070098 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
99 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
100 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER",
101 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION",
102 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION",
103 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK",
104 "--allowlist-var=AINPUT_SOURCE_UNKNOWN",
105 "--allowlist-var=AINPUT_SOURCE_KEYBOARD",
106 "--allowlist-var=AINPUT_SOURCE_DPAD",
107 "--allowlist-var=AINPUT_SOURCE_GAMEPAD",
108 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN",
109 "--allowlist-var=AINPUT_SOURCE_MOUSE",
110 "--allowlist-var=AINPUT_SOURCE_STYLUS",
111 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS",
112 "--allowlist-var=AINPUT_SOURCE_TRACKBALL",
113 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE",
114 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD",
115 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION",
116 "--allowlist-var=AINPUT_SOURCE_JOYSTICK",
117 "--allowlist-var=AINPUT_SOURCE_HDMI",
118 "--allowlist-var=AINPUT_SOURCE_SENSOR",
119 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000120 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NONE",
121 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC",
122 "--allowlist-var=AINPUT_KEYBOARD_TYPE_ALPHABETIC",
123 "--allowlist-var=AMETA_NONE",
124 "--allowlist-var=AMETA_ALT_ON",
125 "--allowlist-var=AMETA_ALT_LEFT_ON",
126 "--allowlist-var=AMETA_ALT_RIGHT_ON",
127 "--allowlist-var=AMETA_SHIFT_ON",
128 "--allowlist-var=AMETA_SHIFT_LEFT_ON",
129 "--allowlist-var=AMETA_SHIFT_RIGHT_ON",
130 "--allowlist-var=AMETA_SYM_ON",
131 "--allowlist-var=AMETA_FUNCTION_ON",
132 "--allowlist-var=AMETA_CTRL_ON",
133 "--allowlist-var=AMETA_CTRL_LEFT_ON",
134 "--allowlist-var=AMETA_CTRL_RIGHT_ON",
135 "--allowlist-var=AMETA_META_ON",
136 "--allowlist-var=AMETA_META_LEFT_ON",
137 "--allowlist-var=AMETA_META_RIGHT_ON",
138 "--allowlist-var=AMETA_CAPS_LOCK_ON",
139 "--allowlist-var=AMETA_NUM_LOCK_ON",
140 "--allowlist-var=AMETA_SCROLL_LOCK_ON",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700141 ],
142
143 static_libs: [
144 "inputconstants-cpp",
145 "libui-types",
146 ],
147 shared_libs: ["libc++"],
148 header_libs: [
149 "native_headers",
150 "jni_headers",
151 "flatbuffer_headers",
152 ],
153}
154
Cody Heiner0f00ad92024-02-13 14:19:25 -0800155cc_library_static {
156 name: "iinputflinger_aidl_lib_static",
157 host_supported: true,
158 srcs: [
159 "android/os/IInputFlinger.aidl",
160 "android/os/InputChannelCore.aidl",
161 ],
162 shared_libs: [
163 "libbinder",
164 ],
165 whole_static_libs: [
166 "libgui_window_info_static",
167 ],
168 aidl: {
169 export_aidl_headers: true,
170 local_include_dirs: ["."],
171 include_dirs: [
172 "frameworks/native/libs/gui",
173 "frameworks/native/libs/input",
174 ],
175 },
176}
177
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700178// Contains methods to help access C++ code from rust
179cc_library_static {
180 name: "libinput_from_rust_to_cpp",
181 cpp_std: "c++20",
182 host_supported: true,
183 cflags: [
184 "-Wall",
185 "-Wextra",
186 "-Werror",
187 ],
188 srcs: [
189 "FromRustToCpp.cpp",
190 ],
191
192 generated_headers: [
193 "cxx-bridge-header",
194 ],
195 generated_sources: ["libinput_cxx_bridge_code"],
196
Stephen Hinese9dfe772024-03-08 23:37:23 -0800197 lto: {
198 never: true,
199 },
200
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700201 shared_libs: [
202 "libbase",
203 ],
204}
205
Dan Willemsen59e086f2016-07-25 17:13:45 -0700206cc_library {
207 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800208 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700209 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800210 cflags: [
211 "-Wall",
212 "-Wextra",
213 "-Werror",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800214 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700215 "-Wthread-safety",
216 "-Wshadow",
217 "-Wshadow-field-in-constructor-modified",
218 "-Wshadow-uncaptured-local",
219 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800220 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700221 srcs: [
Harry Cuttse78184b2024-01-08 15:54:58 +0000222 "AccelerationCurve.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700223 "Input.cpp",
Siarhei Vishniakou0438ca82024-03-12 14:27:25 -0700224 "InputConsumer.cpp",
Siarhei Vishniakou2b920272024-02-27 19:49:51 -0800225 "InputConsumerNoResampling.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700226 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700227 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700228 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800229 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700230 "Keyboard.cpp",
231 "KeyCharacterMap.cpp",
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000232 "KeyboardClassifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700233 "KeyLayoutMap.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800234 "MotionPredictor.cpp",
Cody Heiner52db4742023-06-29 13:19:01 -0700235 "MotionPredictorMetricsManager.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800236 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700237 "PropertyMap.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800238 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600239 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700240 "VelocityControl.cpp",
241 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000242 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600243 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700244 ],
245
Philip Quinn8f953ab2022-12-06 15:37:07 -0800246 header_libs: [
247 "flatbuffer_headers",
248 "jni_headers",
Cody Heiner52db4742023-06-29 13:19:01 -0700249 "libeigen",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800250 "tensorflow_headers",
251 ],
Cody Heiner52db4742023-06-29 13:19:01 -0700252 export_header_lib_headers: [
253 "jni_headers",
254 "libeigen",
255 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100256
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000257 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700258 "cxx-bridge-header",
259 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000260 "toolbox_input_labels",
261 ],
262
Dan Willemsen59e086f2016-07-25 17:13:45 -0700263 shared_libs: [
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700264 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700265 "libbinder",
Siarhei Vishniakouc40f6e02024-04-25 15:49:29 -0700266 "libbinder_ndk",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700267 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800268 "liblog",
269 "libPlatformProperties",
Philip Quinnf84fa492023-06-26 14:15:15 -0700270 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700271 "libutils",
Jooyung Han3f669212023-12-05 14:18:19 +0900272 "libz", // needed by libkernelconfigs
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700273 "server_configurable_flags",
Philip Quinnda6a4482023-02-07 10:09:57 -0800274 ],
275
276 ldflags: [
277 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700278 ],
279
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000280 sanitize: {
281 undefined: true,
282 all_undefined: true,
283 misc_undefined: ["integer"],
284 },
285
chaviwfd9c1ed2020-07-01 10:57:59 -0700286 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700287 "inputconstants-cpp",
chaviwfd9c1ed2020-07-01 10:57:59 -0700288 "libui-types",
Philip Quinnda6a4482023-02-07 10:09:57 -0800289 "libtflite_static",
Jooyung Han3f669212023-12-05 14:18:19 +0900290 "libkernelconfigs",
chaviwfd9c1ed2020-07-01 10:57:59 -0700291 ],
292
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700293 whole_static_libs: [
Prabir Pradhanda4b6b22023-11-06 16:52:43 +0000294 "com.android.input.flags-aconfig-cc",
Prabir Pradhan0762b1f2023-06-22 23:08:18 +0000295 "libinput_rust_ffi",
Cody Heiner0f00ad92024-02-13 14:19:25 -0800296 "iinputflinger_aidl_lib_static",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700297 ],
298
chaviwfd9c1ed2020-07-01 10:57:59 -0700299 export_static_lib_headers: [
300 "libui-types",
301 ],
302
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700303 export_generated_headers: [
304 "cxx-bridge-header",
305 "libinput_cxx_bridge_header",
306 ],
307
Dan Willemsen59e086f2016-07-25 17:13:45 -0700308 target: {
309 android: {
Philip Quinn8f953ab2022-12-06 15:37:07 -0800310 required: [
311 "motion_predictor_model_prebuilt",
Philip Quinnf84fa492023-06-26 14:15:15 -0700312 "motion_predictor_model_config",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800313 ],
Cody Heinerb0b5b6c2024-05-09 18:31:12 -0700314 static_libs: [
315 "libstatslog_libinput",
316 "libstatssocket_lazy",
317 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700318 },
319 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700320 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000321 "bionic/libc/kernel/android/uapi/",
322 "bionic/libc/kernel/uapi",
Brett Chabot58208522020-09-09 13:55:24 -0700323 ],
324 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700325 },
326}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700327
Cody Heinerb0b5b6c2024-05-09 18:31:12 -0700328cc_library_static {
329 name: "libstatslog_libinput",
330 generated_sources: ["statslog_libinput.cpp"],
331 generated_headers: ["statslog_libinput.h"],
332 cflags: [
333 "-Wall",
334 "-Werror",
335 ],
336 export_generated_headers: ["statslog_libinput.h"],
337 shared_libs: [
338 "libcutils",
339 "liblog",
340 "libutils",
341 ],
342 static_libs: [
343 "libstatssocket_lazy",
344 ],
345}
346
347genrule {
348 name: "statslog_libinput.h",
349 tools: ["stats-log-api-gen"],
350 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h " +
351 "--module libinput --namespace android,libinput",
352 out: [
353 "statslog_libinput.h",
354 ],
355}
356
357genrule {
358 name: "statslog_libinput.cpp",
359 tools: ["stats-log-api-gen"],
360 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp " +
361 "--module libinput --namespace android,libinput " +
362 "--importHeader statslog_libinput.h",
363 out: [
364 "statslog_libinput.cpp",
365 ],
366}
367
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700368cc_defaults {
369 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000370 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700371 host_supported: true,
372 shared_libs: [
373 "libutils",
374 "libbase",
375 "liblog",
376 ],
377}
378
379cc_fuzz {
380 name: "libinput_fuzz_propertymap",
381 defaults: ["libinput_fuzz_defaults"],
382 srcs: [
383 "PropertyMap.cpp",
384 "PropertyMap_fuzz.cpp",
385 ],
386}
387
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700388subdirs = ["tests"]