mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-02-01 07:50:47 +00:00
thermal: update to Thermal HAL v1.1
am: de912858f8
Change-Id: I4c1fe32b929980ad80267af293e9b6bedf54f8f9
This commit is contained in:
@@ -353,7 +353,7 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Thermal packages
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.thermal@1.0-impl-wahoo
|
||||
android.hardware.thermal@1.1-impl-wahoo
|
||||
|
||||
#GNSS HAL
|
||||
PRODUCT_PACKAGES += \
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.thermal</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IThermal</name>
|
||||
<instance>default</instance>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cc_library_shared {
|
||||
name: "android.hardware.thermal@1.0-wahoo",
|
||||
name: "android.hardware.thermal@1.1-wahoo",
|
||||
defaults: ["hidl_defaults"],
|
||||
owner: "qcom",
|
||||
vendor: true,
|
||||
@@ -15,5 +15,6 @@ cc_library_shared {
|
||||
"libhidltransport",
|
||||
"libutils",
|
||||
"android.hardware.thermal@1.0",
|
||||
"android.hardware.thermal@1.1",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -25,11 +25,29 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace thermal {
|
||||
namespace V1_0 {
|
||||
namespace V1_1 {
|
||||
namespace implementation {
|
||||
|
||||
Thermal::Thermal() : enabled(initThermal()) {}
|
||||
|
||||
namespace {
|
||||
|
||||
// Saves the IThermalCallback client object registered from the
|
||||
// framework for sending thermal events to the framework thermal event bus.
|
||||
sp<IThermalCallback> gThermalCallback;
|
||||
|
||||
struct ThermalDeathRecipient : hidl_death_recipient {
|
||||
virtual void serviceDied(
|
||||
uint64_t cookie __unused, const wp<IBase>& who __unused) {
|
||||
gThermalCallback = nullptr;
|
||||
LOG(ERROR) << "IThermalCallback HIDL service died";
|
||||
}
|
||||
};
|
||||
|
||||
sp<ThermalDeathRecipient> gThermalCallbackDied = nullptr;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// Methods from ::android::hardware::thermal::V1_0::IThermal follow.
|
||||
Return<void> Thermal::getTemperatures(getTemperatures_cb _hidl_cb) {
|
||||
ThermalStatus status;
|
||||
@@ -112,8 +130,28 @@ Return<void> Thermal::getCoolingDevices(getCoolingDevices_cb _hidl_cb) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::thermal::V1_1::IThermal follow.
|
||||
|
||||
Return<void> Thermal::registerThermalCallback(
|
||||
const sp<IThermalCallback>& callback) {
|
||||
gThermalCallback = callback;
|
||||
|
||||
if (gThermalCallback != nullptr) {
|
||||
if (gThermalCallbackDied == nullptr)
|
||||
gThermalCallbackDied = new ThermalDeathRecipient();
|
||||
|
||||
if (gThermalCallbackDied != nullptr)
|
||||
gThermalCallback->linkToDeath(
|
||||
gThermalCallbackDied, 0x451F /* cookie, unused */);
|
||||
LOG(INFO) << "ThermalCallback registered";
|
||||
} else {
|
||||
LOG(INFO) << "ThermalCallback unregistered";
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace V1_1
|
||||
} // namespace thermal
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
@@ -13,28 +13,33 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_HARDWARE_THERMAL_V1_0_WAHOO_THERMAL_H
|
||||
#define ANDROID_HARDWARE_THERMAL_V1_0_WAHOO_THERMAL_H
|
||||
#ifndef ANDROID_HARDWARE_THERMAL_V1_1_WAHOO_THERMAL_H
|
||||
#define ANDROID_HARDWARE_THERMAL_V1_1_WAHOO_THERMAL_H
|
||||
|
||||
#include <android/hardware/thermal/1.0/IThermal.h>
|
||||
#include <android/hardware/thermal/1.1/IThermal.h>
|
||||
#include <android/hardware/thermal/1.1/IThermalCallback.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace thermal {
|
||||
namespace V1_0 {
|
||||
namespace V1_1 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::thermal::V1_0::CoolingDevice;
|
||||
using ::android::hardware::thermal::V1_0::CpuUsage;
|
||||
using ::android::hardware::thermal::V1_0::IThermal;
|
||||
using ::android::hardware::thermal::V1_0::Temperature;
|
||||
using ::android::hardware::thermal::V1_0::ThermalStatus;
|
||||
using ::android::hardware::thermal::V1_0::ThermalStatusCode;
|
||||
using ::android::hardware::thermal::V1_1::IThermal;
|
||||
using ::android::hardware::thermal::V1_1::IThermalCallback;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_death_recipient;
|
||||
using ::android::hidl::base::V1_0::IBase;
|
||||
using ::android::sp;
|
||||
|
||||
struct Thermal : public IThermal {
|
||||
@@ -43,15 +48,18 @@ struct Thermal : public IThermal {
|
||||
Return<void> getTemperatures(getTemperatures_cb _hidl_cb) override;
|
||||
Return<void> getCpuUsages(getCpuUsages_cb _hidl_cb) override;
|
||||
Return<void> getCoolingDevices(getCoolingDevices_cb _hidl_cb) override;
|
||||
// Methods from ::android::hardware::thermal::V1_1::IThermal follow.
|
||||
Return<void> registerThermalCallback(
|
||||
const sp<IThermalCallback>& callback) override;
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace V1_1
|
||||
} // namespace thermal
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_THERMAL_V1_0_WAHOO_THERMAL_H
|
||||
#endif // ANDROID_HARDWARE_THERMAL_V1_1_WAHOO_THERMAL_H
|
||||
|
||||
@@ -30,9 +30,11 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace thermal {
|
||||
namespace V1_0 {
|
||||
namespace V1_1 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::thermal::V1_0::TemperatureType;
|
||||
|
||||
static unsigned int gSkinSensorNum;
|
||||
static unsigned int gTsensOffset;
|
||||
static unsigned int gSkinThrottlingThreshold;
|
||||
@@ -287,7 +289,7 @@ ssize_t fillCpuUsages(hidl_vec<CpuUsage> *cpuUsages) {
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace V1_1
|
||||
} // namespace thermal
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
#ifndef __THERMAL_HELPER_H__
|
||||
#define __THERMAL_HELPER_H__
|
||||
|
||||
#include <android/hardware/thermal/1.0/IThermal.h>
|
||||
#include <android/hardware/thermal/1.1/IThermal.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace thermal {
|
||||
namespace V1_0 {
|
||||
namespace V1_1 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::thermal::V1_0::CpuUsage;
|
||||
@@ -92,7 +92,7 @@ ssize_t fillTemperatures(hidl_vec<Temperature> *temperatures);
|
||||
ssize_t fillCpuUsages(hidl_vec<CpuUsage> *cpuUsages);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace V1_1
|
||||
} // namespace thermal
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
Reference in New Issue
Block a user