| // 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", |
| ], |
| } |
| |
| 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_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", |
| ], |
| |
| 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", |
| ], |
| } |
| |
| genrule { |
| name: "libinput_cxx_bridge_code", |
| tools: ["cxxbridge"], |
| cmd: "$(location cxxbridge) $(in) >> $(out)", |
| srcs: ["input_verifier.rs"], |
| out: ["inputverifier_generated.cpp"], |
| } |
| |
| genrule { |
| name: "libinput_cxx_bridge_header", |
| tools: ["cxxbridge"], |
| cmd: "$(location cxxbridge) $(in) --header >> $(out)", |
| srcs: ["input_verifier.rs"], |
| out: ["input_verifier.rs.h"], |
| } |
| |
| rust_defaults { |
| name: "libinput_rust_defaults", |
| srcs: ["input_verifier.rs"], |
| host_supported: true, |
| rustlibs: [ |
| "libbitflags", |
| "libcxx", |
| "libinput_bindgen", |
| "liblogger", |
| "liblog_rust", |
| "inputconstants-rust", |
| ], |
| |
| shared_libs: [ |
| "libbase", |
| "liblog", |
| ], |
| } |
| |
| rust_ffi_static { |
| name: "libinput_rust", |
| crate_name: "input", |
| defaults: ["libinput_rust_defaults"], |
| } |
| |
| rust_test { |
| name: "libinput_rust_test", |
| defaults: ["libinput_rust_defaults"], |
| whole_static_libs: [ |
| "libinput_from_rust_to_cpp", |
| ], |
| test_options: { |
| unit_test: true, |
| }, |
| test_suites: ["device_tests"], |
| sanitize: { |
| hwaddress: true, |
| }, |
| } |
| |
| cc_library { |
| name: "libinput", |
| cpp_std: "c++20", |
| host_supported: true, |
| cflags: [ |
| "-Wall", |
| "-Wextra", |
| "-Werror", |
| "-Wno-unused-parameter", |
| ], |
| srcs: [ |
| "FromRustToCpp.cpp", |
| "Input.cpp", |
| "InputDevice.cpp", |
| "InputEventLabels.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", |
| ], |
| |
| generated_sources: ["libinput_cxx_bridge_code"], |
| |
| shared_libs: [ |
| "libbase", |
| "libcutils", |
| "liblog", |
| "libPlatformProperties", |
| "libtinyxml2", |
| "libvintf", |
| ], |
| |
| ldflags: [ |
| "-Wl,--exclude-libs=libtflite_static.a", |
| ], |
| |
| sanitize: { |
| undefined: true, |
| all_undefined: true, |
| misc_undefined: ["integer"], |
| }, |
| |
| static_libs: [ |
| "inputconstants-cpp", |
| "libui-types", |
| "libtflite_static", |
| ], |
| |
| whole_static_libs: [ |
| "libinput_rust", |
| ], |
| |
| export_static_lib_headers: [ |
| "libui-types", |
| ], |
| |
| export_generated_headers: [ |
| "cxx-bridge-header", |
| "libinput_cxx_bridge_header", |
| ], |
| |
| target: { |
| android: { |
| srcs: [ |
| "InputTransport.cpp", |
| "android/os/IInputFlinger.aidl", |
| ], |
| |
| export_shared_lib_headers: ["libbinder"], |
| |
| shared_libs: [ |
| "libutils", |
| "libbinder", |
| // Stats logging library and its dependencies. |
| "libstatslog_libinput", |
| "libstatsbootstrap", |
| "android.os.statsbootstrap_aidl-cpp", |
| ], |
| |
| static_libs: [ |
| "libgui_window_info_static", |
| ], |
| |
| export_static_lib_headers: [ |
| "libgui_window_info_static", |
| ], |
| |
| required: [ |
| "motion_predictor_model_prebuilt", |
| "motion_predictor_model_config", |
| ], |
| }, |
| host: { |
| shared: { |
| enabled: false, |
| }, |
| include_dirs: [ |
| "bionic/libc/kernel/android/uapi/", |
| "bionic/libc/kernel/uapi", |
| "frameworks/native/libs/arect/include", |
| ], |
| }, |
| host_linux: { |
| srcs: [ |
| "InputTransport.cpp", |
| ], |
| static_libs: [ |
| "libgui_window_info_static", |
| ], |
| shared_libs: [ |
| "libbinder", |
| ], |
| |
| export_static_lib_headers: [ |
| "libgui_window_info_static", |
| ], |
| }, |
| }, |
| |
| 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"] |