thermal: convert Thermal HAL from standalone service to library

Thermal HAL to be loaded by the vendor thermal-engine executable, in
prep for notifications of thermal events from thermal-engine via
Thermal HAL.

Bug: 30982366
Test: VtsHalThermalV1_0Target on walleye
Change-Id: Ie95d90b79bf6ed10593ebf3ec5accc278fda8720
This commit is contained in:
Todd Poynor
2017-08-17 22:39:24 -07:00
parent c447163a83
commit 5017c68f1d
6 changed files with 21 additions and 109 deletions

View File

@@ -1,4 +1,5 @@
subdirs = [
"thermal",
"vr",
"vibrator",
"wifi_offload",

View File

@@ -353,7 +353,7 @@ PRODUCT_PACKAGES += \
# Thermal packages
PRODUCT_PACKAGES += \
android.hardware.thermal@1.0-service.wahoo
android.hardware.thermal@1.0-impl-wahoo
#GNSS HAL
PRODUCT_PACKAGES += \
@@ -432,10 +432,6 @@ PRODUCT_COPY_FILES += \
# PRODUCT_COPY_FILES += \
# frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml
# Thermal packages
PRODUCT_PACKAGES += \
thermal.default
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += \
tinyplay \

19
thermal/Android.bp Normal file
View File

@@ -0,0 +1,19 @@
cc_library_shared {
name: "android.hardware.thermal@1.0-wahoo",
defaults: ["hidl_defaults"],
owner: "qcom",
vendor: true,
relative_install_path: "hw",
srcs: [
"Thermal.cpp",
"thermal-helper.cpp",
],
export_include_dirs: ["."],
shared_libs: [
"libbase",
"libhidlbase",
"libhidltransport",
"libutils",
"android.hardware.thermal@1.0",
],
}

View File

@@ -1,37 +0,0 @@
#
# Copyright 2017 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.
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_OWNER := qcom
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := android.hardware.thermal@1.0-service.wahoo
LOCAL_INIT_RC := android.hardware.thermal@1.0-service.wahoo.rc
LOCAL_SRC_FILES := service.cpp Thermal.cpp thermal-helper.cpp
LOCAL_SHARED_LIBRARIES := \
libhidlbase \
libhidltransport \
libutils \
libbase \
android.hardware.thermal@1.0 \
include $(BUILD_EXECUTABLE)

View File

@@ -1,4 +0,0 @@
service thermal-hal-1-0 /vendor/bin/hw/android.hardware.thermal@1.0-service.wahoo
class hal
user nobody
group nobody

View File

@@ -1,63 +0,0 @@
/*
* Copyright (C) 2017 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.
*/
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include "Thermal.h"
using android::sp;
using android::status_t;
using android::OK;
// libhwbinder:
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
// Generated HIDL files
using android::hardware::thermal::V1_0::IThermal;
using android::hardware::thermal::V1_0::implementation::Thermal;
int main() {
status_t status;
android::sp<IThermal> service = nullptr;
LOG(INFO) << "Thermal HAL Service 1.0 is starting";
service = new Thermal();
if (service == nullptr) {
LOG(ERROR) << "Can not create an instance of Thermal HAL Iface, exiting";
goto shutdown;
}
configureRpcThreadpool(1, true /*callerWillJoin*/);
status = service->registerAsService();
if (status != OK) {
LOG(ERROR) << "Could not register service for Thermal HAL Iface (" << status << ")";
goto shutdown;
}
LOG(INFO) << "Thermal Service is ready";
joinRpcThreadpool();
// Should not pass this line
shutdown:
// In normal operation, we don't expect the thread pool to exit
LOG(ERROR) << "Thermal Service is shutting down";
return 1;
}