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