1// Copyright (C) 2017 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 15package { 16 // See: http://go/android-license-faq 17 // A large-scale-change added 'default_applicable_licenses' to import 18 // all of the 'license_kinds' from "hardware_libhardware_license" 19 // to get the below license kinds: 20 // SPDX-license-identifier-Apache-2.0 21 default_applicable_licenses: ["hardware_libhardware_license"], 22} 23 24cc_defaults { 25 name: "dynamic_sensor_defaults", 26 27 // intended to be integrated into hal, thus vendor 28 vendor: true, 29 30 cflags: [ 31 "-Wall", 32 "-Werror", 33 "-Wextra", 34 ], 35 export_include_dirs: ["."], 36 37 shared_libs: [ 38 "libhidparser", 39 ], 40 41 target: { 42 android: { 43 srcs: [ 44 "BaseDynamicSensorDaemon.cpp", 45 "BaseSensorObject.cpp", 46 "ConnectionDetector.cpp", 47 "DummyDynamicAccelDaemon.cpp", 48 "DynamicSensorManager.cpp", 49 "HidRawDevice.cpp", 50 "HidRawSensor.cpp", 51 "HidRawSensorDaemon.cpp", 52 "HidRawSensorDevice.cpp", 53 "RingBuffer.cpp", 54 ], 55 shared_libs: [ 56 "libbase", 57 "libcutils", 58 "liblog", 59 "libutils", 60 ], 61 header_libs: [ 62 "libhardware_headers", 63 "libstagefright_foundation_headers", 64 ], 65 }, 66 67 host: { 68 local_include_dirs: [ 69 "test", 70 "HidUtils/test", 71 ], 72 }, 73 74 // host test is targeting linux host only 75 darwin: { 76 enabled: false, 77 }, 78 }, 79} 80 81// 82// There are two ways to utilize the dynamic sensor module: 83// 1. Use as an extension in an existing hal: declare dependency on libdynamic_sensor_ext shared 84// library in existing sensor hal. 85// 2. Use as a standalone sensor HAL and configure multihal to combine it with sensor hal that 86// hosts other sensors: add dependency on sensors.dynamic_sensor_hal in device level makefile and 87// write multihal configuration file accordingly. 88// 89// Please take only one of these two options to avoid conflict over hardware resource. 90// 91// 92// Option 1: sensor extension module 93// 94cc_library_shared { 95 name: "libdynamic_sensor_ext", 96 defaults: ["dynamic_sensor_defaults"], 97 98 cflags: ["-DLOG_TAG=\"DynamicSensorExt\""], 99} 100 101// 102// Option 2: independent sensor hal 103// 104cc_library_shared { 105 name: "sensors.dynamic_sensor_hal", 106 defaults: ["dynamic_sensor_defaults"], 107 relative_install_path: "hw", 108 109 cflags: ["-DLOG_TAG=\"DynamicSensorHal\""], 110 111 srcs: ["sensors.cpp"], 112} 113 114// 115// Host test for HidRawSensor. Test with dummy test HID descriptors. 116// 117cc_binary_host { 118 name: "hidrawsensor_host_test", 119 defaults: ["dynamic_sensor_defaults"], 120 121 srcs: [ 122 "HidRawSensor.cpp", 123 "BaseSensorObject.cpp", 124 "HidUtils/test/TestHidDescriptor.cpp", 125 "test/HidRawSensorTest.cpp", 126 ], 127} 128 129// 130// Host test for HidRawDevice and HidRawSensor. Test with hidraw 131// device node. 132// 133cc_binary_host { 134 name: "hidrawdevice_host_test", 135 defaults: ["dynamic_sensor_defaults"], 136 137 srcs: [ 138 "HidRawDevice.cpp", 139 "HidRawSensor.cpp", 140 "BaseSensorObject.cpp", 141 "test/HidRawDeviceTest.cpp", 142 ], 143} 144