| // Copyright (C) 2013 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // libinput is partially built for the host (used by build time keymap validation tool) |
| |
| package { |
| // See: http://go/android-license-faq |
| // A large-scale-change added 'default_applicable_licenses' to import |
| // all of the 'license_kinds' from "frameworks_native_license" |
| // to get the below license kinds: |
| // SPDX-license-identifier-Apache-2.0 |
| default_applicable_licenses: ["frameworks_native_license"], |
| } |
| |
| filegroup { |
| name: "inputconstants_aidl", |
| srcs: [ |
| "android/os/IInputConstants.aidl", |
| "android/os/InputEventInjectionResult.aidl", |
| "android/os/InputEventInjectionSync.aidl", |
| "android/os/InputConfig.aidl", |
| ], |
| } |
| |
| ///////////////////////////////////////////////// |
| // flags |
| ///////////////////////////////////////////////// |
| aconfig_declarations { |
| name: "com.android.input.flags-aconfig", |
| package: "com.android.input.flags", |
| srcs: ["input_flags.aconfig"], |
| } |
| |
| cc_aconfig_library { |
| name: "com.android.input.flags-aconfig-cc", |
| aconfig_declarations: "com.android.input.flags-aconfig", |
| host_supported: true, |
| // Use the test version of the aconfig flag library by default to allow tests to set local |
| // overrides for flags, without having to link against a separate version of libinput or of this |
| // library. Bundling this library directly into libinput prevents us from having to add this |
| // library as a shared lib dependency everywhere where libinput is used. |
| mode: "test", |
| shared: { |
| enabled: false, |
| }, |
| } |
| |
| aidl_interface { |
| name: "inputconstants", |
| host_supported: true, |
| vendor_available: true, |
| unstable: true, |
| srcs: [ |
| ":inputconstants_aidl", |
| ], |
| |
| backend: { |
| rust: { |
| enabled: true, |
| }, |
| }, |
| } |
| |
| rust_bindgen { |
| name: "libinput_bindgen", |
| host_supported: true, |
| crate_name: "input_bindgen", |
| visibility: ["//frameworks/native/services/inputflinger"], |
| wrapper_src: "InputWrapper.hpp", |
| |
| include_dirs: [ |
| "frameworks/native/include", |
| ], |
| |
| source_stem: "bindings", |
| |
| bindgen_flags: [ |
| "--verbose", |
| "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED", |
| "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED", |
| "--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED", |
| "--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT", |
| "--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE", |
| "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL", |
| "--allowlist-var=AMOTION_EVENT_ACTION_UP", |
| "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN", |
| "--allowlist-var=AMOTION_EVENT_ACTION_DOWN", |
| "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT", |
| "--allowlist-var=MAX_POINTER_ID", |
| "--allowlist-var=AINPUT_SOURCE_CLASS_NONE", |
| "--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON", |
| "--allowlist-var=AINPUT_SOURCE_CLASS_POINTER", |
| "--allowlist-var=AINPUT_SOURCE_CLASS_NAVIGATION", |
| "--allowlist-var=AINPUT_SOURCE_CLASS_POSITION", |
| "--allowlist-var=AINPUT_SOURCE_CLASS_JOYSTICK", |
| "--allowlist-var=AINPUT_SOURCE_UNKNOWN", |
| "--allowlist-var=AINPUT_SOURCE_KEYBOARD", |
| "--allowlist-var=AINPUT_SOURCE_DPAD", |
| "--allowlist-var=AINPUT_SOURCE_GAMEPAD", |
| "--allowlist-var=AINPUT_SOURCE_TOUCHSCREEN", |
| "--allowlist-var=AINPUT_SOURCE_MOUSE", |
| "--allowlist-var=AINPUT_SOURCE_STYLUS", |
| "--allowlist-var=AINPUT_SOURCE_BLUETOOTH_STYLUS", |
| "--allowlist-var=AINPUT_SOURCE_TRACKBALL", |
| "--allowlist-var=AINPUT_SOURCE_MOUSE_RELATIVE", |
| "--allowlist-var=AINPUT_SOURCE_TOUCHPAD", |
| "--allowlist-var=AINPUT_SOURCE_TOUCH_NAVIGATION", |
| "--allowlist-var=AINPUT_SOURCE_JOYSTICK", |
| "--allowlist-var=AINPUT_SOURCE_HDMI", |
| "--allowlist-var=AINPUT_SOURCE_SENSOR", |
| "--allowlist-var=AINPUT_SOURCE_ROTARY_ENCODER", |
| ], |
| |
| static_libs: [ |
| "inputconstants-cpp", |
| "libui-types", |
| ], |
| shared_libs: ["libc++"], |
| header_libs: [ |
| "native_headers", |
| "jni_headers", |
| "flatbuffer_headers", |
| ], |
| } |
| |
| // Contains methods to help access C++ code from rust |
| cc_library_static { |
| name: "libinput_from_rust_to_cpp", |
| cpp_std: "c++20", |
| host_supported: true, |
| cflags: [ |
| "-Wall", |
| "-Wextra", |
| "-Werror", |
| ], |
| srcs: [ |
| "FromRustToCpp.cpp", |
| ], |
| |
| generated_headers: [ |
| "cxx-bridge-header", |
| ], |
| generated_sources: ["libinput_cxx_bridge_code"], |
| |
| shared_libs: [ |
| "libbase", |
| ], |
| } |
| |
| cc_library { |
| name: "libinput", |
| cpp_std: "c++20", |
| host_supported: true, |
| cflags: [ |
| "-Wall", |
| "-Wextra", |
| "-Werror", |
| "-Wno-unused-parameter", |
| "-Wthread-safety", |
| "-Wshadow", |
| "-Wshadow-field-in-constructor-modified", |
| "-Wshadow-uncaptured-local", |
| "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", |
| ], |
| srcs: [ |
| "android/os/IInputFlinger.aidl", |
| "Input.cpp", |
| "InputDevice.cpp", |
| "InputEventLabels.cpp", |
| "InputTransport.cpp", |
| "InputVerifier.cpp", |
| "Keyboard.cpp", |
| "KeyCharacterMap.cpp", |
| "KeyLayoutMap.cpp", |
| "MotionPredictor.cpp", |
| "MotionPredictorMetricsManager.cpp", |
| "PrintTools.cpp", |
| "PropertyMap.cpp", |
| "TfLiteMotionPredictor.cpp", |
| "TouchVideoFrame.cpp", |
| "VelocityControl.cpp", |
| "VelocityTracker.cpp", |
| "VirtualInputDevice.cpp", |
| "VirtualKeyMap.cpp", |
| ], |
| |
| header_libs: [ |
| "flatbuffer_headers", |
| "jni_headers", |
| "libeigen", |
| "tensorflow_headers", |
| ], |
| export_header_lib_headers: [ |
| "jni_headers", |
| "libeigen", |
| ], |
| |
| generated_headers: [ |
| "cxx-bridge-header", |
| "libinput_cxx_bridge_header", |
| "toolbox_input_labels", |
| ], |
| |
| shared_libs: [ |
| "libbase", |
| "libbinder", |
| "libcutils", |
| "liblog", |
| "libPlatformProperties", |
| "libtinyxml2", |
| "libutils", |
| "libvintf", |
| "server_configurable_flags", |
| ], |
| |
| ldflags: [ |
| "-Wl,--exclude-libs=libtflite_static.a", |
| ], |
| |
| sanitize: { |
| undefined: true, |
| all_undefined: true, |
| misc_undefined: ["integer"], |
| }, |
| |
| static_libs: [ |
| "inputconstants-cpp", |
| "libgui_window_info_static", |
| "libui-types", |
| "libtflite_static", |
| ], |
| |
| whole_static_libs: [ |
| "com.android.input.flags-aconfig-cc", |
| "libinput_rust_ffi", |
| ], |
| |
| export_static_lib_headers: [ |
| "libgui_window_info_static", |
| "libui-types", |
| ], |
| |
| export_generated_headers: [ |
| "cxx-bridge-header", |
| "libinput_cxx_bridge_header", |
| ], |
| |
| target: { |
| android: { |
| export_shared_lib_headers: ["libbinder"], |
| |
| shared_libs: [ |
| "libutils", |
| "libbinder", |
| // Stats logging library and its dependencies. |
| "libstatslog_libinput", |
| "libstatsbootstrap", |
| "android.os.statsbootstrap_aidl-cpp", |
| ], |
| |
| required: [ |
| "motion_predictor_model_prebuilt", |
| "motion_predictor_model_config", |
| ], |
| }, |
| host: { |
| include_dirs: [ |
| "bionic/libc/kernel/android/uapi/", |
| "bionic/libc/kernel/uapi", |
| ], |
| }, |
| }, |
| |
| aidl: { |
| local_include_dirs: ["."], |
| export_aidl_headers: true, |
| include_dirs: [ |
| "frameworks/native/libs/gui", |
| ], |
| }, |
| } |
| |
| // Use bootstrap version of stats logging library. |
| // libinput is a bootstrap process (starts early in the boot process), and thus can't use the normal |
| // `libstatslog` because that requires `libstatssocket`, which is only available later in the boot. |
| cc_library { |
| name: "libstatslog_libinput", |
| generated_sources: ["statslog_libinput.cpp"], |
| generated_headers: ["statslog_libinput.h"], |
| export_generated_headers: ["statslog_libinput.h"], |
| shared_libs: [ |
| "libbinder", |
| "libstatsbootstrap", |
| "libutils", |
| "android.os.statsbootstrap_aidl-cpp", |
| ], |
| } |
| |
| genrule { |
| name: "statslog_libinput.h", |
| tools: ["stats-log-api-gen"], |
| cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h --module libinput" + |
| " --namespace android,stats,libinput --bootstrap", |
| out: [ |
| "statslog_libinput.h", |
| ], |
| } |
| |
| genrule { |
| name: "statslog_libinput.cpp", |
| tools: ["stats-log-api-gen"], |
| cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp --module libinput" + |
| " --namespace android,stats,libinput --importHeader statslog_libinput.h" + |
| " --bootstrap", |
| out: [ |
| "statslog_libinput.cpp", |
| ], |
| } |
| |
| cc_defaults { |
| name: "libinput_fuzz_defaults", |
| cpp_std: "c++20", |
| host_supported: true, |
| shared_libs: [ |
| "libutils", |
| "libbase", |
| "liblog", |
| ], |
| } |
| |
| cc_fuzz { |
| name: "libinput_fuzz_propertymap", |
| defaults: ["libinput_fuzz_defaults"], |
| srcs: [ |
| "PropertyMap.cpp", |
| "PropertyMap_fuzz.cpp", |
| ], |
| } |
| |
| subdirs = ["tests"] |