• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2015 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
15#
16# Nanohub sensor HAL usage instructions:
17#
18# Add the following to your device.mk file.
19#
20# # Enable the nanohub sensor HAL
21# TARGET_USES_NANOHUB_SENSORHAL := true
22#
23# # Nanohub sensor list source file
24# NANOHUB_SENSORHAL_SENSORLIST := $(LOCAL_PATH)/sensorhal/sensorlist.cpp
25#
26# # Sensor HAL name override (optional)
27# NANOHUB_SENSORHAL_NAME_OVERRIDE := sensors.nanohub
28#
29# # Enable lid-state reporting (optional)
30# NANOHUB_SENSORHAL_LID_STATE_ENABLED := true
31#
32# # Enable mag-bias reporting (optional)
33# NANOHUB_SENSORHAL_USB_MAG_BIAS_ENABLED := true
34#
35
36LOCAL_PATH := $(call my-dir)
37
38ifeq ($(TARGET_USES_NANOHUB_SENSORHAL), true)
39
40COMMON_CFLAGS := -Wall -Werror -Wextra
41
42################################################################################
43
44include $(CLEAR_VARS)
45
46ifeq ($(NANOHUB_SENSORHAL_NAME_OVERRIDE),)
47ifeq ($(TARGET_DEVICE),angler_treble)
48LOCAL_MODULE := sensors.angler
49else
50ifeq ($(TARGET_DEVICE),bullhead_treble)
51LOCAL_MODULE := sensors.bullhead
52else
53LOCAL_MODULE := sensors.$(TARGET_DEVICE)
54endif
55endif
56else
57LOCAL_MODULE := $(NANOHUB_SENSORHAL_NAME_OVERRIDE)
58endif
59
60LOCAL_MODULE_RELATIVE_PATH := hw
61LOCAL_MODULE_TAGS := optional
62LOCAL_MODULE_OWNER := google
63LOCAL_PROPRIETARY_MODULE := true
64
65LOCAL_CFLAGS += $(COMMON_CFLAGS)
66
67LOCAL_C_INCLUDES += \
68	device/google/contexthub/firmware/os/inc \
69	device/google/contexthub/util/common
70
71LOCAL_SRC_FILES := \
72	sensors.cpp \
73	../../../../$(NANOHUB_SENSORHAL_SENSORLIST)
74
75LOCAL_SHARED_LIBRARIES := \
76	liblog \
77	libcutils \
78	libhubconnection \
79	libstagefright_foundation \
80	libutils
81
82ifeq ($(NANOHUB_SENSORHAL_DIRECT_REPORT_ENABLED), true)
83LOCAL_CFLAGS += -DDIRECT_REPORT_ENABLED
84endif
85
86ifeq ($(NANOHUB_SENSORHAL_DYNAMIC_SENSOR_EXT_ENABLED), true)
87LOCAL_CFLAGS += -DDYNAMIC_SENSOR_EXT_ENABLED
88LOCAL_SHARED_LIBRARIES += libdynamic_sensor_ext
89endif
90
91include $(BUILD_SHARED_LIBRARY)
92
93################################################################################
94
95include $(CLEAR_VARS)
96
97LOCAL_MODULE := activity_recognition.$(TARGET_DEVICE)
98LOCAL_MODULE_RELATIVE_PATH := hw
99LOCAL_MODULE_TAGS := optional
100LOCAL_MODULE_OWNER := google
101LOCAL_PROPRIETARY_MODULE := true
102
103LOCAL_CFLAGS += $(COMMON_CFLAGS)
104
105LOCAL_C_INCLUDES += \
106	device/google/contexthub/firmware/os/inc \
107	device/google/contexthub/util/common
108
109LOCAL_SRC_FILES := \
110	activity.cpp
111
112LOCAL_SHARED_LIBRARIES := \
113	libcutils \
114	libhubconnection \
115	liblog \
116	libstagefright_foundation \
117	libutils
118
119include $(BUILD_SHARED_LIBRARY)
120
121################################################################################
122
123include $(CLEAR_VARS)
124
125LOCAL_MODULE := libhubconnection
126LOCAL_MODULE_TAGS := optional
127LOCAL_MODULE_OWNER := google
128LOCAL_PROPRIETARY_MODULE := true
129
130LOCAL_CFLAGS += $(COMMON_CFLAGS)
131ifeq ($(PRODUCT_FULL_TREBLE),true)
132LOCAL_CFLAGS += -DUSE_SENSORSERVICE_TO_GET_FIFO
133endif
134
135ifeq ($(NANOHUB_SENSORHAL_LID_STATE_ENABLED), true)
136LOCAL_CFLAGS += -DLID_STATE_REPORTING_ENABLED
137endif
138
139ifeq ($(NANOHUB_SENSORHAL_USB_MAG_BIAS_ENABLED), true)
140LOCAL_CFLAGS += -DUSB_MAG_BIAS_REPORTING_ENABLED
141endif
142
143ifeq ($(NANOHUB_SENSORHAL_DOUBLE_TOUCH_ENABLED), true)
144LOCAL_CFLAGS += -DDOUBLE_TOUCH_ENABLED
145endif
146
147ifeq ($(NANOHUB_SENSORHAL_DIRECT_REPORT_ENABLED), true)
148LOCAL_CFLAGS += -DDIRECT_REPORT_ENABLED
149endif
150
151LOCAL_C_INCLUDES += \
152    device/google/contexthub/firmware/os/inc
153
154LOCAL_SRC_FILES := \
155    hubconnection.cpp \
156    directchannel.cpp
157
158LOCAL_STATIC_LIBRARIES := \
159    libhubutilcommon
160
161LOCAL_SHARED_LIBRARIES := \
162    android.frameworks.schedulerservice@1.0 \
163    libcutils \
164    libhardware \
165    libhardware_legacy \
166    libhidlbase \
167    libhidltransport \
168    liblog \
169    libstagefright_foundation \
170    libutils \
171
172include $(BUILD_SHARED_LIBRARY)
173
174################################################################################
175
176endif
177