OSDN Git Service

health: add default health HAL service implementation
authorSandeep Patil <sspatil@google.com>
Thu, 10 Nov 2016 17:22:27 +0000 (09:22 -0800)
committerSandeep Patil <sspatil@google.com>
Fri, 11 Nov 2016 17:28:27 +0000 (09:28 -0800)
Test: Tested with stub HAL on angler
Bug: b/32754732

Change-Id: I54a5ac536e1f34cf2498972653aef702cd926b2a
Signed-off-by: Sandeep Patil <sspatil@google.com>
health/1.0/default/Android.mk
health/1.0/default/HealthService.cpp [new file with mode: 0644]
health/1.0/default/android.hardware.health@1.0-service.rc [new file with mode: 0644]

index 324912e..3d9d58a 100644 (file)
@@ -34,4 +34,23 @@ LOCAL_SHARED_LIBRARIES := \
 
 include $(BUILD_STATIC_LIBRARY)
 
+include $(CLEAR_VARS)
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.health@1.0-service
+LOCAL_INIT_RC := android.hardware.health@1.0-service.rc
+LOCAL_SRC_FILES := \
+    HealthService.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    liblog \
+    libcutils \
+    libdl \
+    libbase \
+    libutils \
+    libhwbinder \
+    libhidl \
+    android.hardware.health@1.0 \
+
+include $(BUILD_EXECUTABLE)
+
 include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/health/1.0/default/HealthService.cpp b/health/1.0/default/HealthService.cpp
new file mode 100644 (file)
index 0000000..107f33d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016 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.
+ */
+
+#define LOG_TAG "android.hardware.health@1.0-service"
+
+#include <android/hardware/health/1.0/IHealth.h>
+#include <hidl/LegacySupport.h>
+
+using android::hardware::health::V1_0::IHealth;
+using android::hardware::defaultPassthroughServiceImplementation;
+
+int main() {
+    return defaultPassthroughServiceImplementation<IHealth>("health");
+}
diff --git a/health/1.0/default/android.hardware.health@1.0-service.rc b/health/1.0/default/android.hardware.health@1.0-service.rc
new file mode 100644 (file)
index 0000000..a0d6a56
--- /dev/null
@@ -0,0 +1,4 @@
+service health-hal-1-0 /system/bin/hw/android.hardware.health@1.0-service
+    class hal
+    user system
+    group system