blob: 757cde20747dc971eace610edba0b06a46e3a7a2 [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 Vishniakou5c02a712023-05-15 15:45:02 -070036aidl_interface {
37 name: "inputconstants",
38 host_supported: true,
39 vendor_available: true,
40 unstable: true,
41 srcs: [
42 ":inputconstants_aidl",
43 ],
44
45 backend: {
46 rust: {
47 enabled: true,
48 },
49 },
50}
51
52rust_bindgen {
53 name: "libinput_bindgen",
54 host_supported: true,
55 crate_name: "input_bindgen",
56 visibility: ["//frameworks/native/services/inputflinger"],
57 wrapper_src: "InputWrapper.hpp",
58
59 include_dirs: [
60 "frameworks/native/include",
61 ],
62
63 source_stem: "bindings",
64
65 bindgen_flags: [
66 "--verbose",
67 "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED",
Siarhei Vishniakou227a7f82023-07-18 18:30:32 -070068 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED",
69 "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED",
70 "--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT",
71 "--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -070072 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
73 "--allowlist-var=AMOTION_EVENT_ACTION_UP",
74 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
75 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
76 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
77 "--allowlist-var=MAX_POINTER_ID",
78 ],
79
80 static_libs: [
81 "inputconstants-cpp",
82 "libui-types",
83 ],
84 shared_libs: ["libc++"],
85 header_libs: [
86 "native_headers",
87 "jni_headers",
88 "flatbuffer_headers",
89 ],
90}
91
92// Contains methods to help access C++ code from rust
93cc_library_static {
94 name: "libinput_from_rust_to_cpp",
95 cpp_std: "c++20",
96 host_supported: true,
97 cflags: [
98 "-Wall",
99 "-Wextra",
100 "-Werror",
101 ],
102 srcs: [
103 "FromRustToCpp.cpp",
104 ],
105
106 generated_headers: [
107 "cxx-bridge-header",
108 ],
109 generated_sources: ["libinput_cxx_bridge_code"],
110
111 shared_libs: [
112 "libbase",
113 ],
114}
115
Dan Willemsen59e086f2016-07-25 17:13:45 -0700116cc_library {
117 name: "libinput",
Siarhei Vishniakoubb192872021-12-09 17:14:49 -0800118 cpp_std: "c++20",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700119 host_supported: true,
Frank Barchard9e947882017-03-06 11:17:52 -0800120 cflags: [
121 "-Wall",
122 "-Wextra",
123 "-Werror",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800124 "-Wno-unused-parameter",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700125 "-Wthread-safety",
126 "-Wshadow",
127 "-Wshadow-field-in-constructor-modified",
128 "-Wshadow-uncaptured-local",
129 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frank Barchard9e947882017-03-06 11:17:52 -0800130 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700131 srcs: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700132 "android/os/IInputFlinger.aidl",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700133 "Input.cpp",
134 "InputDevice.cpp",
Chris Ye4958d062020-08-20 13:21:10 -0700135 "InputEventLabels.cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700136 "InputTransport.cpp",
Siarhei Vishniakou92c8fd52023-01-29 14:57:43 -0800137 "InputVerifier.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700138 "Keyboard.cpp",
139 "KeyCharacterMap.cpp",
140 "KeyLayoutMap.cpp",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800141 "MotionPredictor.cpp",
Siarhei Vishniakou814ace32022-03-04 15:12:16 -0800142 "PrintTools.cpp",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700143 "PropertyMap.cpp",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800144 "TfLiteMotionPredictor.cpp",
Siarhei Vishniakou26cf29d2019-02-15 16:48:38 -0600145 "TouchVideoFrame.cpp",
Brett Chabot58208522020-09-09 13:55:24 -0700146 "VelocityControl.cpp",
147 "VelocityTracker.cpp",
Zixuan Qudd0635d2023-02-06 04:52:38 +0000148 "VirtualInputDevice.cpp",
Siarhei Vishniakou5ac663d2019-02-15 17:15:56 -0600149 "VirtualKeyMap.cpp",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700150 ],
151
Philip Quinn8f953ab2022-12-06 15:37:07 -0800152 header_libs: [
153 "flatbuffer_headers",
154 "jni_headers",
155 "tensorflow_headers",
156 ],
Orion Hodsone32877a2020-04-22 11:10:13 +0100157 export_header_lib_headers: ["jni_headers"],
158
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000159 generated_headers: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700160 "cxx-bridge-header",
161 "libinput_cxx_bridge_header",
Prabir Pradhan1e63fc22023-02-23 19:03:03 +0000162 "toolbox_input_labels",
163 ],
164
Dan Willemsen59e086f2016-07-25 17:13:45 -0700165 shared_libs: [
Siarhei Vishniakouec2727e2017-07-06 10:22:03 -0700166 "libbase",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700167 "libbinder",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700168 "libcutils",
Siarhei Vishniakou39147ce2022-11-15 12:13:04 -0800169 "liblog",
170 "libPlatformProperties",
Philip Quinnf84fa492023-06-26 14:15:15 -0700171 "libtinyxml2",
Siarhei Vishniakou4c155eb2023-06-30 11:47:12 -0700172 "libutils",
Siarhei Vishniakoua9fd82c2022-05-18 09:42:52 -0700173 "libvintf",
Philip Quinnda6a4482023-02-07 10:09:57 -0800174 ],
175
176 ldflags: [
177 "-Wl,--exclude-libs=libtflite_static.a",
Dan Willemsen59e086f2016-07-25 17:13:45 -0700178 ],
179
Siarhei Vishniakoudd882482023-04-28 21:13:26 +0000180 sanitize: {
181 undefined: true,
182 all_undefined: true,
183 misc_undefined: ["integer"],
184 },
185
chaviwfd9c1ed2020-07-01 10:57:59 -0700186 static_libs: [
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700187 "inputconstants-cpp",
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700188 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700189 "libui-types",
Philip Quinnda6a4482023-02-07 10:09:57 -0800190 "libtflite_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700191 ],
192
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700193 whole_static_libs: [
Prabir Pradhan0762b1f2023-06-22 23:08:18 +0000194 "libinput_rust_ffi",
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700195 ],
196
chaviwfd9c1ed2020-07-01 10:57:59 -0700197 export_static_lib_headers: [
Siarhei Vishniakoucac84272023-06-28 14:43:25 -0700198 "libgui_window_info_static",
chaviwfd9c1ed2020-07-01 10:57:59 -0700199 "libui-types",
200 ],
201
Siarhei Vishniakou5c02a712023-05-15 15:45:02 -0700202 export_generated_headers: [
203 "cxx-bridge-header",
204 "libinput_cxx_bridge_header",
205 ],
206
Dan Willemsen59e086f2016-07-25 17:13:45 -0700207 target: {
208 android: {
Philip Quinn8f953ab2022-12-06 15:37:07 -0800209 required: [
210 "motion_predictor_model_prebuilt",
Philip Quinnf84fa492023-06-26 14:15:15 -0700211 "motion_predictor_model_config",
Philip Quinn8f953ab2022-12-06 15:37:07 -0800212 ],
Dan Willemsen59e086f2016-07-25 17:13:45 -0700213 },
214 host: {
Brett Chabot58208522020-09-09 13:55:24 -0700215 include_dirs: [
Zixuan Qudd0635d2023-02-06 04:52:38 +0000216 "bionic/libc/kernel/android/uapi/",
217 "bionic/libc/kernel/uapi",
Brett Chabot58208522020-09-09 13:55:24 -0700218 ],
219 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700220 },
Chris Ye0783e992020-06-02 21:34:49 -0700221
222 aidl: {
223 local_include_dirs: ["."],
Brett Chabot58208522020-09-09 13:55:24 -0700224 export_aidl_headers: true,
chaviw3277faf2021-05-19 16:45:23 -0500225 include_dirs: [
226 "frameworks/native/libs/gui",
227 ],
Chris Ye0783e992020-06-02 21:34:49 -0700228 },
Dan Willemsen59e086f2016-07-25 17:13:45 -0700229}
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700230
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700231cc_defaults {
232 name: "libinput_fuzz_defaults",
Harry Cutts2b67ff12023-03-13 11:32:06 +0000233 cpp_std: "c++20",
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -0700234 host_supported: true,
235 shared_libs: [
236 "libutils",
237 "libbase",
238 "liblog",
239 ],
240}
241
242cc_fuzz {
243 name: "libinput_fuzz_propertymap",
244 defaults: ["libinput_fuzz_defaults"],
245 srcs: [
246 "PropertyMap.cpp",
247 "PropertyMap_fuzz.cpp",
248 ],
249}
250
Dan Willemsenc7dd2b92016-08-25 17:05:22 -0700251subdirs = ["tests"]