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/InputConfig.aidl", 31 "android/os/InputEventInjectionResult.aidl", 32 "android/os/InputEventInjectionSync.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 "--allowlist-var=AINPUT_KEYBOARD_TYPE_ALPHABETIC", 89 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NONE", 90 "--allowlist-var=AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC", 91 "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS", 92 "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON", 93 "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK", 94 "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION", 95 "--allowlist-var=AINPUT_SOURCE_CLASS_NONE", 96 "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER", 97 "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION", 98 "--allowlist-var=AINPUT_SOURCE_DPAD", 99 "--allowlist-var=AINPUT_SOURCE_GAMEPAD", 100 "--allowlist-var=AINPUT_SOURCE_HDMI", 101 "--allowlist-var=AINPUT_SOURCE_JOYSTICK", 102 "--allowlist-var=AINPUT_SOURCE_KEYBOARD", 103 "--allowlist-var=AINPUT_SOURCE_MOUSE", 104 "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE", 105 "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER", 106 "--allowlist-var=AINPUT_SOURCE_SENSOR", 107 "--allowlist-var=AINPUT_SOURCE_STYLUS", 108 "--allowlist-var=AINPUT_SOURCE_TOUCHPAD", 109 "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN", 110 "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION", 111 "--allowlist-var=AINPUT_SOURCE_TRACKBALL", 112 "--allowlist-var=AINPUT_SOURCE_UNKNOWN", 113 "--allowlist-var=AMETA_ALT_LEFT_ON", 114 "--allowlist-var=AMETA_ALT_ON", 115 "--allowlist-var=AMETA_ALT_RIGHT_ON", 116 "--allowlist-var=AMETA_CAPS_LOCK_ON", 117 "--allowlist-var=AMETA_CTRL_LEFT_ON", 118 "--allowlist-var=AMETA_CTRL_ON", 119 "--allowlist-var=AMETA_CTRL_RIGHT_ON", 120 "--allowlist-var=AMETA_FUNCTION_ON", 121 "--allowlist-var=AMETA_META_LEFT_ON", 122 "--allowlist-var=AMETA_META_ON", 123 "--allowlist-var=AMETA_META_RIGHT_ON", 124 "--allowlist-var=AMETA_NONE", 125 "--allowlist-var=AMETA_NUM_LOCK_ON", 126 "--allowlist-var=AMETA_SCROLL_LOCK_ON", 127 "--allowlist-var=AMETA_SHIFT_LEFT_ON", 128 "--allowlist-var=AMETA_SHIFT_ON", 129 "--allowlist-var=AMETA_SHIFT_RIGHT_ON", 130 "--allowlist-var=AMETA_SYM_ON", 131 "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL", 132 "--allowlist-var=AMOTION_EVENT_ACTION_DOWN", 133 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN", 134 "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT", 135 "--allowlist-var=AMOTION_EVENT_ACTION_UP", 136 "--allowlist-var=AMOTION_EVENT_BUTTON_BACK", 137 "--allowlist-var=AMOTION_EVENT_BUTTON_FORWARD", 138 "--allowlist-var=AMOTION_EVENT_BUTTON_PRIMARY", 139 "--allowlist-var=AMOTION_EVENT_BUTTON_SECONDARY", 140 "--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_PRIMARY", 141 "--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_SECONDARY", 142 "--allowlist-var=AMOTION_EVENT_BUTTON_TERTIARY", 143 "--allowlist-var=MAX_POINTER_ID", 144 "--verbose", 145 ], 146 147 static_libs: [ 148 "inputconstants-cpp", 149 "libui-types", 150 ], 151 shared_libs: ["libc++"], 152 header_libs: [ 153 "flatbuffer_headers", 154 "jni_headers", 155 "native_headers", 156 ], 157} 158 159cc_library_static { 160 name: "iinputflinger_aidl_lib_static", 161 host_supported: true, 162 srcs: [ 163 "android/os/IInputFlinger.aidl", 164 "android/os/InputChannelCore.aidl", 165 ], 166 shared_libs: [ 167 "libbinder", 168 ], 169 whole_static_libs: [ 170 "libgui_window_info_static", 171 ], 172 aidl: { 173 export_aidl_headers: true, 174 local_include_dirs: ["."], 175 include_dirs: [ 176 "frameworks/native/libs/gui", 177 "frameworks/native/libs/input", 178 ], 179 }, 180} 181 182// Contains methods to help access C++ code from rust 183cc_library_static { 184 name: "libinput_from_rust_to_cpp", 185 cpp_std: "c++20", 186 host_supported: true, 187 cflags: [ 188 "-Wall", 189 "-Werror", 190 "-Wextra", 191 ], 192 srcs: [ 193 "FromRustToCpp.cpp", 194 ], 195 196 generated_headers: [ 197 "cxx-bridge-header", 198 ], 199 generated_sources: ["libinput_cxx_bridge_code"], 200 201 lto: { 202 never: true, 203 }, 204 205 shared_libs: [ 206 "libbase", 207 ], 208} 209 210cc_library { 211 name: "libinput", 212 cpp_std: "c++20", 213 host_supported: true, 214 cflags: [ 215 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", 216 "-Wall", 217 "-Werror", 218 "-Wextra", 219 "-Wno-unused-parameter", 220 "-Wshadow", 221 "-Wshadow-field-in-constructor-modified", 222 "-Wshadow-uncaptured-local", 223 "-Wthread-safety", 224 ], 225 srcs: [ 226 "AccelerationCurve.cpp", 227 "CoordinateFilter.cpp", 228 "DisplayTopologyGraph.cpp", 229 "Input.cpp", 230 "InputConsumer.cpp", 231 "InputConsumerNoResampling.cpp", 232 "InputDevice.cpp", 233 "InputEventLabels.cpp", 234 "InputFlags.cpp", 235 "InputTransport.cpp", 236 "InputVerifier.cpp", 237 "KeyCharacterMap.cpp", 238 "KeyLayoutMap.cpp", 239 "Keyboard.cpp", 240 "KeyboardClassifier.cpp", 241 "MotionPredictor.cpp", 242 "MotionPredictorMetricsManager.cpp", 243 "OneEuroFilter.cpp", 244 "PrintTools.cpp", 245 "PropertyMap.cpp", 246 "Resampler.cpp", 247 "TfLiteMotionPredictor.cpp", 248 "TouchVideoFrame.cpp", 249 "VelocityControl.cpp", 250 "VelocityTracker.cpp", 251 "VirtualInputDevice.cpp", 252 "VirtualKeyMap.cpp", 253 ], 254 255 header_libs: [ 256 "flatbuffer_headers", 257 "jni_headers", 258 "libeigen", 259 "tensorflow_headers", 260 ], 261 export_header_lib_headers: [ 262 "jni_headers", 263 "libeigen", 264 ], 265 266 generated_headers: [ 267 "cxx-bridge-header", 268 "libinput_cxx_bridge_header", 269 "toolbox_input_labels", 270 ], 271 272 shared_libs: [ 273 "android.companion.virtualdevice.flags-aconfig-cc", 274 "com.android.window.flags.window-aconfig_flags_c_lib", 275 "libPlatformProperties", 276 "libaconfig_storage_read_api_cc", 277 "libbase", 278 "libbinder", 279 "libbinder_ndk", 280 "libcutils", 281 "liblog", 282 "libtinyxml2", 283 "libutils", 284 "libz", // needed by libkernelconfigs 285 "server_configurable_flags", 286 ], 287 288 ldflags: [ 289 "-Wl,--exclude-libs=libtflite_static.a", 290 ], 291 292 sanitize: { 293 undefined: true, 294 all_undefined: true, 295 misc_undefined: ["integer"], 296 }, 297 298 static_libs: [ 299 "inputconstants-cpp", 300 "libkernelconfigs", 301 "libtflite_static", 302 "libui-types", 303 ], 304 305 whole_static_libs: [ 306 "com.android.input.flags-aconfig-cc", 307 "iinputflinger_aidl_lib_static", 308 "libinput_rust_ffi", 309 ], 310 311 export_static_lib_headers: [ 312 "libui-types", 313 ], 314 315 export_generated_headers: [ 316 "cxx-bridge-header", 317 "libinput_cxx_bridge_header", 318 ], 319 320 target: { 321 android: { 322 required: [ 323 "motion_predictor_model_config", 324 "motion_predictor_model_prebuilt", 325 ], 326 static_libs: [ 327 "libstatslog_libinput", 328 "libstatssocket_lazy", 329 ], 330 }, 331 host: { 332 include_dirs: [ 333 "bionic/libc/kernel/android/uapi/", 334 "bionic/libc/kernel/uapi", 335 ], 336 }, 337 }, 338} 339 340cc_library_static { 341 name: "libstatslog_libinput", 342 generated_sources: ["statslog_libinput.cpp"], 343 generated_headers: ["statslog_libinput.h"], 344 cflags: [ 345 "-Wall", 346 "-Werror", 347 ], 348 export_generated_headers: ["statslog_libinput.h"], 349 shared_libs: [ 350 "libcutils", 351 "liblog", 352 "libutils", 353 ], 354 static_libs: [ 355 "libstatssocket_lazy", 356 ], 357} 358 359genrule { 360 name: "statslog_libinput.h", 361 tools: ["stats-log-api-gen"], 362 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h " + 363 "--module libinput --namespace android,libinput", 364 out: [ 365 "statslog_libinput.h", 366 ], 367} 368 369genrule { 370 name: "statslog_libinput.cpp", 371 tools: ["stats-log-api-gen"], 372 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp " + 373 "--module libinput --namespace android,libinput " + 374 "--importHeader statslog_libinput.h", 375 out: [ 376 "statslog_libinput.cpp", 377 ], 378} 379 380cc_defaults { 381 name: "libinput_fuzz_defaults", 382 cpp_std: "c++20", 383 host_supported: true, 384 shared_libs: [ 385 "libbase", 386 "liblog", 387 "libutils", 388 ], 389} 390 391cc_fuzz { 392 name: "libinput_fuzz_propertymap", 393 defaults: ["libinput_fuzz_defaults"], 394 srcs: [ 395 "PropertyMap.cpp", 396 "PropertyMap_fuzz.cpp", 397 ], 398} 399 400subdirs = ["tests"] 401