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