blob: 252040d1b039003dbc08b32302ff9c4f32b04331 [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",
42 srcs: ["input_flags.aconfig"],
43}
44
45cc_aconfig_library {
Prabir Pradhanda4b6b22023-11-06 16:52:43 +000046 name: "com.android.input.flags-aconfig-cc",
47 aconfig_declarations: "com.android.input.flags-aconfig",
Siarhei Vishniakou96818962023-08-23 10:19:02 -070048 host_supported: true,
Prabir Pradhana2764b72023-10-10 19:43:43 +000049 // Use the test version of the aconfig flag library by default to allow tests to set local
50 // overrides for flags, without having to link against a separate version of libinput or of this
51 // library. Bundling this library directly into libinput prevents us from having to add this
52 // library as a shared lib dependency everywhere where libinput is used.
Zi Wang8b7ea532023-11-09 20:14:35 -080053 mode: "test",
Prabir Pradhana2764b72023-10-10 19:43:43 +000054 shared: {
55 enabled: false,
56 },
Siarhei Vishniakou96818962023-08-23 10:19:02 -070057}
58
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070059aidl_interface {
60 name: "inputconstants",
61 host_supported: true,
62 vendor_available: true,
63 unstable: true,
64 srcs: [
65 ":inputconstants_aidl",
66 ],
67
68 backend: {
69 rust: {
70 enabled: true,
71 },
72 },
73}
74
75rust_bindgen {
76 name: "libinput_bindgen",
77 host_supported: true,
78 crate_name: "input_bindgen",
79 visibility: ["//frameworks/native/services/inputflinger"],
80 wrapper_src: "InputWrapper.hpp",
81
82 include_dirs: [
83 "frameworks/native/include",
84 ],
85
86 source_stem: "bindings",
87
88 bindgen_flags: [
89 "--verbose",
90 "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED",
Siarhei Vishniakou227a7f82023-07-18 18:30:32 -070091 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED",
92 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED",
93 "--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT",
94 "--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070095 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
96 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
97 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
98 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
99 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
100 "--allowlist-var=MAX_POINTER_ID",
Siarhei Vishniakou2d151ac2023-09-19 13:30:24 -0700101 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
102 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",
103 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER",
104 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION",
105 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION",
106 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK",
107 "--allowlist-var=AINPUT_SOURCE_UNKNOWN",
108 "--allowlist-var=AINPUT_SOURCE_KEYBOARD",
109 "--allowlist-var=AINPUT_SOURCE_DPAD",
110 "--allowlist-var=AINPUT_SOURCE_GAMEPAD",
111 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN",
112 "--allowlist-var=AINPUT_SOURCE_MOUSE",
113 "--allowlist-var=AINPUT_SOURCE_STYLUS",
114 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS",
115 "--allowlist-var=AINPUT_SOURCE_TRACKBALL",
116 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE",
117 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD",
118 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION",
119 "--allowlist-var=AINPUT_SOURCE_JOYSTICK",
120 "--allowlist-var=AINPUT_SOURCE_HDMI",
121 "--allowlist-var=AINPUT_SOURCE_SENSOR",
122 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700123 ],
124
125 static_libs: [
126 "inputconstants-cpp",
127 "libui-types",
128 ],
129 shared_libs: ["libc++"],
130 header_libs: [
131 "native_headers",
132 "jni_headers",
133 "flatbuffer_headers",
134 ],
135}
136
137// Contains methods to help access C++ code from rust
138cc_library_static {
139 name: "libinput_from_rust_to_cpp",
140 cpp_std: "c++20",
141 host_supported: true,
142 cflags: [
143 "-Wall",
144 "-Wextra",
145 "-Werror",
146 ],
147 srcs: [
148 "FromRustToCpp.cpp",
149 ],
150
151 generated_headers: [
152 "cxx-bridge-header",
153 ],
154 generated_sources: ["libinput_cxx_bridge_code"],
155
Stephen Hinese9dfe772024-03-08 23:37:23 -0800156 lto: {
157 never: true,
158 },
159
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700160 shared_libs: [
161 "libbase",
162 ],
163}
164
Dan Willemsen59e086f2016-07-25 17:13:45 -0700165cc_library {
166 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800167 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700168 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800169 cflags: [
170 "-Wall",
171 "-Wextra",
172 "-Werror",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800173 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700174 "-Wthread-safety",
175 "-Wshadow",
176 "-Wshadow-field-in-constructor-modified",
177 "-Wshadow-uncaptured-local",
178 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800179 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700180 srcs: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700181 "android/os/IInputFlinger.aidl",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700182 "Input.cpp",
183 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700184 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700185 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800186 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700187 "Keyboard.cpp",
188 "KeyCharacterMap.cpp",
189 "KeyLayoutMap.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800190 "MotionPredictor.cpp",
Cody Heiner7543d902023-06-29 13:19:01 -0700191 "MotionPredictorMetricsManager.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800192 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700193 "PropertyMap.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800194 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600195 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700196 "VelocityControl.cpp",
197 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000198 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600199 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700200 ],
201
Philip Quinn8f953ab2022-12-06 15:37:07 -0800202 header_libs: [
203 "flatbuffer_headers",
204 "jni_headers",
Cody Heiner7543d902023-06-29 13:19:01 -0700205 "libeigen",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800206 "tensorflow_headers",
207 ],
Cody Heiner7543d902023-06-29 13:19:01 -0700208 export_header_lib_headers: [
209 "jni_headers",
210 "libeigen",
211 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100212
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000213 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700214 "cxx-bridge-header",
215 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000216 "toolbox_input_labels",
217 ],
218
Dan Willemsen59e086f2016-07-25 17:13:45 -0700219 shared_libs: [
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700220 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700221 "libbinder",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700222 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800223 "liblog",
224 "libPlatformProperties",
Philip Quinnf84fa492023-06-26 14:15:15 -0700225 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700226 "libutils",
Jooyung Han336a87e2023-12-05 14:18:19 +0900227 "libz", // needed by libkernelconfigs
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700228 "server_configurable_flags",
Philip Quinnda6a4482023-02-07 10:09:57 -0800229 ],
230
231 ldflags: [
232 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700233 ],
234
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000235 sanitize: {
236 undefined: true,
237 all_undefined: true,
238 misc_undefined: ["integer"],
239 },
240
chaviwfd9c1ed2020-07-01 10:57:59 -0700241 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700242 "inputconstants-cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700243 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700244 "libui-types",
Philip Quinnda6a4482023-02-07 10:09:57 -0800245 "libtflite_static",
Jooyung Han336a87e2023-12-05 14:18:19 +0900246 "libkernelconfigs",
chaviwfd9c1ed2020-07-01 10:57:59 -0700247 ],
248
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700249 whole_static_libs: [
Prabir Pradhanda4b6b22023-11-06 16:52:43 +0000250 "com.android.input.flags-aconfig-cc",
Prabir Pradhan0762b1f2023-06-22 23:08:18 +0000251 "libinput_rust_ffi",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700252 ],
253
chaviwfd9c1ed2020-07-01 10:57:59 -0700254 export_static_lib_headers: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700255 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700256 "libui-types",
257 ],
258
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700259 export_generated_headers: [
260 "cxx-bridge-header",
261 "libinput_cxx_bridge_header",
262 ],
263
Dan Willemsen59e086f2016-07-25 17:13:45 -0700264 target: {
265 android: {
Bernardo Rufinoea97d182020-08-19 14:43:14 +0100266 export_shared_lib_headers: ["libbinder"],
267
Dan Willemsen59e086f2016-07-25 17:13:45 -0700268 shared_libs: [
269 "libutils",
270 "libbinder",
Cody Heiner7543d902023-06-29 13:19:01 -0700271 // Stats logging library and its dependencies.
272 "libstatslog_libinput",
273 "libstatsbootstrap",
274 "android.os.statsbootstrap_aidl-cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700275 ],
Evgenii Stepanovde982972017-01-31 16:37:44 -0800276
Philip Quinn8f953ab2022-12-06 15:37:07 -0800277 required: [
278 "motion_predictor_model_prebuilt",
Philip Quinnf84fa492023-06-26 14:15:15 -0700279 "motion_predictor_model_config",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800280 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700281 },
282 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700283 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000284 "bionic/libc/kernel/android/uapi/",
285 "bionic/libc/kernel/uapi",
Colin Cross433cfd92021-07-16 22:29:59 -0700286 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700287 },
288 },
Chris Ye0783e992020-06-02 21:34:49 -0700289
290 aidl: {
291 local_include_dirs: ["."],
Brett Chabot58208522020-09-09 13:55:24 -0700292 export_aidl_headers: true,
chaviw3277faf2021-05-19 16:45:23 -0500293 include_dirs: [
294 "frameworks/native/libs/gui",
295 ],
Chris Ye0783e992020-06-02 21:34:49 -0700296 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700297}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700298
Cody Heiner7543d902023-06-29 13:19:01 -0700299// Use bootstrap version of stats logging library.
300// libinput is a bootstrap process (starts early in the boot process), and thus can't use the normal
301// `libstatslog` because that requires `libstatssocket`, which is only available later in the boot.
302cc_library {
303 name: "libstatslog_libinput",
304 generated_sources: ["statslog_libinput.cpp"],
305 generated_headers: ["statslog_libinput.h"],
306 export_generated_headers: ["statslog_libinput.h"],
307 shared_libs: [
308 "libbinder",
309 "libstatsbootstrap",
310 "libutils",
311 "android.os.statsbootstrap_aidl-cpp",
312 ],
313}
314
315genrule {
316 name: "statslog_libinput.h",
317 tools: ["stats-log-api-gen"],
318 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h --module libinput" +
319 " --namespace android,stats,libinput --bootstrap",
320 out: [
321 "statslog_libinput.h",
322 ],
323}
324
325genrule {
326 name: "statslog_libinput.cpp",
327 tools: ["stats-log-api-gen"],
328 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp --module libinput" +
329 " --namespace android,stats,libinput --importHeader statslog_libinput.h" +
330 " --bootstrap",
331 out: [
332 "statslog_libinput.cpp",
333 ],
334}
335
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700336cc_defaults {
337 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000338 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700339 host_supported: true,
340 shared_libs: [
341 "libutils",
342 "libbase",
343 "liblog",
344 ],
345}
346
347cc_fuzz {
348 name: "libinput_fuzz_propertymap",
349 defaults: ["libinput_fuzz_defaults"],
350 srcs: [
351 "PropertyMap.cpp",
352 "PropertyMap_fuzz.cpp",
353 ],
354}
355
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700356subdirs = ["tests"]