blob: 36a01d37a5156145aebcba0bf98cfb5d7c33e53c [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 {
40 name: "aconfig_input_flags",
41 package: "com.android.input.flags",
42 srcs: ["input_flags.aconfig"],
43}
44
45cc_aconfig_library {
46 name: "aconfig_input_flags_c_lib",
47 aconfig_declarations: "aconfig_input_flags",
48 host_supported: true,
49}
50
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070051aidl_interface {
52 name: "inputconstants",
53 host_supported: true,
54 vendor_available: true,
55 unstable: true,
56 srcs: [
57 ":inputconstants_aidl",
58 ],
59
60 backend: {
61 rust: {
62 enabled: true,
63 },
64 },
65}
66
67rust_bindgen {
68 name: "libinput_bindgen",
69 host_supported: true,
70 crate_name: "input_bindgen",
71 visibility: ["//frameworks/native/services/inputflinger"],
72 wrapper_src: "InputWrapper.hpp",
73
74 include_dirs: [
75 "frameworks/native/include",
76 ],
77
78 source_stem: "bindings",
79
80 bindgen_flags: [
81 "--verbose",
82 "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED",
Siarhei Vishniakou227a7f82023-07-18 18:30:32 -070083 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED",
84 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED",
85 "--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT",
86 "--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070087 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
88 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
89 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
90 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
91 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
92 "--allowlist-var=MAX_POINTER_ID",
93 ],
94
95 static_libs: [
96 "inputconstants-cpp",
97 "libui-types",
98 ],
99 shared_libs: ["libc++"],
100 header_libs: [
101 "native_headers",
102 "jni_headers",
103 "flatbuffer_headers",
104 ],
105}
106
107// Contains methods to help access C++ code from rust
108cc_library_static {
109 name: "libinput_from_rust_to_cpp",
110 cpp_std: "c++20",
111 host_supported: true,
112 cflags: [
113 "-Wall",
114 "-Wextra",
115 "-Werror",
116 ],
117 srcs: [
118 "FromRustToCpp.cpp",
119 ],
120
121 generated_headers: [
122 "cxx-bridge-header",
123 ],
124 generated_sources: ["libinput_cxx_bridge_code"],
125
126 shared_libs: [
127 "libbase",
128 ],
129}
130
Dan Willemsen59e086f2016-07-25 17:13:45 -0700131cc_library {
132 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800133 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700134 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800135 cflags: [
136 "-Wall",
137 "-Wextra",
138 "-Werror",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800139 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700140 "-Wthread-safety",
141 "-Wshadow",
142 "-Wshadow-field-in-constructor-modified",
143 "-Wshadow-uncaptured-local",
144 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800145 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700146 srcs: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700147 "android/os/IInputFlinger.aidl",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700148 "Input.cpp",
149 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700150 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700151 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800152 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700153 "Keyboard.cpp",
154 "KeyCharacterMap.cpp",
155 "KeyLayoutMap.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800156 "MotionPredictor.cpp",
Cody Heiner52db4742023-06-29 13:19:01 -0700157 "MotionPredictorMetricsManager.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800158 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700159 "PropertyMap.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800160 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600161 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700162 "VelocityControl.cpp",
163 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000164 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600165 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700166 ],
167
Philip Quinn8f953ab2022-12-06 15:37:07 -0800168 header_libs: [
169 "flatbuffer_headers",
170 "jni_headers",
Cody Heiner52db4742023-06-29 13:19:01 -0700171 "libeigen",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800172 "tensorflow_headers",
173 ],
Cody Heiner52db4742023-06-29 13:19:01 -0700174 export_header_lib_headers: [
175 "jni_headers",
176 "libeigen",
177 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100178
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000179 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700180 "cxx-bridge-header",
181 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000182 "toolbox_input_labels",
183 ],
184
Dan Willemsen59e086f2016-07-25 17:13:45 -0700185 shared_libs: [
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700186 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700187 "libbinder",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700188 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800189 "liblog",
190 "libPlatformProperties",
Philip Quinnf84fa492023-06-26 14:15:15 -0700191 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700192 "libutils",
Siarhei Vishniakoua9fd82c2022-05-18 09:42:52 -0700193 "libvintf",
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700194 "server_configurable_flags",
Philip Quinnda6a4482023-02-07 10:09:57 -0800195 ],
196
197 ldflags: [
198 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700199 ],
200
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000201 sanitize: {
202 undefined: true,
203 all_undefined: true,
204 misc_undefined: ["integer"],
205 },
206
chaviwfd9c1ed2020-07-01 10:57:59 -0700207 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700208 "inputconstants-cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700209 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700210 "libui-types",
Philip Quinnda6a4482023-02-07 10:09:57 -0800211 "libtflite_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700212 ],
213
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700214 whole_static_libs: [
Siarhei Vishniakou96818962023-08-23 10:19:02 -0700215 "aconfig_input_flags_c_lib",
Prabir Pradhan0762b1f2023-06-22 23:08:18 +0000216 "libinput_rust_ffi",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700217 ],
218
chaviwfd9c1ed2020-07-01 10:57:59 -0700219 export_static_lib_headers: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700220 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700221 "libui-types",
222 ],
223
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700224 export_generated_headers: [
225 "cxx-bridge-header",
226 "libinput_cxx_bridge_header",
227 ],
228
Dan Willemsen59e086f2016-07-25 17:13:45 -0700229 target: {
230 android: {
Cody Heiner52db4742023-06-29 13:19:01 -0700231 export_shared_lib_headers: ["libbinder"],
232
233 shared_libs: [
234 "libutils",
235 "libbinder",
236 // Stats logging library and its dependencies.
237 "libstatslog_libinput",
238 "libstatsbootstrap",
239 "android.os.statsbootstrap_aidl-cpp",
240 ],
241
Philip Quinn8f953ab2022-12-06 15:37:07 -0800242 required: [
243 "motion_predictor_model_prebuilt",
Philip Quinnf84fa492023-06-26 14:15:15 -0700244 "motion_predictor_model_config",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800245 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700246 },
247 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700248 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000249 "bionic/libc/kernel/android/uapi/",
250 "bionic/libc/kernel/uapi",
Brett Chabot58208522020-09-09 13:55:24 -0700251 ],
252 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700253 },
Chris Ye0783e992020-06-02 21:34:49 -0700254
255 aidl: {
256 local_include_dirs: ["."],
Brett Chabot58208522020-09-09 13:55:24 -0700257 export_aidl_headers: true,
chaviw3277faf2021-05-19 16:45:23 -0500258 include_dirs: [
259 "frameworks/native/libs/gui",
260 ],
Chris Ye0783e992020-06-02 21:34:49 -0700261 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700262}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700263
Cody Heiner52db4742023-06-29 13:19:01 -0700264// Use bootstrap version of stats logging library.
265// libinput is a bootstrap process (starts early in the boot process), and thus can't use the normal
266// `libstatslog` because that requires `libstatssocket`, which is only available later in the boot.
267cc_library {
268 name: "libstatslog_libinput",
269 generated_sources: ["statslog_libinput.cpp"],
270 generated_headers: ["statslog_libinput.h"],
271 export_generated_headers: ["statslog_libinput.h"],
272 shared_libs: [
273 "libbinder",
274 "libstatsbootstrap",
275 "libutils",
276 "android.os.statsbootstrap_aidl-cpp",
277 ],
278}
279
280genrule {
281 name: "statslog_libinput.h",
282 tools: ["stats-log-api-gen"],
283 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h --module libinput" +
284 " --namespace android,stats,libinput --bootstrap",
285 out: [
286 "statslog_libinput.h",
287 ],
288}
289
290genrule {
291 name: "statslog_libinput.cpp",
292 tools: ["stats-log-api-gen"],
293 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp --module libinput" +
294 " --namespace android,stats,libinput --importHeader statslog_libinput.h" +
295 " --bootstrap",
296 out: [
297 "statslog_libinput.cpp",
298 ],
299}
300
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700301cc_defaults {
302 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000303 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700304 host_supported: true,
305 shared_libs: [
306 "libutils",
307 "libbase",
308 "liblog",
309 ],
310}
311
312cc_fuzz {
313 name: "libinput_fuzz_propertymap",
314 defaults: ["libinput_fuzz_defaults"],
315 srcs: [
316 "PropertyMap.cpp",
317 "PropertyMap_fuzz.cpp",
318 ],
319}
320
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700321subdirs = ["tests"]