blob: 8b693390d0103f2b18ab1112a0899ec5b0c823e1 [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 {
Prabir Pradhanda4b6b22023-11-06 16:52:43 +000040 name: "com.android.input.flags-aconfig",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070041 package: "com.android.input.flags",
Oriol Prieto Gasco33fd22e2024-02-06 18:34:41 +000042 container: "system",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070043 srcs: ["input_flags.aconfig"],
44}
45
46cc_aconfig_library {
Prabir Pradhanda4b6b22023-11-06 16:52:43 +000047 name: "com.android.input.flags-aconfig-cc",
48 aconfig_declarations: "com.android.input.flags-aconfig",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070049 host_supported: true,
Prabir Pradhana2764b72023-10-10 19:43:43 +000050 // Use the test version of the aconfig flag library by default to allow tests to set local
51 // overrides for flags, without having to link against a separate version of libinput or of this
52 // library. Bundling this library directly into libinput prevents us from having to add this
53 // library as a shared lib dependency everywhere where libinput is used.
Zi Wang8b7ea532023-11-09 20:14:35 -080054 mode: "test",
Prabir Pradhana2764b72023-10-10 19:43:43 +000055 shared: {
56 enabled: false,
57 },
Siarhei Vishniakou96818962023-08-23 10:19:02 -070058}
59
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070060aidl_interface {
61 name: "inputconstants",
62 host_supported: true,
63 vendor_available: true,
64 unstable: true,
65 srcs: [
66 ":inputconstants_aidl",
67 ],
68
69 backend: {
70 rust: {
71 enabled: true,
72 },
73 },
74}
75
76rust_bindgen {
77 name: "libinput_bindgen",
78 host_supported: true,
79 crate_name: "input_bindgen",
80 visibility: ["//frameworks/native/services/inputflinger"],
81 wrapper_src: "InputWrapper.hpp",
82
83 include_dirs: [
84 "frameworks/native/include",
85 ],
86
87 source_stem: "bindings",
88
89 bindgen_flags: [
90 "--verbose",
91 "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED",
Siarhei Vishniakou227a7f82023-07-18 18:30:32 -070092 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED",
93 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED",
94 "--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT",
95 "--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070096 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
97 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
98 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
99 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
100 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
101 "--allowlist-var=MAX_POINTER_ID",
Siarhei Vishniakou2d151ac2023-09-19 13:30:24 -0700102 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
103 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
104 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER",
105 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION",
106 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION",
107 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK",
108 "--allowlist-var=AINPUT_SOURCE_UNKNOWN",
109 "--allowlist-var=AINPUT_SOURCE_KEYBOARD",
110 "--allowlist-var=AINPUT_SOURCE_DPAD",
111 "--allowlist-var=AINPUT_SOURCE_GAMEPAD",
112 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN",
113 "--allowlist-var=AINPUT_SOURCE_MOUSE",
114 "--allowlist-var=AINPUT_SOURCE_STYLUS",
115 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS",
116 "--allowlist-var=AINPUT_SOURCE_TRACKBALL",
117 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE",
118 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD",
119 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION",
120 "--allowlist-var=AINPUT_SOURCE_JOYSTICK",
121 "--allowlist-var=AINPUT_SOURCE_HDMI",
122 "--allowlist-var=AINPUT_SOURCE_SENSOR",
123 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700124 ],
125
126 static_libs: [
127 "inputconstants-cpp",
128 "libui-types",
129 ],
130 shared_libs: ["libc++"],
131 header_libs: [
132 "native_headers",
133 "jni_headers",
134 "flatbuffer_headers",
135 ],
136}
137
138// Contains methods to help access C++ code from rust
139cc_library_static {
140 name: "libinput_from_rust_to_cpp",
141 cpp_std: "c++20",
142 host_supported: true,
143 cflags: [
144 "-Wall",
145 "-Wextra",
146 "-Werror",
147 ],
148 srcs: [
149 "FromRustToCpp.cpp",
150 ],
151
152 generated_headers: [
153 "cxx-bridge-header",
154 ],
155 generated_sources: ["libinput_cxx_bridge_code"],
156
157 shared_libs: [
158 "libbase",
159 ],
160}
161
Dan Willemsen59e086f2016-07-25 17:13:45 -0700162cc_library {
163 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800164 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700165 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800166 cflags: [
167 "-Wall",
168 "-Wextra",
169 "-Werror",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800170 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700171 "-Wthread-safety",
172 "-Wshadow",
173 "-Wshadow-field-in-constructor-modified",
174 "-Wshadow-uncaptured-local",
175 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800176 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700177 srcs: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700178 "android/os/IInputFlinger.aidl",
Siarhei Vishniakou8d660132024-01-11 16:48:44 -0800179 "android/os/InputChannelCore.aidl",
Harry Cuttse78184b2024-01-08 15:54:58 +0000180 "AccelerationCurve.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700181 "Input.cpp",
182 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700183 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700184 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800185 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700186 "Keyboard.cpp",
187 "KeyCharacterMap.cpp",
188 "KeyLayoutMap.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800189 "MotionPredictor.cpp",
Cody Heiner52db4742023-06-29 13:19:01 -0700190 "MotionPredictorMetricsManager.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800191 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700192 "PropertyMap.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800193 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600194 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700195 "VelocityControl.cpp",
196 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000197 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600198 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700199 ],
200
Philip Quinn8f953ab2022-12-06 15:37:07 -0800201 header_libs: [
202 "flatbuffer_headers",
203 "jni_headers",
Cody Heiner52db4742023-06-29 13:19:01 -0700204 "libeigen",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800205 "tensorflow_headers",
206 ],
Cody Heiner52db4742023-06-29 13:19:01 -0700207 export_header_lib_headers: [
208 "jni_headers",
209 "libeigen",
210 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100211
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000212 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700213 "cxx-bridge-header",
214 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000215 "toolbox_input_labels",
216 ],
217
Dan Willemsen59e086f2016-07-25 17:13:45 -0700218 shared_libs: [
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700219 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700220 "libbinder",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700221 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800222 "liblog",
223 "libPlatformProperties",
Philip Quinnf84fa492023-06-26 14:15:15 -0700224 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700225 "libutils",
Jooyung Han3f669212023-12-05 14:18:19 +0900226 "libz", // needed by libkernelconfigs
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700227 "server_configurable_flags",
Philip Quinnda6a4482023-02-07 10:09:57 -0800228 ],
229
230 ldflags: [
231 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700232 ],
233
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000234 sanitize: {
235 undefined: true,
236 all_undefined: true,
237 misc_undefined: ["integer"],
238 },
239
chaviwfd9c1ed2020-07-01 10:57:59 -0700240 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700241 "inputconstants-cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700242 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700243 "libui-types",
Philip Quinnda6a4482023-02-07 10:09:57 -0800244 "libtflite_static",
Jooyung Han3f669212023-12-05 14:18:19 +0900245 "libkernelconfigs",
chaviwfd9c1ed2020-07-01 10:57:59 -0700246 ],
247
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700248 whole_static_libs: [
Prabir Pradhanda4b6b22023-11-06 16:52:43 +0000249 "com.android.input.flags-aconfig-cc",
Prabir Pradhan0762b1f2023-06-22 23:08:18 +0000250 "libinput_rust_ffi",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700251 ],
252
chaviwfd9c1ed2020-07-01 10:57:59 -0700253 export_static_lib_headers: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700254 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700255 "libui-types",
256 ],
257
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700258 export_generated_headers: [
259 "cxx-bridge-header",
260 "libinput_cxx_bridge_header",
261 ],
262
Dan Willemsen59e086f2016-07-25 17:13:45 -0700263 target: {
264 android: {
Cody Heiner52db4742023-06-29 13:19:01 -0700265 export_shared_lib_headers: ["libbinder"],
266
267 shared_libs: [
268 "libutils",
269 "libbinder",
270 // Stats logging library and its dependencies.
271 "libstatslog_libinput",
272 "libstatsbootstrap",
273 "android.os.statsbootstrap_aidl-cpp",
274 ],
275
Philip Quinn8f953ab2022-12-06 15:37:07 -0800276 required: [
277 "motion_predictor_model_prebuilt",
Philip Quinnf84fa492023-06-26 14:15:15 -0700278 "motion_predictor_model_config",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800279 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700280 },
281 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700282 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000283 "bionic/libc/kernel/android/uapi/",
284 "bionic/libc/kernel/uapi",
Brett Chabot58208522020-09-09 13:55:24 -0700285 ],
286 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700287 },
Chris Ye0783e992020-06-02 21:34:49 -0700288
289 aidl: {
290 local_include_dirs: ["."],
Brett Chabot58208522020-09-09 13:55:24 -0700291 export_aidl_headers: true,
chaviw3277faf2021-05-19 16:45:23 -0500292 include_dirs: [
293 "frameworks/native/libs/gui",
294 ],
Chris Ye0783e992020-06-02 21:34:49 -0700295 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700296}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700297
Cody Heiner52db4742023-06-29 13:19:01 -0700298// Use bootstrap version of stats logging library.
299// libinput is a bootstrap process (starts early in the boot process), and thus can't use the normal
300// `libstatslog` because that requires `libstatssocket`, which is only available later in the boot.
301cc_library {
302 name: "libstatslog_libinput",
303 generated_sources: ["statslog_libinput.cpp"],
304 generated_headers: ["statslog_libinput.h"],
305 export_generated_headers: ["statslog_libinput.h"],
306 shared_libs: [
307 "libbinder",
308 "libstatsbootstrap",
309 "libutils",
310 "android.os.statsbootstrap_aidl-cpp",
311 ],
312}
313
314genrule {
315 name: "statslog_libinput.h",
316 tools: ["stats-log-api-gen"],
317 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h --module libinput" +
318 " --namespace android,stats,libinput --bootstrap",
319 out: [
320 "statslog_libinput.h",
321 ],
322}
323
324genrule {
325 name: "statslog_libinput.cpp",
326 tools: ["stats-log-api-gen"],
327 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp --module libinput" +
328 " --namespace android,stats,libinput --importHeader statslog_libinput.h" +
329 " --bootstrap",
330 out: [
331 "statslog_libinput.cpp",
332 ],
333}
334
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700335cc_defaults {
336 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000337 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700338 host_supported: true,
339 shared_libs: [
340 "libutils",
341 "libbase",
342 "liblog",
343 ],
344}
345
346cc_fuzz {
347 name: "libinput_fuzz_propertymap",
348 defaults: ["libinput_fuzz_defaults"],
349 srcs: [
350 "PropertyMap.cpp",
351 "PropertyMap_fuzz.cpp",
352 ],
353}
354
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700355subdirs = ["tests"]