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 17package { 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 26filegroup { 27 name: "inputconstants_aidl", 28 srcs: [ 29 "android/os/IInputConstants.aidl", 30 "android/os/InputEventInjectionResult.aidl", 31 "android/os/InputEventInjectionSync.aidl", 32 "android/os/InputConfig.aidl", 33 "android/os/MotionEventFlag.aidl", 34 "android/os/PointerIconType.aidl", 35 ], 36} 37 38///////////////////////////////////////////////// 39// flags 40///////////////////////////////////////////////// 41aconfig_declarations { 42 name: "com.android.input.flags-aconfig", 43 package: "com.android.input.flags", 44 container: "system", 45 srcs: ["input_flags.aconfig"], 46} 47 48cc_aconfig_library { 49 name: "com.android.input.flags-aconfig-cc", 50 aconfig_declarations: "com.android.input.flags-aconfig", 51 host_supported: true, 52 // Use the test version of the aconfig flag library by default to allow tests to set local 53 // overrides for flags, without having to link against a separate version of libinput or of this 54 // library. Bundling this library directly into libinput prevents us from having to add this 55 // library as a shared lib dependency everywhere where libinput is used. 56 mode: "test", 57 shared: { 58 enabled: false, 59 }, 60} 61 62aidl_interface { 63 name: "inputconstants", 64 host_supported: true, 65 vendor_available: true, 66 unstable: true, 67 srcs: [ 68 ":inputconstants_aidl", 69 ], 70 71 backend: { 72 rust: { 73 enabled: true, 74 }, 75 }, 76} 77 78rust_bindgen { 79 name: "libinput_bindgen", 80 host_supported: true, 81 crate_name: "input_bindgen", 82 visibility: ["//frameworks/native/services/inputflinger"], 83 wrapper_src: "InputWrapper.hpp", 84 85 source_stem: "bindings", 86 87 bindgen_flags: [ 88 "--verbose", 89 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL", 90 "--allowlist-var=AMOTION_EVENT_ACTION_UP", 91 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN", 92 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN", 93 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT", 94 "--allowlist-var=MAX_POINTER_ID", 95 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE", 96 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON", 97 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER", 98 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION", 99 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION", 100 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK", 101 "--allowlist-var=AINPUT_SOURCE_UNKNOWN", 102 "--allowlist-var=AINPUT_SOURCE_KEYBOARD", 103 "--allowlist-var=AINPUT_SOURCE_DPAD", 104 "--allowlist-var=AINPUT_SOURCE_GAMEPAD", 105 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN", 106 "--allowlist-var=AINPUT_SOURCE_MOUSE", 107 "--allowlist-var=AINPUT_SOURCE_STYLUS", 108 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS", 109 "--allowlist-var=AINPUT_SOURCE_TRACKBALL", 110 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE", 111 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD", 112 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION", 113 "--allowlist-var=AINPUT_SOURCE_JOYSTICK", 114 "--allowlist-var=AINPUT_SOURCE_HDMI", 115 "--allowlist-var=AINPUT_SOURCE_SENSOR", 116 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER", 117 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NONE", 118 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC", 119 "--allowlist-var=AINPUT_KEYBOARD_TYPE_ALPHABETIC", 120 "--allowlist-var=AMETA_NONE", 121 "--allowlist-var=AMETA_ALT_ON", 122 "--allowlist-var=AMETA_ALT_LEFT_ON", 123 "--allowlist-var=AMETA_ALT_RIGHT_ON", 124 "--allowlist-var=AMETA_SHIFT_ON", 125 "--allowlist-var=AMETA_SHIFT_LEFT_ON", 126 "--allowlist-var=AMETA_SHIFT_RIGHT_ON", 127 "--allowlist-var=AMETA_SYM_ON", 128 "--allowlist-var=AMETA_FUNCTION_ON", 129 "--allowlist-var=AMETA_CTRL_ON", 130 "--allowlist-var=AMETA_CTRL_LEFT_ON", 131 "--allowlist-var=AMETA_CTRL_RIGHT_ON", 132 "--allowlist-var=AMETA_META_ON", 133 "--allowlist-var=AMETA_META_LEFT_ON", 134 "--allowlist-var=AMETA_META_RIGHT_ON", 135 "--allowlist-var=AMETA_CAPS_LOCK_ON", 136 "--allowlist-var=AMETA_NUM_LOCK_ON", 137 "--allowlist-var=AMETA_SCROLL_LOCK_ON", 138 ], 139 140 static_libs: [ 141 "inputconstants-cpp", 142 "libui-types", 143 ], 144 shared_libs: ["libc++"], 145 header_libs: [ 146 "native_headers", 147 "jni_headers", 148 "flatbuffer_headers", 149 ], 150} 151 152cc_library_static { 153 name: "iinputflinger_aidl_lib_static", 154 host_supported: true, 155 srcs: [ 156 "android/os/IInputFlinger.aidl", 157 "android/os/InputChannelCore.aidl", 158 ], 159 shared_libs: [ 160 "libbinder", 161 ], 162 whole_static_libs: [ 163 "libgui_window_info_static", 164 ], 165 aidl: { 166 export_aidl_headers: true, 167 local_include_dirs: ["."], 168 include_dirs: [ 169 "frameworks/native/libs/gui", 170 "frameworks/native/libs/input", 171 ], 172 }, 173} 174 175// Contains methods to help access C++ code from rust 176cc_library_static { 177 name: "libinput_from_rust_to_cpp", 178 cpp_std: "c++20", 179 host_supported: true, 180 cflags: [ 181 "-Wall", 182 "-Wextra", 183 "-Werror", 184 ], 185 srcs: [ 186 "FromRustToCpp.cpp", 187 ], 188 189 generated_headers: [ 190 "cxx-bridge-header", 191 ], 192 generated_sources: ["libinput_cxx_bridge_code"], 193 194 lto: { 195 never: true, 196 }, 197 198 shared_libs: [ 199 "libbase", 200 ], 201} 202 203cc_library { 204 name: "libinput", 205 cpp_std: "c++20", 206 host_supported: true, 207 cflags: [ 208 "-Wall", 209 "-Wextra", 210 "-Werror", 211 "-Wno-unused-parameter", 212 "-Wthread-safety", 213 "-Wshadow", 214 "-Wshadow-field-in-constructor-modified", 215 "-Wshadow-uncaptured-local", 216 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", 217 ], 218 srcs: [ 219 "AccelerationCurve.cpp", 220 "CoordinateFilter.cpp", 221 "Input.cpp", 222 "InputConsumer.cpp", 223 "InputConsumerNoResampling.cpp", 224 "InputDevice.cpp", 225 "InputEventLabels.cpp", 226 "InputTransport.cpp", 227 "InputVerifier.cpp", 228 "Keyboard.cpp", 229 "KeyCharacterMap.cpp", 230 "KeyboardClassifier.cpp", 231 "KeyLayoutMap.cpp", 232 "MotionPredictor.cpp", 233 "MotionPredictorMetricsManager.cpp", 234 "OneEuroFilter.cpp", 235 "PrintTools.cpp", 236 "PropertyMap.cpp", 237 "Resampler.cpp", 238 "TfLiteMotionPredictor.cpp", 239 "TouchVideoFrame.cpp", 240 "VelocityControl.cpp", 241 "VelocityTracker.cpp", 242 "VirtualInputDevice.cpp", 243 "VirtualKeyMap.cpp", 244 ], 245 246 header_libs: [ 247 "flatbuffer_headers", 248 "jni_headers", 249 "libeigen", 250 "tensorflow_headers", 251 ], 252 export_header_lib_headers: [ 253 "jni_headers", 254 "libeigen", 255 ], 256 257 generated_headers: [ 258 "cxx-bridge-header", 259 "libinput_cxx_bridge_header", 260 "toolbox_input_labels", 261 ], 262 263 shared_libs: [ 264 "android.companion.virtualdevice.flags-aconfig-cc", 265 "libbase", 266 "libbinder", 267 "libbinder_ndk", 268 "libcutils", 269 "liblog", 270 "libPlatformProperties", 271 "libtinyxml2", 272 "libutils", 273 "libz", // needed by libkernelconfigs 274 "server_configurable_flags", 275 ], 276 277 ldflags: [ 278 "-Wl,--exclude-libs=libtflite_static.a", 279 ], 280 281 sanitize: { 282 undefined: true, 283 all_undefined: true, 284 misc_undefined: ["integer"], 285 }, 286 287 static_libs: [ 288 "inputconstants-cpp", 289 "libui-types", 290 "libtflite_static", 291 "libkernelconfigs", 292 ], 293 294 whole_static_libs: [ 295 "com.android.input.flags-aconfig-cc", 296 "libinput_rust_ffi", 297 "iinputflinger_aidl_lib_static", 298 ], 299 300 export_static_lib_headers: [ 301 "libui-types", 302 ], 303 304 export_generated_headers: [ 305 "cxx-bridge-header", 306 "libinput_cxx_bridge_header", 307 ], 308 309 target: { 310 android: { 311 required: [ 312 "motion_predictor_model_prebuilt", 313 "motion_predictor_model_config", 314 ], 315 static_libs: [ 316 "libstatslog_libinput", 317 "libstatssocket_lazy", 318 ], 319 }, 320 host: { 321 include_dirs: [ 322 "bionic/libc/kernel/android/uapi/", 323 "bionic/libc/kernel/uapi", 324 ], 325 }, 326 }, 327} 328 329cc_library_static { 330 name: "libstatslog_libinput", 331 generated_sources: ["statslog_libinput.cpp"], 332 generated_headers: ["statslog_libinput.h"], 333 cflags: [ 334 "-Wall", 335 "-Werror", 336 ], 337 export_generated_headers: ["statslog_libinput.h"], 338 shared_libs: [ 339 "libcutils", 340 "liblog", 341 "libutils", 342 ], 343 static_libs: [ 344 "libstatssocket_lazy", 345 ], 346} 347 348genrule { 349 name: "statslog_libinput.h", 350 tools: ["stats-log-api-gen"], 351 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h " + 352 "--module libinput --namespace android,libinput", 353 out: [ 354 "statslog_libinput.h", 355 ], 356} 357 358genrule { 359 name: "statslog_libinput.cpp", 360 tools: ["stats-log-api-gen"], 361 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp " + 362 "--module libinput --namespace android,libinput " + 363 "--importHeader statslog_libinput.h", 364 out: [ 365 "statslog_libinput.cpp", 366 ], 367} 368 369cc_defaults { 370 name: "libinput_fuzz_defaults", 371 cpp_std: "c++20", 372 host_supported: true, 373 shared_libs: [ 374 "libutils", 375 "libbase", 376 "liblog", 377 ], 378} 379 380cc_fuzz { 381 name: "libinput_fuzz_propertymap", 382 defaults: ["libinput_fuzz_defaults"], 383 srcs: [ 384 "PropertyMap.cpp", 385 "PropertyMap_fuzz.cpp", 386 ], 387} 388 389subdirs = ["tests"] 390