Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 1 | // 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 Badour | 3306e49 | 2021-02-25 15:35:37 -0800 | [diff] [blame] | 17 | package { |
| 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 Vishniakou | 7062295 | 2020-07-30 11:17:23 -0500 | [diff] [blame] | 26 | filegroup { |
| 27 | name: "inputconstants_aidl", |
| 28 | srcs: [ |
Siarhei Vishniakou | ae6229e | 2019-12-30 16:23:19 -0800 | [diff] [blame] | 29 | "android/os/IInputConstants.aidl", |
| 30 | "android/os/InputEventInjectionResult.aidl", |
| 31 | "android/os/InputEventInjectionSync.aidl", |
Prabir Pradhan | 51e7db0 | 2022-02-07 06:02:57 -0800 | [diff] [blame] | 32 | "android/os/InputConfig.aidl", |
Siarhei Vishniakou | 7062295 | 2020-07-30 11:17:23 -0500 | [diff] [blame] | 33 | ], |
| 34 | } |
| 35 | |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 36 | aidl_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 | |
| 52 | rust_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 Vishniakou | 227a7f8 | 2023-07-18 18:30:32 -0700 | [diff] [blame] | 68 | "--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 Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 72 | "--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 |
| 93 | cc_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 Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 116 | cc_library { |
| 117 | name: "libinput", |
Siarhei Vishniakou | bb19287 | 2021-12-09 17:14:49 -0800 | [diff] [blame] | 118 | cpp_std: "c++20", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 119 | host_supported: true, |
Frank Barchard | 9e94788 | 2017-03-06 11:17:52 -0800 | [diff] [blame] | 120 | cflags: [ |
| 121 | "-Wall", |
| 122 | "-Wextra", |
| 123 | "-Werror", |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 124 | "-Wno-unused-parameter", |
Siarhei Vishniakou | 4c155eb | 2023-06-30 11:47:12 -0700 | [diff] [blame] | 125 | "-Wthread-safety", |
| 126 | "-Wshadow", |
| 127 | "-Wshadow-field-in-constructor-modified", |
| 128 | "-Wshadow-uncaptured-local", |
| 129 | "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", |
Frank Barchard | 9e94788 | 2017-03-06 11:17:52 -0800 | [diff] [blame] | 130 | ], |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 131 | srcs: [ |
Siarhei Vishniakou | cac8427 | 2023-06-28 14:43:25 -0700 | [diff] [blame] | 132 | "android/os/IInputFlinger.aidl", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 133 | "Input.cpp", |
| 134 | "InputDevice.cpp", |
Chris Ye | 4958d06 | 2020-08-20 13:21:10 -0700 | [diff] [blame] | 135 | "InputEventLabels.cpp", |
Siarhei Vishniakou | cac8427 | 2023-06-28 14:43:25 -0700 | [diff] [blame] | 136 | "InputTransport.cpp", |
Siarhei Vishniakou | 92c8fd5 | 2023-01-29 14:57:43 -0800 | [diff] [blame] | 137 | "InputVerifier.cpp", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 138 | "Keyboard.cpp", |
| 139 | "KeyCharacterMap.cpp", |
| 140 | "KeyLayoutMap.cpp", |
Siarhei Vishniakou | 39147ce | 2022-11-15 12:13:04 -0800 | [diff] [blame] | 141 | "MotionPredictor.cpp", |
Cody Heiner | 52db474 | 2023-06-29 13:19:01 -0700 | [diff] [blame^] | 142 | "MotionPredictorMetricsManager.cpp", |
Siarhei Vishniakou | 814ace3 | 2022-03-04 15:12:16 -0800 | [diff] [blame] | 143 | "PrintTools.cpp", |
Siarhei Vishniakou | 32f36ae | 2020-09-02 20:17:10 -0700 | [diff] [blame] | 144 | "PropertyMap.cpp", |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 145 | "TfLiteMotionPredictor.cpp", |
Siarhei Vishniakou | 26cf29d | 2019-02-15 16:48:38 -0600 | [diff] [blame] | 146 | "TouchVideoFrame.cpp", |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 147 | "VelocityControl.cpp", |
| 148 | "VelocityTracker.cpp", |
Zixuan Qu | dd0635d | 2023-02-06 04:52:38 +0000 | [diff] [blame] | 149 | "VirtualInputDevice.cpp", |
Siarhei Vishniakou | 5ac663d | 2019-02-15 17:15:56 -0600 | [diff] [blame] | 150 | "VirtualKeyMap.cpp", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 151 | ], |
| 152 | |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 153 | header_libs: [ |
| 154 | "flatbuffer_headers", |
| 155 | "jni_headers", |
Cody Heiner | 52db474 | 2023-06-29 13:19:01 -0700 | [diff] [blame^] | 156 | "libeigen", |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 157 | "tensorflow_headers", |
| 158 | ], |
Cody Heiner | 52db474 | 2023-06-29 13:19:01 -0700 | [diff] [blame^] | 159 | export_header_lib_headers: [ |
| 160 | "jni_headers", |
| 161 | "libeigen", |
| 162 | ], |
Orion Hodson | e32877a | 2020-04-22 11:10:13 +0100 | [diff] [blame] | 163 | |
Prabir Pradhan | 1e63fc2 | 2023-02-23 19:03:03 +0000 | [diff] [blame] | 164 | generated_headers: [ |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 165 | "cxx-bridge-header", |
| 166 | "libinput_cxx_bridge_header", |
Prabir Pradhan | 1e63fc2 | 2023-02-23 19:03:03 +0000 | [diff] [blame] | 167 | "toolbox_input_labels", |
| 168 | ], |
| 169 | |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 170 | shared_libs: [ |
Siarhei Vishniakou | ec2727e | 2017-07-06 10:22:03 -0700 | [diff] [blame] | 171 | "libbase", |
Siarhei Vishniakou | cac8427 | 2023-06-28 14:43:25 -0700 | [diff] [blame] | 172 | "libbinder", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 173 | "libcutils", |
Siarhei Vishniakou | 39147ce | 2022-11-15 12:13:04 -0800 | [diff] [blame] | 174 | "liblog", |
| 175 | "libPlatformProperties", |
Philip Quinn | f84fa49 | 2023-06-26 14:15:15 -0700 | [diff] [blame] | 176 | "libtinyxml2", |
Siarhei Vishniakou | 4c155eb | 2023-06-30 11:47:12 -0700 | [diff] [blame] | 177 | "libutils", |
Siarhei Vishniakou | a9fd82c | 2022-05-18 09:42:52 -0700 | [diff] [blame] | 178 | "libvintf", |
Philip Quinn | da6a448 | 2023-02-07 10:09:57 -0800 | [diff] [blame] | 179 | ], |
| 180 | |
| 181 | ldflags: [ |
| 182 | "-Wl,--exclude-libs=libtflite_static.a", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 183 | ], |
| 184 | |
Siarhei Vishniakou | dd88248 | 2023-04-28 21:13:26 +0000 | [diff] [blame] | 185 | sanitize: { |
| 186 | undefined: true, |
| 187 | all_undefined: true, |
| 188 | misc_undefined: ["integer"], |
| 189 | }, |
| 190 | |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 191 | static_libs: [ |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 192 | "inputconstants-cpp", |
Siarhei Vishniakou | cac8427 | 2023-06-28 14:43:25 -0700 | [diff] [blame] | 193 | "libgui_window_info_static", |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 194 | "libui-types", |
Philip Quinn | da6a448 | 2023-02-07 10:09:57 -0800 | [diff] [blame] | 195 | "libtflite_static", |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 196 | ], |
| 197 | |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 198 | whole_static_libs: [ |
Prabir Pradhan | 0762b1f | 2023-06-22 23:08:18 +0000 | [diff] [blame] | 199 | "libinput_rust_ffi", |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 200 | ], |
| 201 | |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 202 | export_static_lib_headers: [ |
Siarhei Vishniakou | cac8427 | 2023-06-28 14:43:25 -0700 | [diff] [blame] | 203 | "libgui_window_info_static", |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 204 | "libui-types", |
| 205 | ], |
| 206 | |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 207 | export_generated_headers: [ |
| 208 | "cxx-bridge-header", |
| 209 | "libinput_cxx_bridge_header", |
| 210 | ], |
| 211 | |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 212 | target: { |
| 213 | android: { |
Cody Heiner | 52db474 | 2023-06-29 13:19:01 -0700 | [diff] [blame^] | 214 | export_shared_lib_headers: ["libbinder"], |
| 215 | |
| 216 | shared_libs: [ |
| 217 | "libutils", |
| 218 | "libbinder", |
| 219 | // Stats logging library and its dependencies. |
| 220 | "libstatslog_libinput", |
| 221 | "libstatsbootstrap", |
| 222 | "android.os.statsbootstrap_aidl-cpp", |
| 223 | ], |
| 224 | |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 225 | required: [ |
| 226 | "motion_predictor_model_prebuilt", |
Philip Quinn | f84fa49 | 2023-06-26 14:15:15 -0700 | [diff] [blame] | 227 | "motion_predictor_model_config", |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 228 | ], |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 229 | }, |
| 230 | host: { |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 231 | include_dirs: [ |
Zixuan Qu | dd0635d | 2023-02-06 04:52:38 +0000 | [diff] [blame] | 232 | "bionic/libc/kernel/android/uapi/", |
| 233 | "bionic/libc/kernel/uapi", |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 234 | ], |
| 235 | }, |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 236 | }, |
Chris Ye | 0783e99 | 2020-06-02 21:34:49 -0700 | [diff] [blame] | 237 | |
| 238 | aidl: { |
| 239 | local_include_dirs: ["."], |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 240 | export_aidl_headers: true, |
chaviw | 3277faf | 2021-05-19 16:45:23 -0500 | [diff] [blame] | 241 | include_dirs: [ |
| 242 | "frameworks/native/libs/gui", |
| 243 | ], |
Chris Ye | 0783e99 | 2020-06-02 21:34:49 -0700 | [diff] [blame] | 244 | }, |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 245 | } |
Dan Willemsen | c7dd2b9 | 2016-08-25 17:05:22 -0700 | [diff] [blame] | 246 | |
Cody Heiner | 52db474 | 2023-06-29 13:19:01 -0700 | [diff] [blame^] | 247 | // Use bootstrap version of stats logging library. |
| 248 | // libinput is a bootstrap process (starts early in the boot process), and thus can't use the normal |
| 249 | // `libstatslog` because that requires `libstatssocket`, which is only available later in the boot. |
| 250 | cc_library { |
| 251 | name: "libstatslog_libinput", |
| 252 | generated_sources: ["statslog_libinput.cpp"], |
| 253 | generated_headers: ["statslog_libinput.h"], |
| 254 | export_generated_headers: ["statslog_libinput.h"], |
| 255 | shared_libs: [ |
| 256 | "libbinder", |
| 257 | "libstatsbootstrap", |
| 258 | "libutils", |
| 259 | "android.os.statsbootstrap_aidl-cpp", |
| 260 | ], |
| 261 | } |
| 262 | |
| 263 | genrule { |
| 264 | name: "statslog_libinput.h", |
| 265 | tools: ["stats-log-api-gen"], |
| 266 | cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h --module libinput" + |
| 267 | " --namespace android,stats,libinput --bootstrap", |
| 268 | out: [ |
| 269 | "statslog_libinput.h", |
| 270 | ], |
| 271 | } |
| 272 | |
| 273 | genrule { |
| 274 | name: "statslog_libinput.cpp", |
| 275 | tools: ["stats-log-api-gen"], |
| 276 | cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp --module libinput" + |
| 277 | " --namespace android,stats,libinput --importHeader statslog_libinput.h" + |
| 278 | " --bootstrap", |
| 279 | out: [ |
| 280 | "statslog_libinput.cpp", |
| 281 | ], |
| 282 | } |
| 283 | |
Siarhei Vishniakou | 32f36ae | 2020-09-02 20:17:10 -0700 | [diff] [blame] | 284 | cc_defaults { |
| 285 | name: "libinput_fuzz_defaults", |
Harry Cutts | 2b67ff1 | 2023-03-13 11:32:06 +0000 | [diff] [blame] | 286 | cpp_std: "c++20", |
Siarhei Vishniakou | 32f36ae | 2020-09-02 20:17:10 -0700 | [diff] [blame] | 287 | host_supported: true, |
| 288 | shared_libs: [ |
| 289 | "libutils", |
| 290 | "libbase", |
| 291 | "liblog", |
| 292 | ], |
| 293 | } |
| 294 | |
| 295 | cc_fuzz { |
| 296 | name: "libinput_fuzz_propertymap", |
| 297 | defaults: ["libinput_fuzz_defaults"], |
| 298 | srcs: [ |
| 299 | "PropertyMap.cpp", |
| 300 | "PropertyMap_fuzz.cpp", |
| 301 | ], |
| 302 | } |
| 303 | |
Dan Willemsen | c7dd2b9 | 2016-08-25 17:05:22 -0700 | [diff] [blame] | 304 | subdirs = ["tests"] |